---
updatedAt: 2026-10-09T14:15:13.000Z
agentTools:
  projectIndex: https://dev.kevel.com/llms.txt
---

# Update Ad

## Why Update an Ad?

Sometimes, you may find it necessary to update an existing ad that is part of a flight or campaign. This may be needed if you want to use new graphics or images, or just make changes to the ad as part of an update to a flight or campaign. The Kevel API lets you make those updates simply and easily by using the Update Ad API call.

> 📘 Note
>
> You can update all fields from Create Ads except for `id`.

> ❗️ Warning
>
> Do not use this endpoint to update creatives from the Create Creatives endpoint. This API call is used to update ads from the Create Ads endpoint.
>
> Also, any fields you do not include in a `PUT` request will be given the default values `null`, `false`, `0`, or `empty array`, depending on the field. This will overwrite any existing values. When making a `PUT` request, make sure you are supplying all the fields that should have values.

## API Syntax

When using the Update Ad API, it is important to understand the syntax required to make the request. Because the Kevel API is a RESTful API, there is a specific request format that must be followed to ensure the endpoint can process the request. The format is:

`PUT https://api.kevel.co/v1/flight/{FlightID}/creative/{AdID}`

Where:

* `PUT` - the type of API request being made.
* `https://api.kevel.co` - the URL for the request.
* `v1` - the API version.
* `flight` - the API endpoint being called.
* `FlightID` - the ID associated with the flight.
* `creative` - the creative associated with the Ad.
* `AdID` - the ID of the ad being updated.

## Category Targeting

Send `CategoryTargeting` to set explicit category rules on the Ad, or `"CategoryTargeting": null` to make the Ad use its Flight’s rules again. A non-empty list replaces the Flight’s complete list. For the rule format, see [Create Ads](https://dev.kevel.com/reference/create-ads#category-targeting).

> 📘 Clearing attribute values
>
> To unset or clear an attribute, set its value to `NULL`.

<br />

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "adzerk-management-apis",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.kevel.co"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "X-Adzerk-ApiKey",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v1/flight/{FlightID}/creative/{AdID}": {
      "put": {
        "summary": "Update Ad",
        "description": "",
        "operationId": "update-ad",
        "parameters": [
          {
            "name": "FlightID",
            "in": "path",
            "description": "The ID of the Flight",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          },
          {
            "name": "AdID",
            "in": "path",
            "description": "This is the ID from the Ad / Creative Flight Map Endpoint. It's not the ID from the Create Creatives endpoint.",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "Id",
                  "FlightID",
                  "Creative",
                  "IsActive",
                  "IsDeleted"
                ],
                "properties": {
                  "Id": {
                    "type": "integer",
                    "description": "ID of the Creative Flight Map / Ad",
                    "format": "int32"
                  },
                  "CampaignID": {
                    "type": "integer",
                    "description": "ID of the Campaign",
                    "format": "int32"
                  },
                  "FlightID": {
                    "type": "integer",
                    "description": "ID of the Flight",
                    "format": "int32"
                  },
                  "Creative": {
                    "type": "object",
                    "description": "A `creative` object that contains the ID (`id`) of the Creative",
                    "properties": {}
                  },
                  "IsActive": {
                    "type": "boolean",
                    "description": "If Ad is active or not"
                  },
                  "IsDeleted": {
                    "type": "boolean",
                    "description": "If Ad is deleted or not"
                  },
                  "Iframe": {
                    "type": "boolean",
                    "description": "Whether Creative should use iFrame"
                  },
                  "DistributionType": {
                    "type": "integer",
                    "description": "Determines how the Ad is distributed within the flight",
                    "format": "int32"
                  },
                  "RtbCustomFields": {
                    "type": "string",
                    "description": "Required for RTB ads only. JSON Object in a String. It's JSON data provided by the RTB partner"
                  },
                  "AttributionSettings": {
                    "type": "object",
                    "properties": {
                      "AttributableItems": {
                        "type": "array",
                        "description": "The set of products, categories, and brands that may be attributed to this Ad. See [Kevel Attribution](doc:attribution-overview) for more details.",
                        "items": {
                          "properties": {
                            "MatchType": {
                              "type": "string",
                              "description": "The match type value determines the other keys included and corresponds to the Flight-level attribution setting for the specificity of the match.",
                              "enum": [
                                "SameProduct",
                                "SameCategoryBrand",
                                "SameBrand",
                                "SameMerchant"
                              ]
                            },
                            "ProductId": {
                              "type": "string",
                              "description": "The Product ID to use with the match. Use with `\"MatchType\": \"SameProduct\"` only."
                            },
                            "MerchantId": {
                              "type": "string",
                              "description": "The Merchant ID to use with the match. Use with `\"MatchType\": \"SameProduct\"` only."
                            },
                            "CategoryId": {
                              "type": "string",
                              "description": "The Category ID to use with the match. Use with `\"MatchType\": \"SameCategoryBrand\"` only."
                            },
                            "BrandId": {
                              "type": "string",
                              "description": "The Brand ID to use with the match. Use with `\"MatchType\": \"SameCategoryBrand\"` and `\"MatchType\": \"SameBrand\"`."
                            }
                          },
                          "type": "object"
                        }
                      }
                    }
                  },
                  "DontAffectParentFreqCap": {
                    "type": "boolean",
                    "description": "\"Opts-out\" of frequency cap settings imposed on it by entities above",
                    "default": false
                  },
                  "FreqCap": {
                    "type": "integer",
                    "description": "The value of the frequency cap",
                    "format": "int32"
                  },
                  "FreqCapDuration": {
                    "type": "integer",
                    "description": "How long the frequency cap should apply",
                    "format": "int32"
                  },
                  "FreqCapType": {
                    "type": "integer",
                    "description": "The unit for the frequency cap: `1 = Hour 2 = Day 3 = Minute`.",
                    "format": "int32"
                  },
                  "CategoryTargeting": {
                    "type": "array",
                    "description": "The category targeting rules for the Ad, in the same format as on a Flight. An Ad that has category rules uses them instead of its Flight's rules, and the two lists are not merged. An Ad with no rules uses its Flight's rules. An Ad can hold up to 25 rules unless Kevel raises the limit for your network. A longer list returns a 400 with \"Your account has exceeded the limit for CategoryTargeting on this ad. Please contact support.\" Set the field to `null` or `[]` to remove the Ad's rules. Send the full list on every update. An update that leaves this field out clears the rules, as it clears any other field you leave out, unless your network uses partial updates. If category targeting is not enabled for your network, Kevel ignores the field on writes and leaves it out of responses, and a malformed value still returns a 400. See [Set up category targeting](doc:set-up-category-targeting).",
                    "items": {
                      "type": "object",
                      "required": [
                        "Id",
                        "IsExclude"
                      ],
                      "properties": {
                        "Id": {
                          "type": "string",
                          "description": "The category to match, written exactly as your ad requests send it in `placements[].category`. Kevel trims spaces from the start and end when it saves the value, and matching is exact and case-sensitive. A parent category does not match its children. The value is a string of 1 to 200 characters."
                        },
                        "IsExclude": {
                          "type": "boolean",
                          "description": "`true` for an exclude rule, `false` for an include rule."
                        }
                      }
                    }
                  }
                }
              },
              "examples": {
                "JSON": {
                  "value": {
                    "Id": 12345,
                    "CampaignId": 123,
                    "Creative": {
                      "Id": 12345
                    },
                    "FlightId": 1234,
                    "IsActive": false,
                    "SizeOverride": false,
                    "IsDeleted": false,
                    "Iframe": false,
                    "DistributionType": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{  \n  \"Id\":12345,\n  \"CampaignId\":123,\n  \"FlightId\":1234,\n  \"ZoneId\":1234,\n  \"SiteId\":12345,\n  \"Iframe\":false,\n  \"Impressions\":0,\n  \"Percentage\":0,\n  \"DistributionType\":1,\n  \"IsDeleted\":false,\n  \"IsActive\":false,\n  \"Creative\": {  \n    \"Id\":123456,\n    \"Title\":\"Adzerk Blue Creative\",\n    \"ImageName\":\"\",\n    \"Url\":\"https://adzerk.com\",\n    \"Body\":\"\",\n    \"AdvertiserId\":1234,\n    \"IsActive\":true,\n    \"AdTypeId\":5,\n    \"Alt\":\"Adzerk - Native Ads\",\n    \"IsDeleted\":false,\n    \"IsSync\":false,\n    \"IsHTMLJS\":true,\n    \"ScriptBody\":\"Flight Creative Map\",\n    \"Metadata\":null,\n    \"ImageLink\":\"httpss://static.adzerk.net/Advertisers/\",\n    \"IsNoTrack\":true,\n    \"IsNetworkAd\":false\n  },\n  \"CustomTargeting\":\"$keywords contains \\\"dean\\\"\",\n  \"FreqCap\":5,\n  \"FreqCapDuration\":1,\n  \"FreqCapType\":2,\n  \"StartDate\":null,\n  \"EndDate\":null,\n  \"GoalType\":1,\n  \"Goal\":20000,\n  \"Price\": 1,\n  \"IsGoalOverride\":true,\n  \"IsStartEndDateOverride\":true,\n  \"ActiveKeywords\":[\"kittens\", \"cats\"],\n  \"RtbCustomFields\":null\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "Id": {
                      "type": "integer",
                      "example": 12345,
                      "default": 0
                    },
                    "CampaignId": {
                      "type": "integer",
                      "example": 123,
                      "default": 0
                    },
                    "FlightId": {
                      "type": "integer",
                      "example": 1234,
                      "default": 0
                    },
                    "ZoneId": {
                      "type": "integer",
                      "example": 1234,
                      "default": 0
                    },
                    "SiteId": {
                      "type": "integer",
                      "example": 12345,
                      "default": 0
                    },
                    "Iframe": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    },
                    "Impressions": {
                      "type": "integer",
                      "example": 0,
                      "default": 0
                    },
                    "Percentage": {
                      "type": "integer",
                      "example": 0,
                      "default": 0
                    },
                    "DistributionType": {
                      "type": "integer",
                      "example": 1,
                      "default": 0
                    },
                    "IsDeleted": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    },
                    "IsActive": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    },
                    "Creative": {
                      "type": "object",
                      "properties": {
                        "Id": {
                          "type": "integer",
                          "example": 123456,
                          "default": 0
                        },
                        "Title": {
                          "type": "string",
                          "example": "Adzerk Blue Creative"
                        },
                        "ImageName": {
                          "type": "string",
                          "example": ""
                        },
                        "Url": {
                          "type": "string",
                          "example": "https://adzerk.com"
                        },
                        "Body": {
                          "type": "string",
                          "example": ""
                        },
                        "AdvertiserId": {
                          "type": "integer",
                          "example": 1234,
                          "default": 0
                        },
                        "IsActive": {
                          "type": "boolean",
                          "example": true,
                          "default": true
                        },
                        "AdTypeId": {
                          "type": "integer",
                          "example": 5,
                          "default": 0
                        },
                        "Alt": {
                          "type": "string",
                          "example": "Adzerk - Native Ads"
                        },
                        "IsDeleted": {
                          "type": "boolean",
                          "example": false,
                          "default": true
                        },
                        "IsSync": {
                          "type": "boolean",
                          "example": false,
                          "default": true
                        },
                        "IsHTMLJS": {
                          "type": "boolean",
                          "example": true,
                          "default": true
                        },
                        "ScriptBody": {
                          "type": "string",
                          "example": "Flight Creative Map"
                        },
                        "Metadata": {},
                        "ImageLink": {
                          "type": "string",
                          "example": "httpss://static.adzerk.net/Advertisers/"
                        },
                        "IsNoTrack": {
                          "type": "boolean",
                          "example": true,
                          "default": true
                        },
                        "IsNetworkAd": {
                          "type": "boolean",
                          "example": false,
                          "default": true
                        }
                      }
                    },
                    "CustomTargeting": {
                      "type": "string",
                      "example": "$keywords contains \"dean\""
                    },
                    "FreqCap": {
                      "type": "integer",
                      "example": 5,
                      "default": 0
                    },
                    "FreqCapDuration": {
                      "type": "integer",
                      "example": 1,
                      "default": 0
                    },
                    "FreqCapType": {
                      "type": "integer",
                      "example": 2,
                      "default": 0
                    },
                    "StartDate": {},
                    "EndDate": {},
                    "GoalType": {
                      "type": "integer",
                      "example": 1,
                      "default": 0
                    },
                    "Goal": {
                      "type": "integer",
                      "example": 20000,
                      "default": 0
                    },
                    "Price": {
                      "type": "integer",
                      "example": 1,
                      "default": 0
                    },
                    "IsGoalOverride": {
                      "type": "boolean",
                      "example": true,
                      "default": true
                    },
                    "IsStartEndDateOverride": {
                      "type": "boolean",
                      "example": true,
                      "default": true
                    },
                    "ActiveKeywords": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "example": "kittens"
                      }
                    },
                    "RtbCustomFields": {},
                    "CategoryTargeting": {
                      "type": "array",
                      "description": "The category targeting rules saved on the Ad itself, each with an `Id` and `IsExclude`. An Ad with no rules of its own uses its Flight's rules, and they do not appear here. Left out when category targeting is not enabled for your network.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "Id": {
                            "type": "string",
                            "description": "The category the rule matches."
                          },
                          "IsExclude": {
                            "type": "boolean",
                            "description": "`true` for an exclude rule, `false` for an include rule."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "## A minimally viable ad update:\ncurl -X PUT -H \"X-Adzerk-ApiKey:$ADZERK_API_KEY\" -H \"Content-Type:application/json\" \"https://api.kevel.co/v1/flight/123456/creative/12345\" --data-binary '{\"Id\":12345, \"IsDeleted\":false, \"Creative\":{\"Id\":1234567}, \"IsActive\":true, \"FlightId\":123456}'"
            },
            {
              "language": "javascript",
              "code": "const Adzerk = require('@adzerk/management-sdk');\nconst apiKey = process.env.ADZERK_API_KEY;\n\nasync function updateAd() {\n  let specifications = await Adzerk.fetchSpecifications();\n  let client = await Adzerk.buildClient({apiKey, specifications});\n\n  let updatedAd = await client.run('ad', 'update', {\n    id: 12345, \n    flightId: 67890,\n    isActive: false\n  });\n  console.log(updatedAd);\n}\n\nupdateAd();"
            },
            {
              "language": "ruby",
              "code": "require \"adzerk\"\n\ndef update_ad()\n    client = Adzerk::Client.new(ENV[\"ADZERK_API_KEY\"])\n    ad_id = 12345\n    flight_id = 67890\n    data = client.ads.get(ad_id, flight_id)\n    data[:is_active] = true\n    data[:creative] = {id: data[:creative][:id]}\n    pp client.ads.update(data)\nend\nupdate_ad()"
            }
          ],
          "samples-languages": [
            "curl",
            "javascript",
            "ruby"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```