Skip to main content

Create a campaign

Create your first campaign using IQM's API in this step-by-step quickstart guide.

The following endpoints are used to create an insertion order (IO) and start a campaign:

POST
POST
POST
GET

About IQM campaigns​

IQM's campaigns define the individual marketing strategies of your ads. By specifying the supported parameters you can use the API to create a new campaign.

More resources​

Before you begin​

To create a campaign, the following are required:

  1. An account on the IQM platform
    • See Getting started section to create an account and request a Client ID and Client Secret
  2. An uploaded creative

Create a campaign using the IQM API​

This quickstart guide covers how to create an insertion order and a new campaign.

The minimum requirements to perform this task are: logging in with authentication credentials, creating an IO, and starting a new campaign. Once these steps are accomplished, more can be learned about IQM's API through the guidelines pages.

  1. Log in
    • Optional if you have already logged in and have a token
  2. Create an insertion order
    • Optional if already created
  3. Create a campaign
  4. Check campaign status

Authentication​

Use the following header parameters for all requests after logging in:

Headers
Authorization
string required
Bearer followed by the access_token from the login response.
See Sign up and authenticate.
X-IAA-OW-ID
integer required
Organization Workspace ID header.

Step 1: Log in​

POST

To log in, send the Authorization: Basic header with your Base64-encoded Client ID and Client Secret, and send the request body as form data (application/x-www-form-urlencoded). The response contains an OAuth access token.

To find the Organization Workspace IDs that you have access to, use Get list of accessible Organizations.

For further information see OAuth token.

Headers
Authorization
string required
Basic followed by your Base64-encoded client_id:client_secret.
See Sign up and authenticate.
Content-Type
string required
application/x-www-form-urlencoded. Send the request body as form data.
Request schema
grant_type
string required
password for login.
See OAuth Grant Types.
username
string required
User account email.
password
string required
User account password.
Request sample
curl -i --location 'https://api.iqm.com/api/v3/ua/oauth/token' \
--header 'accept: application/json, text/plain, */*' \
--header 'Authorization: Basic <Client ID/Client Secret>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=user@iqm.com' \
--data-urlencode 'password=<your password>'
Response 200
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIn0...",
"refresh_token": "eyJhbGciOiJIUzUxMiIsInR5cCIgOiAiSldUIn0...",
"scope": "read write",
"token_type": "bearer",
"expires_in": 86399
}
More responses
Response 401
{
"success": false,
"errorObjects": [
{
"error": "Bad Credentials or invalid grant type"
}
]
}
Response 403
{
"error": "Client details are not provided."
}

Step 2: Create an insertion order​

POST

Before a campaign can be started an insertion order must be created. An insertion order is a contractual agreement that outlines the terms and conditions for one or more advertising campaigns. Once created, a campaign can be created and assigned to an IO.

The minimum required values for IO creation are as listed below. See a complete table of Resource Properties for all supported values.

Read more: Insertion orders (IO) overview

Request schema
ioName
string required
IO name, up to 255 characters.
ioStartTime
integer required
Unix epoch timestamp (in milliseconds) of IO start time. Can't be in the past.
ioEndTime
integer
Unix epoch timestamp (in milliseconds) of IO end time, at least 1 hour after ioStartTime.
ioTotalBudget
number
IO budget. Omit it if isAutoSumIoTotalBudget is true.
ioTimeZoneId
integer
Timezone ID for IO (default: US/Eastern).
isAutoSumIoTotalBudget
boolean
If true, keeps the IO budget equal to the total budget of all included campaigns, and ioTotalBudget can't be sent (default: true).
ioBudgetTypeId
integer required
IO budget type ID.
Supported values
1Budget
2Impression
ioBudgetDistributionMethodId
integer
Budget distribution method ID (default: 1, manual).
Supported values
1Manual
2Auto
Request sample (budget based IO)
{
"ioName": "IO Name 1",
"ioStartTime": 1803859200000,
"ioEndTime": 1806451200000,
"ioTotalBudget": 1000,
"ioTimeZoneId": 29,
"isAutoSumIoTotalBudget": false,
"ioBudgetTypeId": 1,
"ioBudgetDistributionMethodId": 1
}
Response 200
{
"success": true,
"data": {
"ioId": 29311,
"ioName": "IO Name 1",
"owId": 204851,
"createdByUowId": 291477,
"modifiedByUowId": 291477,
"ioStartTime": 1803859200000,
"ioEndTime": 1806451200000,
"ioTotalBudget": 1000.0,
"ioTimeZoneId": 29,
"isAutoSumIoTotalBudget": false,
"ioBudgetDistributionMethodId": 1,
"ioBudgetTypeId": 1,
"ioTotalImpressions": null,
"ioStatusId": 1,
"ioNextPerformanceCheck": null,
"ioLastPriorityShift": null,
"ioCurrentPriority": null,
"isIoPrioritise": false
}
}

Step 3: Create a campaign​

POST

Create a new campaign in pending status.

Select campaignType: 1 for an "Advanced" campaign.

Use the ioId in the response from the IO you created in Step 2.

The minimum required values for creating a campaign are as listed below. See the Create new campaign documentation for the complete request schema.

info

Make sure that the budgetTypeId of your campaign matches the ioBudgetTypeId of your IO.

Request schema
campaignName
string
Campaign name.
isAgreementChecked
boolean
Check to proceed: true.
ioId
string
IO ID that campaign belongs to.
countryId
string
Country ID.
advertiserDomain
string
Advertiser domain.
creativeType
integer
Creative type ID.
Supported values
0All
11Image
13HTML
14Video
15Native
17Audio
campaignType
integer
Campaign type ID.
Supported values
1Advanced campaign
2PG campaign
startTime
integer
Unix epoch start time of the campaign, in seconds. The IO in Step 2 uses milliseconds; the campaign uses seconds.
endTime
integer
Unix epoch end time of the campaign, in seconds (required if total budget pacing is enabled).
totalBudgetPacing
boolean
Budget is spent equally every hour: true.
budgetDay
integer
Daily budget for campaign serving daily (not applicable if budget pacing is set to true). Use at least 100 if you plan to add a bid model.
budgetTotal
integer
Total budget for campaign serving period.
budgetTypeId
integer
Budget type ID.
Supported values
1Budget
2Impression
maxBid
integer
Max bid for each bid request.
timezone
integer
Timezone ID for campaign.
creativeIds
string
Comma-separated IDs of your creatives.
exchanges
string
Comma-separated exchange IDs for targeting (leave string empty to select all).
publisherAdCategory
string
Comma-separated publisher ad category IDs for targeting (leave string empty to select all).

Response properties
statusCode
integer
HTTP status code: 201.
responseObject
object
Response object.
responseObject object properties
data
integer
Campaign ID.
message
string
Success message.
status
string
Campaign status: pending.
Request Sample
{
"campaignName": "NewTest",
"maxBid": 100,
"budgetTotal": 1000,
"startTime": 1803859200,
"endTime": 1806451200,
"timezone": 29,
"budgetDay": 100,
"creativeType": 11,
"isAgreementChecked":true,
"ioId": 29316,
"countryId": "30100001",
"creativeIds": "803406",
"advertiserDomain": "https://iqm.com",
"totalBudgetPacing": false,
"publisherAdCategory":"",
"exchanges": "",
"budgetTypeId": 1,
"campaignType": 1
}
Response 201
{
"statusCode": 201,
"responseObject": {
"data": 625980,
"message": "Campaign saved successfully.",
"status": "pending"
}
}

Step 4: Check campaign status​

GET

To run a campaign, it must be approved. Use the campaign ID returned in the data field in Step 3 to check the created campaign's status and other details.

Path parameters
campaignId
integer
Campaign ID
Response 200
{
"statusCode": 200,
"responseObject": {
"owId": 204851,
"parentOrganizationName": "Example Workspace",
"id": 625980,
"uowId": 291477,
"campaignName": "NewTest",
"advertiserDomain": "https://iqm.com",
"creativeType": 11,
"campaignType": 1,
"totalBudgetPacing": false,
"isTvAd": false,
"budgetDay": 100.0,
"budgetTotal": 1000.0,
"maxBid": 100.0,
"minBid": 0.0,
"allowedMinBid": 0.0,
"timezone": 29,
"startTime": 1803859200,
"endTime": 1806451200,
"status": "pending",
"dspMargin": 0,
"platformMargin": 0,
"userDealMargin": 0,
"spentScale": false,
"creativeIds": "803406",
"conversionType": "None",
"bidOptimization": false,
"bidPacing": false,
"isBidShading": true,
"impressionCapping": 0,
"frequencyCapEnabled": false,
"exchanges": "",
"isLocationWithOrFilter": true,
"countryId": "30100001",
"locationDetails": {},
"isCampaignFromNewPlatform": true,
"organizationName": "Example Organization",
"userEmail": "user@example.com",
"userName": "Jane Smith",
"isUnapprovedAudienceTargeted": false,
"isAllAudienceUnapproved": false,
"createDate": 1793041077,
"ioId": 29316,
"ioName": "IO Name 1",
"prebidAudienceSegmentIdList": [],
"campaignTypeId": 1,
"budgetTypeId": 1,
"isEstimatorAvailable": true,
"isAdvanceAudioVideoTargeted": false,
"isEditAccess": true,
"isParentInvoiceTemplateSet": true,
"isMarginSet": true,
"isApprovalAccess": false
}
}
Have a question?
Was this page helpful?