### Create Campaign v2 now available!

Version 2 of the Create Campaign endpoint allows you to create a Campaign, Flight(s), Creative(s), and Ad(s) in a single request—all with significantly reduced latency. Visit the [Create Campaign V2 documentation page](https://dev.kevel.com/reference/create-campaign-v2) for more details.

## Why Create a Campaign?

A campaign can be thought of as a collection of flights, which contain the advertiser's ads. Typically flights in a campaign have a common theme, such as a product or promotion.

The Create Campaigns API call creates a new campaign under an advertiser.

For more detailed information about campaigns, please refer to the [Campaigns](https://dev.kevel.com/docs/campaigns) technical documentation.

## API Syntax

When using the Create Campaigns API endpoint, 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:

```
POST https://api.kevel.co/v1/campaign
```

Where:

- `POST` - the type of API request being made.
- `https://api.kevel.co` - the URL for the request.
- `v1` - the API version.
- `campaign` - the API endpoint being called.

## Additional Parameters

The table below lists a few additional parameters that can be passed as part of the API request to the server.

| Property              | Description                                                                                             |
|----------------------|---------------------------------------------------------------------------------------------------------|
| `SalespersonId`      | Network-level login Id of salesperson                                                                    |
| `CustomFieldsJson`   | Sets the value of custom fields based on a custom fields schema. Must contact support before use. More info [here](https://dev.kevel.co/v1.0/docs/custom-fields) |

## Campaign Start and End Dates

It is not possible to set Start and End Dates on the Campaign level. They will, however, populate in API responses and in the UI based on the start and end dates of the flight(s) within the campaign.

### Parameters

- **AdvertiserId**: `int32` required — The advertiser's ID for the campaign.
- **Name**: `string` required — The campaign name.
- **Flights**: `array of int32s` — You can pass an array of flights, a blank array, or not include. See [Create Flight](https://dev.kevel.com/reference/flight#create-flight) endpoint.
- **IsActive**: `boolean` — Defaults to false. Specifies whether campaign should be active (serving ads). Defaults to `false`.
- **IsDeleted**: `boolean` — Specifies whether campaign should be deleted. Do not use when creating a campaign.
- **IsArchived**: `boolean` — Specifies whether campaign should be archived. Do not use when creating a campaign.
- **FreqCap**: `int32` — The number of times the frequency cap should occur.
- **FreqCapDuration**: `int32` — Specifies how often the frequency cap should occur.
- **FreqCapType**: `int32` — The enum value for how often frequency capping should occur. `1 = Hour 2 = Day 3 = Minute`.
- **DontAffectParentFreqCap**: `boolean` — "Opts-out" campaign from advertiser-level frequency cap settings.
- **CapType**: `int32` — Set to `CapType = 4`. Campaigns can only budget cap on revenue metric. Do not set to `0` - if removing, set to `null`.
- **DailyCapAmount**: `int32` — The max daily revenue.
- **LifetimeCapAmount**: `int32` — The max lifetime revenue.

### Example

The example below is a minimally viable campaign:

```
curl -X POST -H 'X-Adzerk-ApiKey:<API-KEY>' -H "Content-Type:application/json" "https://api.kevel.co/v1/campaign" --data-binary '{"Name":"Nike Q4 Campaign","AdvertiserId":12345,"IsActive":true}'
```

#### JSON Response Example

```json
{
  "IsActive": false,
  "DontAffectParentFreqCap": null,
  "Flights": [],
  "DailyCapAmount": null,
  "FreqCapType": 0,
  "EndDate": null,
  "CapType": null,
  "IsFreqCap": false,
  "IsDeleted": false,
  "EndDateISO": null,
  "Price": 0,
  "IsArchived": false,
  "LifetimeCapAmount": null,
  "FreqCapDuration": null,
  "FreqCap": null,
  "SalespersonId": null,
  "AdvertiserId": 12345,
  "Name": "Nike Q4 Campaign",
  "Id": 123456,
  "CustomFieldsJson": null,
  "StartDateISO": "2017-01-01T00:00:00.0000000"
}
```
