## Why Should I Upload a Creative?

There may come a time when you wish to upload a newly-created creative to the Kevel site so it can be stored on the site, instead of locally. The Upload Creative Image API call enables you to upload the creative to the Kevel site by:

- creating a new creative
- retrieve the ID for the creative
- create a `POST` request using your API credentials
- place the ID for the creative in the URL

Once you have made the request, Kevel will return a JSON creative object, which shows the path to the uploaded image in Kevel's CDN as an `ImageLink`.

### Note

You will need to attach the image as a form submission to the form-field `image`. In curl, this is prefixed with an `@` sign, followed by the path to the file.

## API Syntax

If you choose to upload a creative to Kevel using the Upload Creative Image API call, you need 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:

`POST https://api.kevel.co/v1/creative/{CreativeID}/upload`

Where:

- `POST` \- the type of API request being made.
- `https://api.kevel.co` \- the URL for the request.
- `v1` \- the API version.
- `creative` \- the API endpoint being called.
- `CreativeID` \- the ID of the creative
- `upload` \- the action you wish to take.

| Field         | Type     | Description                                         |
|---------------|----------|-----------------------------------------------------|
| CreativeID    | int32   | required                                           |
| sizeOverride  | boolean | Add this to upload an image that has different dimensions. |
| fieldName     | string  | Specifies the image field for that creative template.  |

### Response Format
#### `200` Response

```json
{
  "IsActive": true,
  "ImageName": "b5983bd1e1e84a8980499668a8f76822.gif",
  "SaveEmptyCreative": null,
  "Body": "",
  "IsNetworkAd": null,
  "Alt": null,
  "Title": "Hello World Creative",
  "IsDeleted": false,
  "IsSync": null,
  "Url": "http://adzerk.com",
  "IsIdOnly": false,
  "IsNoTrack": null,
  "TemplateValues": null,
  "TemplateId": null,
  "ImageLink": "http://s.zkcdn.net/Advertisers/b5983bd1e1e84a8980499668a8f76822.gif",
  "ScriptBody": "",
  "AdvertiserId": 12345,
  "Metadata": null,
  "AdTypeId": 5,
  "IsHTMLJS": false,
  "Id": 12345
}
```

### Example cURL Commands

```shell
curl -X POST -H "X-Adzerk-ApiKey: <APIKEY>" "https://api.kevel.co/v1/creative/12345/upload" -F "image=@helloworld.gif"

# With size override:

curl -X POST -H "X-Adzerk-ApiKey: <APIKEY>" "https://api.kevel.co/v1/creative/12345/upload?sizeOverride=true" -F "image=@helloworld.gif"

# With template field upload:

curl -X POST -H "X-Adzerk-ApiKey: <APIKEY>" "https://api.kevel.co/v1/creative/12345/upload?fieldName=ctSponsorImage" -F "image=@helloworld.gif"
```
