Upload Creative and Create a Campaign
IQM’s REST API enables you to interact with most of our platform's applications.
The following endpoints will be used to upload a Creative, create an insertion order, create a PG deal, and start a Campaign:
/api/v3/ua/login/api/v3/master/creativeTypes
/api/v2/crt/add/image/banner/creative
/api/v3/crt/basic/list
/api/v3/cmp/io/add
/api/v3/master/creativeTypes
/api/v3/cmp/pg/campaigns/add
/api/v3/cmp/pg/campaigns/add
/api/v2/cmp/campaign/{campaignId}
About IQM Campaign & Creative
The IQM APIs provide access to create Insertion Orders, PG Deals, Campaigns and upload Creative in Image, Video, Audio, HTML, XLSX, or CSV formats. The APIs can be used to connect to the desired applications.
Once an Insertion Order and PG Deal are created, an uploaded and processed Creative can be used for creating and running advertising Campaigns.
Before You Begin
To upload a Creative and create a Campaign, the following are required:
- An Account On the IQM Platform
- See Before You Begin section to create an account and request a Client ID and Client Secret
- Image, Video, Audio, HTML, VAST, DAAST, CSV, or XLSX File to Upload Creative
File requirements for Creative file:
- 2MB for JPG, JPEG, PNG
- 750KB for GIF
- 400MB for MOV, MP4
- 100MB for MP3, WAV, OGG, MPEG
For more information on VAST and DAAST XML format specifications, please see iab Tech Lab's Documentation.
Sample CSV file: https://app.iqm.com/creatives/example-files/sample_html_creatives.csv
Upload Creative and Create a Campaign Using the IQM API
This quickstart will cover how to create a Campaign and upload a Creative.
The minimum requirements to perform this task are: logging in with authentication credentials, uploading a Creative, and creating a Campaign. Once these steps are accomplished, more can be learned about IQM's API through the Guidelines pages.
- Log In
- Optional if you have already logged in and have a token
- Upload Creative
- 2.1: Request Creative Types (Optional if you already know supported/desired types)
- 2.2: Upload Creative (Optional if already uploaded before)
- 2.3: Check Creative status
- Create Insertion Order
- Optional if already created
- Create PG Deal
- 4.1: Request Exchange List
- 4.2: Create PG Deal
- Create a Campaign
- 5.1 Create a Campaign using Creative, provide necessary targeting parameters
- 5.2 Check Campaign's status
Step 1: Log in
POST /api/v3/ua/loginTo log in, the Authentication: Basic header is required. The Login API returns an OAuth-compliant response with an Organization Workspace ID (owId), a unique identifier for each organization. This ID will be used for any further API communications.
For further information see the complete Login API Documentation.
Headers | |
---|---|
Authentication string required | Authentication bearer token See Authentication Guide |
X-IAA-HOST string required | Workspace URL |
Request Schema | |
---|---|
grantType string required | OAuth Grant Types |
email string required | User account email |
password string required | User account password |
- JSON
- TypeScript
{
"grantType": "password",
"email": "pratik.t+ihp@iqm.com",
"password": "123456"
}
{
"success": true,
"data":
{
"access_token": "106adb25-37b0-4cab-8381-d682fe7cc3c8",
"refresh_token": "eac4c1f6-781e-4b04-baff-9c2e415d1f64",
"scope": "read write",
"token_type": "bearer",
"expires_in": 35999,
"owId": 200001
}
}
More Response Samples
{
"success": false,
"data":
{
"status": "On Hold",
"reason": "The particular account is kept on hold due to missed payment dates for last 3 months.",
"supportEmail": "support@iqm.com"
},
"errorObjects":
[
{
"error": "User is not allowed to access provided customer",
"reason": "User is not associated with any active organization."
}
]
}
{
"success": false,
"errorObjects":
[
{
"error": "User doesn't exist or user is not allowed to provided workspace."
}
]
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
content: {
"application/json": {
success: boolean;
data: {
access_token: string;
refresh_token: string;
scope: string;
token_type: string;
expires_in: number;
owId: number;
};
};
};
};
400: {
content: {
"application/json": {
success: boolean;
data: {
status: string;
reason: string;
supportEmail: string;
};
errorObjects: {
error: string;
reason: string;
}[];
};
};
};
403: {
content: {
"application/json": {
success: boolean;
errorObjects: {
error: string;
}[];
};
};
};
};
function Login(): Promise < Responses > {
const options = {
method: 'POST',
url: 'https://app.iqm.com/api/v3/ua/login',
requestBody: {
content: {
"application/json": {
email: `string`,
password: `string`,
}
}
}
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}
Step 2: Upload Creative
Step 2.1 Request Creative Types
GET /api/v3/master/creativeTypesTo upload a Creative, a Creative Type must be provided. Use the Creative Type list endpoint to request a full list of allowed Creative Types.
For further information see the complete Creative Types API Documentation.
Headers | |
---|---|
Authentication string required | Authentication Bearer Token See Authentication Guide |
X-IAA-OW-ID integer required | Organization Workspace ID Header |
- JSON
- TypeScript
{
"success": true,
"data": {
"data": [
{
"id": 17,
"name": "Audio",
"rtbTypeId": 2
},
{
"id": 15,
"name": "Native",
"rtbTypeId": 4
},
{
"id": 14,
"name": "Video",
"rtbTypeId": 3
},
{
"id": 13,
"name": "HTML",
"rtbTypeId": 1
},
{
"id": 11,
"name": "Image",
"rtbTypeId": 1
}
],
"totalRecords": 5,
"filteredRecords": 5
}
}
More Response Samples
{
"statusCode": 500,
"responseObject": {
"errorMsg": "Internal server error",
"errorCode": 500
}
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
success: boolean;
data: {
id: number;
label: string;
rtbTypeId: string;
}[];
totalRecords: number;
filteredRecords: number;
}
};
};
};
function getCreativeTypes_1(): Promise < Responses > {
const options = {
method: 'GET',
url: 'https://app.iqm.com/api/v3/master/creativeTypes',
params: {
query?: {
creativeTypeIds?: `string`,
ids?: `string`,
pageNo?: `number`,
noOfEntries?: `number`,
sortBy?: `string`,
order?: `string`,
searchField?: `string`
}
}
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}
Step 2.2 Upload Creative
POST /api/v3/crt/creativesWhen uploading a Creative, a file and Creative parameters (like tracking pixel and click URL) can be provided.
Please refer to MDN Documentation on form data format.
For further information see the complete API Documentation:
Headers | |
---|---|
Authentication string required | Authentication bearer token See Authentication Guide |
X-IAA-OW-ID integer required | Organization Worskpace ID Header |
content-type string required | Media type of the resource |
Query Parameters | |
---|---|
creativeRequest string | This parameter accepts a Map of UUIDs to Creative details. Each UUID corresponds to a single Creative. The metadata includes information such as Creative name, external Creative ID, Creative type, and click URL. Additionally, the Creative files are sent as multipart form data |
creativeFiles array of strings | Array of Creative files uploaded as multipart files. These files will be used for creating the Creatives. Each file is processed according to its type (image, video, etc.) |
- JSON
- TypeScript
------WebKitFormBoundaryyTwoz48E2hTuXZoX
Content-Disposition: form-data; name="dspId"
------WebKitFormBoundaryyTwoz48E2hTuXZoX
Content-Disposition: form-data; name="advertiserId"
------WebKitFormBoundaryyTwoz48E2hTuXZoX
Content-Disposition: form-data; name="creativeImageMetadata"
{"8a9ab848-b302-40a6-bea1-17f7aca6f362":{"originalFileName":"Screenshot 2023-12-28 at 2.51.28 PM.png","creativeName":"Creative","clickUrl":"https://iqm.com","width":408,"height":364}}
------WebKitFormBoundaryyTwoz48E2hTuXZoX
Content-Disposition: form-data; name="creativeFiles"; filename="8a9ab848-b302-40a6-bea1-17f7aca6f362.png"
Content-Type: image/png
PNG
IHDRlñ8¯Z
±iCCPICC ProfileHTéÿôÐNèM"@J-té *! J)ØÅ\
*" ¬èRDÁFµcÁ¢ØûYDÔu±`Cå
p»ûÎ{ï¼{Îû;÷¿÷þsæs²[(ÌÈHDþÞ´¸øn g±9b!#<< 2mÿ.îhÂÞ´Èõï÷ÿ«¨pybP8ÂÉ\1'
ác¾çEPõßhD8Á=«Mpê¿àäIFã'c¢"ë'±Ù¢THæËIEò¶pùóöÈÊÊæ"Ü°9#Dx"?=ù/yRÿ3YÍNóÔ^&ïÃ
3Ùùÿçãøß)®a()MX¤/è^FvÉ¡aÓÌçNÆOr4 z9bfÂ4sÙ>Aòµ¡ÁÓÂ÷cÉóHXQÓÌûFN³(;B^+EÄdL3[4SW-÷§ñXòüiQ±ÓË fqFdÐLSîI#äýóþÞ3uýä{Ïÿe¿||$-*@¾wöLÿ<c&§8NÞçã;-J¼åµáòx^¦¿Ü/ί /äÌÚpù3LgO3 \ÀÙ|+B Ø _ÂËLl-ÌñSÓ$4rÒx4c3fokïÀĹz-ÞQ'Ï#D½2ã[Û{Çøøøñ_àu'@lñ/@yK'8RQî=qÁ _%ä ô0ÖÀ87à|A Q ,²,ËÀjPJÀf°Tj°Ôàh'ÀYp\×ÁmðÈÀ x FÀ0A"CHÒL +È¢C/E@ñP
)´Z
@¥P´jCÐYè2ÔÝú¡aè-ôFÁ$X
Ö�Má90fÀAp¼N�sà¸ÞÃ5ð¸>
_�oÃ2ø%<(e²FÑQLT*¡V Qe¨TªÕº¡^¡>£±h
¶F»¡ÐÑh:½½]®G·¢Ï£o¢ûÑ#èï2Fc�qÅ°0qTÌL¦SiÁ\ÀÜÆb>`±X*Öë
ÀÆcÓ±K±°»°ÍØ3Ø>ìvÃiâ¬pî¸0'ÁávâàNãnàqð
x}¼=Þà×àËðûñ§ð7ðCø12ÁàJ#p ùM}NÂ5 a¨B4#º£éÄÕÄrbñññ¡Â|¾Â*�r�C
ú>TI$&)$%m$ÕÎîÞÉdS²9,!o$7Ï?)RmY\Å7_+LJ
Ê*]Sz¥LP6Uf*³W(W*w(ßUU¡¨Ø©©d©lPÙ¯rYå¹*NÕTÕW«Z¨ºWõêE1¢0)ÊZÊ>ÊÊ VÍL¥®V¢vPWmD]U}®zzz¥úIuE5¥²¨ÔMÔ#Ô;Ô/³tg1fñfÕ4ëƬÚ^<bfÛ_4i¾[4Û4k¡µ,µæk-ÑÚuA붶6G»XûöXÇR'Bg©Î^Q]=]]¡îNÝsº¯ô¨z^zézÛôNé
ëSô=ôùúÛôOë¿ ©Ó´LZ9í<mÄ@Ç À@j°Ç ×`ÌÐÌ0Úpa³ác#¢Ý(ÅhQѱ¾qñ2ãFã&ºIÉn¦f¦±¦ëLÛLi±Ì
ÌÍÍ=ÍsÌkÌoY`-è»,®[Âi׬`+'+¾Õ.«¾ÙÙ.³³kfßµ&Y3¬sûm¨6Á6klÚl^Ï10gËî9ßmm3m÷Ù>´Sµ
´[c×i÷ÖÞÒc_iËìàç°Ò¡ÝáÍ\«¹¼¹»çÞs¤88®sìrüæäì$rjrv6vNr®r¾KW£Ó7Ð/¹`\¼]Vºpùìêä*q=âú§µ[Û~·çóÌæñæí7ànèÎvßã.ó y$yüì!ó4ðd{Öx>õ2òâzÕz
1,é×Þ¶Þ"ïïLWæræ¿O±O¯¯ªo´o�ï?C¿T¿F¿Gÿ¥þg0A[î²tYVk$Ð9pyàù RPdPEÐÓ`Ë`Qpg²5äQ¨I¨ ´-±Â¶=7
Ï ?>;?|~åügvË"º#)#÷G~òÚõ0Ú<ZÝ£Óó1Ö'¶4V7'nyÜÕxx~|{.!&¡6atïí
ï,4[·ðò"EN.VZÌ^|4 ´?é+;]ÃMf%W%p\/î6î0ÏWÊJqO)Myêº5u8Í3,íɯà¿IH¯NÿQ1Ù�ÏJÊê¨
2ç³õ²ó²ûVÂ"¡,Ç5g{Î(HT+Ä
Åí5d@êKöçzäVæ~Z³ähJ ¯'ß2}þP_Á/KÑK9K»,[½¬9cùÐä]+V®\忪~5quÆê_×Ø®)]ó~mìÚÎBÝÂU�?øÿÐX¤X$*º»Îm]õèù?ö®wX¿sý÷bnñÛ²¯8®üd÷SùOãS6önrÚ´{3v³`ó-[êKUJ
J¶lmÝFÛV¼íýöÅÛ/Í-«ÞAÜ!Ý!+.oßi¼sóίi·+½+«tªÖW}ÜÅÝuc·×î¦jÝêê/?ó¾·ÇOkiMÙ^ìÞܽÏöÅìëþ�þKCVmIí·:A¬>¢þ|sCÃ~ýáFiãðÄ×úlo²nÚÓLm.9IShow more
{
"success": true,
"data": {
"successData": {
"PS": "701388"
},
"failedData": {
"PF": "Creative file missing. Please attach the required file. : null"
}
}
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
success: boolean;
data: {
successData: {
PS: string;
};
failedData: {
PF: string;
}
}
};
};
};
}
function createCreatives(): Promise<Responses> {
const options = {
method: 'POST',
url: 'https://app.iqm.com/api/v3/crt/creatives',
params: {
query: {
creativeRequest: `string`,
creativeFiles?: `array of strings`
}
}
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}
Step 2.3 Check the Creative Status
GET /api/v3/crt/creatives/{creativeId}To create a Campaign, the Creative must be processed and approved. This API checks a Creative's status. Use the creativeId (6 digit number under data parameter in response) retrieved from the previous step to get its details.
The Creative details endpoint returns a Status ID (highlighted in code sample). A status ID of 2 means the Creative is running, which is the necessary status to continue creating a Campaign. See the Get Creative Status List endpoint documentation for more information.
Headers | |
---|---|
Authentication string required | Authentication bearer token See Authentication Guide |
X-IAA-OW-ID integer required | Organization Worskpace ID Header |
Path Parameter | |
---|---|
creativeId array of integers | Creative ID |
- JSON
- TypeScript
{
"success": true,
"data": {
"creativeId": 686855,
"creativeName": "300x600-w23-01",
"rtbCreativeTypeId": 1,
"platformCreativeTypeId": 11,
"creativeStatusId": 2,
"creativeSource": "https://d3jme5si7t6llb.cloudfront.net/image/202760/efk0sUk_1730201855013.jpg",
"creativeCardSource": "https://d3jme5si7t6llb.cloudfront.net/Screenshots/202760/278x220/efk0sUk_1730201855013.jpg",
"clickUrl": "http://iqm.com",
"imageDetails": {
"pixelUrl": "http://pixel.com",
"creativeWidth": 300,
"creativeHeight": 600
},
"creativeSourceType": "file",
"creativePreviewFlag": 1,
"createdAt": 1730201855165,
"modifiedAt": "2024-10-29T06:10:15.000+00:00",
"userDetails": {
"uowId": 175891,
"userName": "Hardik",
"userEmail": "hardik.v+iqmsuper@iqm.com",
"hasApprovalAccess": true,
"hasEditAccess": true
},
"organizationDetails": {
"owId": 202760,
"organizationName": "AdWing"
}
}
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
success: boolean;
data: {
creativeId: number;
creativeName: string;
rtbCreativeTypeId: number;
platformCreativeTypeId: number;
creativeStatusId: number;
creativeSource: string;
creativeCardSource: string;
clickUrl: string;
imageDetails: {
pixelUrl: string;
creativeWidth: number;
creativeHeight: number;
};
creativeSourceType: string;
creativePreviewFlag: number;
createdAt: number;
modifiedAt: number;
userDetails: {
uowId: number;
userName: string;
userEmail: string;
hasApprovalAccess: boolean;
hasEditAccess: boolean;
};
organizationDetails: {
owId: number;
organizationName: string
}
}
};
};
};
}
function getCreative(): Promise<Responses> {
const options = {
method: 'GET',
url: 'https://app.iqm.com/api/v3/crt/creatives/{creativeId}',
params: {
path: {
creativeId: `number`
}
}
};
Step 3: Create Insertion Order
POST /api/v3/cmp/io/addBefore 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 Insertion Order. Read more about Insertion Orders.
The minimum required values for IO creation are as listed below. See a complete table of Resource Properties for all supported values.
Request Schema | |
---|---|
ioName string | Insertion Order name |
ioStartTime integer | Unix epoch timestamp (in milliseconds) of IO start time |
ioEndTime integer | Unix epoch timestamp (in milliseconds) of IO end time |
ioTotalBudget integer | IO budget |
ioStatusID integer | Status ID |
ioTimeZoneId integer | IO timezone ID |
isAutoSumIoTotalBudget boolean | If true Keeps IO budget same as total budget of all included campaigns |
ioBudgetTypeId integer | IO Budget Type ID |
ioBudgetDistributionMethodId integer | Budget distribution method ID |
- JSON
- TypeScript
{
"ioName": "IO Name 1",
"ioStartTime": 1690898148000,
"ioEndTime": 1690898888000,
"ioTotalBudget": 1000,
"ioTimeZoneId": 29,
"isAutoSumIoTotalBudget": true,
"ioBudgetTypeId": 1,
"ioBudgetDistributionMethodId": 1
}
{
"success": true,
"data": {
"ioId": 123456,
"ioName": "IO Name 1",
"ioStartTime": 1690898148000,
"ioEndTime": 1690898888000,
"ioTotalBudget": 0,
"ioTimeZoneId": 29,
"ioBudgetTypeId": 1,
"ioBudgetDistributionMethodId": 1,
"isAutoSumIoTotalBudget": true,
"ioTotalImpressions": null
}
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
success: boolean;
data: {
ioId: number;
ioName: string;
ioStartTime: number;
ioEndTime: number;
ioTotalBudget: number;
ioTimeZoneId: number;
ioBudgetTypeId: number;
ioBudgetDistributionMethodId: number;
isAutoSumIoTotalBudget: boolean;
ioTotalImpressions: number
}
}
};
};
};
function createCampaignIO(): Promise<Responses> {
const options = {
method: 'POST',
url: 'https://app.iqm.com/api/v3/cmp/io/add',
requestBody: {
content: {
"application/json": {
ioId?: `number`,
ioName: `string`,
owId?: `number`,
createdByUowId?: `number`,
modifiedByUowId?: `number`,
ioStartTime?: `number`,
ioEndTime?: `number`,
ioTotalBudget?: `number`,
ioTimeZoneId?: `number`,
isAutoSumIoTotalBudget?: `boolean`,
ioBudgetDistributionMethodId?: `number`,
ioBudgetTypeId?: `number`,
ioTotalImpressions?: `number`,
ioStatusId?: `number`,
ioNextPerformanceCheck?: `number`,
ioLastPriorityShift?: `number`,
ioCurrentPriority?: `number`,
isIoPrioritise?: `boolean`,
}
}
}
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}
Step 4: Create PG Deal
Before a Campaign can be created, a Programmatic Guarantee (PG) Deal must be created first. A PG Deal is a direct negotiation between one publisher and one advertiser with a fixed amount of ad Inventory at a pre-negotiated price. Read more about PG Deals.
Step 4.1 Request Exchange List
GET /api/v3/master/exchangesTo create a PG Deal, an exchange must be provided. Use the master exchange endpoint to get a list of available exchanges.
Headers | |
---|---|
Authentication string required | Authentication bearer token See Authentication Guide |
X-IAA-OW-ID integer required | Organization Worskpace ID Header |
- JSON
- TypeScript
{
"success": true,
"data": {
"data": [
{
"id": 90,
"name": "Aniview",
"urlName": "aniview"
},
{
"id": 89,
"name": "LoopMe",
"urlName": "loopme"
},
{
"id": 88,
"name": "One Tag",
"urlName": "onetag"
},
{
"id": 87,
"name": "Share Through",
"urlName": "sharethrough"
},
{
"id": 84,
"name": "Vidazoo",
"urlName": "vidazoo"
},
{
"id": 80,
"name": "Equativ",
"urlName": "equativ"
},
{
"id": 78,
"name": "Magnite",
"urlName": "magnite"
},
{
"id": 77,
"name": "Verve",
"urlName": "verve"
},
{
"id": 76,
"name": "Infolink",
"urlName": "infolink"
},
{
"id": 75,
"name": "Beachfront",
"urlName": "beachfront"
},
{
"id": 74,
"name": "Teads",
"urlName": "teads"
},
{
"id": 73,
"name": "Outbrain",
"urlName": "outbrain"
},
{
"id": 72,
"name": "Telaria",
"urlName": "telaria"
},
{
"id": 71,
"name": "33 Across",
"urlName": "ttacross"
},
{
"id": 69,
"name": "Media.net",
"urlName": "mnet"
},
{
"id": 66,
"name": "Unruly",
"urlName": "unruly"
},
{
"id": 47,
"name": "Index Exchange",
"urlName": "indexch"
},
{
"id": 46,
"name": "Triton Digital",
"urlName": "tdigital"
},
{
"id": 45,
"name": "Publisher Direct",
"urlName": "pbd"
},
{
"id": 41,
"name": "Column6",
"urlName": "adigital"
},
{
"id": 39,
"name": "Google DoubleClick",
"urlName": "adx"
},
{
"id": 37,
"name": "SpotXchange",
"urlName": "spotx"
},
{
"id": 19,
"name": "OpenX",
"urlName": "openx"
},
{
"id": 16,
"name": "Pubmatic",
"urlName": "pubmatic"
},
{
"id": 11,
"name": "Smaato",
"urlName": "smaato"
},
{
"id": 1,
"name": "iQM",
"urlName": "test"
}
],
"totalRecords": 26,
"filteredRecords": 26
}
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
success: boolean;
data: {
data: {
id: number;
name: string;
urlName: string;
}[];
totalRecords: number;
filteredRecords: number;
}
}
};
};
};
function getExchanges(): Promise < Responses > {
const options = {
method: 'GET',
url: 'https://app.iqm.com/api/v3/master/exchanges',
params: {
query?: {
exchangeIds?: `string`,
ids?: `string`,
pageNo?: `number`,
noOfEntries?: `number`,
sortBy?: `string`,
order?: `string`,
searchField?: `string`,
}
}
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}
Step 4.2 Create PG Deal
POST /api/v3/inv/pg/deals/addOnce an exchange is selected, use the exchangeId from the response to create a PG deal.
Properties | |
---|---|
dealId string | PG Deal ID |
dealName string | PG Deal name |
exchangeId integer | Exchange ID associated with PG Deal |
cpm integer | Cost Per Mille (CPM) value |
statusId integer | Status ID of PG Deal Active: 1> Inactive: 2 |
description string | Description or notes about the deal |
paymentTypeId integer | Payment type ID of PG Deal |
- JSON
{
"dealId": "YT-Test-1234",
"dealName": "Test deal YT31",
"exchangeId": 11,
"statusId": 2,
"paymentTypeId": 1,
"description": "Test Deal"
}
{
"success": true,
"data": {
"message": "Deal Test deal YT31 created successfully",
"id": 2
}
}
Step 5: Create a Campaign
Step 5.1 Create Campaign
POST /api/v3/cmp/pg/campaigns/addOnce a Creative is approved, an Insertion Order is created, and a PG deal is created, a Campaign can be created. Use the following schema to define the desired targeting parameters of the new Campaign. Use the creativeTypeId identified in step 2.1, the creativeId from the response in step 2.3, and the ioId from step 3, and the pgDealId returned (id) in step 4.2 to create the campaign.
Make sure that budgetTypeId of Campaign matches ioBudgetTypeId from step 3.
For further information see the complete Campaign Creation API Documentation.
Headers | |
---|---|
Authentication string required | Authentication bearer token See Authentication Guide |
X-IAA-OW-ID integer required | Organization Worskpace ID Header |
Request Schema | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pgCampaignInfo object | Object containing Campaign information | |||||||||||||||||||||||
|
campaignName string | Name of Campaign |
ioId integer | Insertion Order ID |
timeZoneId integer | Timezone ID, see Master API |
totalImpressions integer optional | Targeted impressions for impression-based Campaign as budget, use if not a dollars-based Campaign |
budgetTotal integer optional | Total budget of the Campaign for dollars-based Campaign, use if not an impressions-based Campaign |
maxBid integer | Maximum allowed bid price for Campaign |
startTime integer | Unix epoch start time of Campaign, in milliseconds |
endTime integer | Unix epoch end time of Campaign, in milliseconds |
budgetTypeId integer | Budget Type ID of given Campaign (impression-based or dollar-based) |
campaignTypeId integer | Campaign Type ID |
advertiserDomain string | Domain of the advertiser user |
creativeTargeting
object
creativeTargeting
object properties
creativeTypeId integer | Creative type ID, see Master API |
creativeIds array of integers | IDs of Creatives attached to this Campaign |
inventoryTargeting
object
inventoryTargeting
object properties
pgDealIds array of integers | PG Deal IDs attached to this Campaign |
conversionTargeting
object
conversionTargeting
object properties
conversionTypeId integer | Conversion type ID attached to this Campaign |
conversionIds array of integers | IDs of Conversions attached to this Campaign |
politicalAdvertiserClientId
integer
countryId
integer
- JSON
- TypeScript
{
"pgCampaignInfo": {
"campaignName": "test imps PG campaign",
"ioId": 95179,
"timeZoneId": 29,
"totalImpressions": 12345,
"maxBid": 8,
"startTime": 1715662337,
"endTime": 1717128000,
"budgetTypeId": 2,
"campaignTypeId": 2,
"advertiserDomain": "https://www.xyz.com"
},
"creativeTargeting": {
"creativeTypeId": 11,
"creativeIds": [
644506
]
},
"inventoryTargeting": {
"pgDealIds": [
30,
12
]
},
"conversionTargeting": {
"conversionTypeId": 1,
"conversionIds": [
465,
687,
987
]
},
"politicalAdvertiserClientId": 989898,
"countryId": 23
}
{
"success": true,
"data": {
"message": "PG Campaign Created successfully",
"campaignId": 2
}
}
More Response Samples
{
"success": false,
"errorObjects": [
{
"error": "Invalid campaign Type provided"
}
]
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
content: {
"application/json": {
success: boolean;
data: {
message: string;
campaignId: number
}
}
};
};
422: {
content: {
"application/json": {
success: boolean;
errorObjects: {
error: string
}
}
};
};
}
function addPGCampaign(): Promise<Responses> {
const options = {
method: 'POST',
url: 'https://app.iqm.com/api/v3/cmp/pg/campaigns/add',
requestBody: {
content: {
"application/json": {
countryId?: `number`,
politicalAdvertiserClientId?: `number`,
conversionTargeting?: {
conversionTypeId?: `number`,
conversionIds: `array of numbers`,
},
creativeTargeting: {
creativeTypeId: `number`,
creativeIds: `array of numbers`,
},
inventoryTargeting: {
pgDealIds: `array of numbers`,
paymentTypeId?: `number`,
},
pgCampaignInfo: {
campaignName: `string`,
timeZoneId: `number`,
spendingBudget?: `number`,
maxBid: `number`,
startTime: `number`,
endTime?: `number`,
totalImpressions?: `number`,
advertiserDomain: `string`,
ioId: `number`,
budgetTypeId: `number`,
campaignTypeId?: `number`,
owId?: `number`,
uowId?: `number`,
creativeTypeId?: `number`,
status?: `string`,
configObj?: `string`,
totalBudget?: `number`,
pgFeesPercentage?: `number`,
}
}
}
}
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}
Step 5.2: Check Campaign Status
GET /api/v2/cmp/campaign/{campaignId}To run a Campaign, it must be approved. Use the campaignId returned from the last step to check the created Campaign's status.
For further information see the complete Campaign Details API Documentation.
Path Parameter | |
---|---|
campaign_id string required | Campaign ID |
Headers | |
---|---|
Authentication string required | Authentication Bearer Token See Authentication Guide |
X-IAA-OW-ID integer required | Organization Workspace ID Header |
- JSON
- TypeScript
{
"statusCode": 200,
"responseObject": {
"owId": 1,
"parentOrganizationName": "IQM Corporation",
"id": 25859,
"uowId": 9216,
"campaignName": "Test Campaign",
"advertiserDomain": "https://iqm.com",
"creativeType": 11,
"campaignType": 1,
"totalBudgetPacing": false,
"isTvAd": false,
"budgetDay": 10.0,
"budgetTotal": 100.0,
"maxBid": 10.0,
"timezone": 433,
"startTime": 1703794800,
"endTime": 1704614400,
"status": "pending",
"dspMargin": 0,
"platformMargin": 0,
"userDealMargin": 0,
"spentScale": false,
"creativeIds": "148971",
"conversionType": "None",
"bidOptimization": true,
"bidPacing": true,
"impressionCapping": 0,
"maxDayImpressions": 0,
"maxDayClicks": 0,
"maxDayConversions": 0,
"totalImpressions": 0,
"totalClicks": 0,
"totalConversions": 0,
"deviceType": "13,15,11,12",
"trafficType": "11,12",
"exchanges": "55,61,58,41,39,47,59,1,54,56,45,16,11,37,57,50,46,53,60",
"isLocationWithOrFilter": true,
"countryId": "30100001",
"locationDetails": {},
"isCampaignFromNewPlatform": true,
"organizationName": "IQM Corporation 1",
"userEmail": "domo@iqm.com",
"userName": "Domo Integration",
"conversionTypeId": 0,
"isUnapprovedAudienceTargeted": false,
"isAllAudienceUnapproved": false,
"createDate": 1703794110,
"ioId": 2695,
"ioName": "Sanity test Io",
"prebidAudienceSegmentIdList": [],
"budgetTypeId": 1,
"isAdvanceAudioVideoTargeted": false,
"isEstimatorAvailable": true,
"isEditAccess": true,
"isApprovalAccess": false,
"isMarginSet": true,
"isParentInvoiceTemplateSet": true
}
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
content: {
"application/json": {
statusCode: number;
responseObject: {
owId: number;
parentOrganizationName: string;
id: number;
uowId: number;
campaignName: string;
advertiserDomain: string;
creativeType: number;
campaignType: number;
totalBudgetPacing: boolean;
isTvAd: boolean;
budgetDay: number;
budgetTotal: number;
maxBid: number;
timezone: number;
startTime: number;
endTime: number;
status: string;
dspMargin: number;
platformMargin: number;
userDealMargin: number;
spentScale: boolean;
creativeIds: string;
spent: number;
conversionType: string;
bidOptimization: boolean;
bidPacing: boolean;
impressionCapping: number;
deviceType: string;
trafficType: string;
exchanges: string;
countryId: string;
locationDetails: Record<string, never>;
isCampaignFromNewPlatform: boolean;
organizationName: string;
userName: string;
isEditAccess: boolean;
isApprovalAccess: boolean;
isMarginSet: boolean;
isParentInvoiceTemplateSet: boolean;
isUnapprovedAudienceTargeted: boolean;
isAllAudienceUnapproved: boolean;
};
};
};
};
};
function Getcampaigndetails(): Promise < Responses > {
const options = {
method: 'GET',
url: 'https://app.iqm.com/api/v2/cmp/campaign/{campaign_id}',
params: {
path: {
campaign_id: `number`
},
query: {
isSpentRequired: `boolean`
}
},
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}