Skip to main content

Create a PG campaign

Create a Programmatic Guaranteed (PG) campaign with this in-depth tutorial using IQM's API.

The following endpoints are used to create a PG campaign:

POST
POST
GET

About IQM PG campaigns​

IQM's PG campaigns define the individual marketing strategies of your ads with an inventory purchased directly from a specific publisher. By specifying the supported parameters you can use the API to create a new PG campaign.

More resources​

Before you begin​

To create a PG 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 approved and running creative
  3. An insertion order
  4. A conversion
  5. A PG deal

Create a PG campaign using the IQM API​

This tutorial covers 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.

  1. Log in
    • Optional if you have already logged in and have a token
  2. Create a PG campaign
    • 2.1 Create a PG campaign, provide necessary targeting parameters
    • 2.2 Check campaign's status

Authentication​

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

Headers
Authentication
string required
Authentication bearer token
See Sign up and authenticate
X-IAA-OW-ID
integer required
Organization Workspace ID Header

Step 1: Log in​

POST

To 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 is used for any further API communications.

For further information see OAuth token.

Headers
Authentication
string required
Authentication bearer token
See Sign up and authenticate
Request schema
grant_type
string required
password for login
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
{
"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 responses
Response 400
{
"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."
}
]
}
Response 403
{
"success": false,
"errorObjects":
[
{
"error": "User doesn't exist or user is not allowed to provided workspace."
}
]
}

Step 2: Create a PG campaign​

Step 2.1: Create campaign​

POST

Once you are logged in and have met the prerequisite conditions (see Before you begin), you can create a PG campaign. You need a creative, an insertion order, a conversion, and a PG deal to create a PG campaign. Review the request schema table below for all the other parameters required for this endpoint.

info

Make sure that the budgetTypeId of your PG campaign matches the ioBudgetTypeId of your insertion order.

Request schema
pgCampaignInfo
object
Object containing campaign information
pgCampaignInfo object properties
campaignName
string
Name of campaign
ioId
integer
Insertion Order ID
timeZoneId
integer
Timezone ID
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)
Supported values
1Budget
2Impression
campaignTypeId
integer
Campaign type ID
Supported values
1Advanced campaign
2PG campaign
advertiserDomain
string
Domain of the Advertiser user
creativeTargeting
object
Object containing creative targeting details
creativeTargeting object properties
creativeTypeId
integer
Creative type ID
Supported values
0All
11Image
13HTML
14Video
15Native
17Audio
creativeIds
array of integers
IDs of creatives attached to this campaign
inventoryTargeting
object
Object containing inventory targeting details
inventoryTargeting object properties
pgDealIds
array of integers
PG deal IDs attached to this campaign
conversionTargeting
object
Object containing campaign conversion targeting details
conversionTargeting object properties
conversionTypeId
integer
Conversion type ID attached to this campaign.
Supported values
1Pixel
2Postback
3Universal Pixel
conversionIds
array of integers
IDs of conversions attached to this campaign
politicalAdvertiserClientId
integer
Advertiser client ID if user is Political Advertiser
countryId
integer
ID of targeted country
Request sample
{
"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
}
Response 200
{
"success": true,
"data": {
"message": "PG Campaign Created successfully",
"campaignId": 2
}
}
More responses
Response 422
{
"success": false,
"errorObjects": [
{
"error": "Invalid campaign Type provided"
}
]
}

Step 2.2: Check campaign status​

GET

To run a campaign, it must be approved. Use the campaignId returned from the last step to check the created campaign's status.

Path parameter
campaignId
string required
Campaign ID
Response 200
{
"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": "running",
"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
}
}
Have a question?
Was this page helpful?