Skip to main content

Optimize your inventory

Optimize your inventory with this in-depth tutorial using IQM's Inventory API.

The following endpoints are used to search inventory, assign campaign targeting, and create an inventory group:

POST
GET
POST
POST
POST
GET

About IQM inventory​

IQM's advanced algorithm determines the most relevant ads to display to a user based on their activity and the content of a given page. Inventories provide you a way to organize collections or groups based on criteria such as ad format, placement type, targeting options, and other properties.

More resources​

Before you begin​

To search and manage inventory, 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. A campaign

Optimize your inventory using the IQM API​

This tutorial covers how to create and manage inventory groups and target inventory with campaigns.

The minimum requirements to perform this task are: logging in with authentication credentials, selecting inventory, assigning it to a campaign, and creating an inventory group. 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. Search inventory
    • Optional if you already have pre-selected inventory to use
  3. Create an inventory group
    • Optional if you already have an existing inventory group to use, skip to next step
  4. Update an inventory group
  5. Target campaigns with an inventory group
  6. Get inventory group campaign details

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 <base64 of 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: Search inventory list​


GET

Using a number of query fields, you can search the inventory database. Try passing IAB22-4 as a categories query string. You should see results similar to the response sample code block on the right.

Query parameters
keywords
string
Keywords to search inventory list.
countries
string
Filter by country.
categories
string
Filter by category.
inventoryTypes
string
Filter by inventory type.
creativeSizes
string
Filter by creative size.
creativeTypes
string
Filter by creative type.
creativeDurations
string
Filter by creative duration.
trafficTypes
string
Filter by traffic type.
Supported values
11App
14CTV
13OTT
12Web
deviceTypes
string
Filter by device type.
exchanges
string
Filter by exchange.
videoPlayerSizes
string
Filter by video player size.
noOfEntries
integer
Number of entries returned per page.
pageNo
integer
Page number of retrieved data.
groupId
integer
Group ID.

Response properties
inventoryDataList
array of objects
Inventories matching the query.
inventoryDataList object properties
id
integer
Inventory ID.
name
string
Inventory name.
appId
string
The bundle ID (for app request) or domain (for web request).
inventoryType
string
Inventory type.
impressions
integer
Impressions count.
reach
integer
The number of unique individuals reached by an inventory, does not count repeat views.
videoPercentage
number
Percentage of total ad impressions that are video-based.
displayPercentage
number
Percentage of total ad impressions that are display-based.
ctv
boolean
Indicates if the inventory is CTV inventory.
inventoryLogoUrl
string
Inventory logo URL. Returned only when a logo is available.
Response 200
{
"success": true,
"data": {
"inventoryDataList": [
{
"id": 33317,
"name": "Text Free: Free Text Plus Call",
"appId": "com.pinger.textfree",
"inventoryType": "Android App",
"impressions": 1281921,
"reach": 17982,
"videoPercentage": 59.935909,
"displayPercentage": 36.034748,
"ctv": false
},
{
"id": 12266326,
"name": "Car Sales Simulator 2023",
"appId": "6464597212",
"inventoryType": "IOS App",
"impressions": 304045,
"reach": 3570,
"videoPercentage": 5.598513,
"displayPercentage": 94.401487,
"ctv": false
}
]
}
}

Step 3: Create an inventory group​


POST

[If you have an existing inventory group and you want to update it, skip to Step 4]

The IQM API also allows you to create custom groupings of inventories with several methods. In this example, take the inventory ids from your own Step 2 response (inventory IDs differ between accounts) and pass them in the inventoryIds array, along with a groupName and groupTypeId to create a new group.

To review all the methods, see Create a new inventory group.

Request schema
groupName
string
Desired name for group.
groupTypeId
integer
Group type. Supported values:
Open Exchange: 1
PMP: 2
Contextual: 3
CTV: 4.
inventoryIds
array of integers
Inventory IDs to include in group.
Response properties
id
integer
Inventory group ID.
name
string
Inventory group name.
groupTypeId
integer
Inventory group type ID.
created
integer
Unix epoch creation date, in seconds.
modifiedDate
string
Last modified date and time, as an ISO 8601 string in UTC.
owId
integer
Organization Workspace ID.
impressions
integer
Impressions count.
reach
integer
The number of unique individuals reached by an inventory group, does not count repeat views.
uniques
integer
Total number of unique impressions of the inventories in a group.
count
integer
Number of inventories (or deals, for PMP groups) in the group.
inventories
integer
Inventories count.
publishers
integer
Publishers count.
deals
integer
Deals count.
contextualInventories
integer
Contextual inventories count.
isAccountLevelExcluded
boolean
Indicates that account-level excluded group is included.
isShared
boolean
Indicates the inventory group is shared from the Workspace: true.
sharedCount
integer
Number of workspaces or advertisers the group is shared with.
dealIdModelled
boolean
Indicates if the group is modelled on deal IDs.
campaignWhitelistCount
integer
Number of campaigns that include this inventory group.
campaignBlacklistCount
integer
Number of campaigns that exclude this inventory group.
whiteListedCampaignIds
array of integers
IDs of campaigns that include this inventory group (create response only).
blackListedCampaignIds
array of integers
IDs of campaigns that exclude this inventory group (create response only).
distribution
object
Distribution of the group's impressions by country and other dimensions. The dimensions returned depend on the group type.
distribution object properties
countries
array of objects
Share of impressions by country.
deviceTypes
array of objects
Share of impressions by device type (Open Exchange groups).
trafficTypes
array of objects
Share of impressions by traffic type (Open Exchange groups).
creativeTypes
array of objects
Share of impressions by creative type.
streamingDevices
array of objects
Share of impressions by streaming device (CTV groups).
Distribution item object properties
label
string
Name of the country, device type, traffic type, creative type, or streaming device.
value
number
Percentage of the group's impressions.
Request sample
{
"groupName": "Inventory Group - Open exchange",
"groupTypeId": 1,
"inventoryIds": [
33317,
12266326
]
}
Response 200
{
"success": true,
"data": {
"id": 222533,
"name": "Inventory Group - Open exchange",
"groupTypeId": 1,
"created": 1793036631,
"modifiedDate": "2026-10-26T17:43:51.260Z",
"owId": 204851,
"impressions": 4240410,
"reach": 58495,
"uniques": 0,
"count": 2,
"inventories": 0,
"publishers": 0,
"deals": 0,
"contextualInventories": 0,
"isAccountLevelExcluded": false,
"isShared": false,
"sharedCount": 0,
"dealIdModelled": false,
"campaignWhitelistCount": 0,
"campaignBlacklistCount": 0,
"whiteListedCampaignIds": [],
"blackListedCampaignIds": [],
"distribution": {
"countries": [
{
"label": "United States",
"value": 99.47
},
{
"label": "Canada",
"value": 0.41
}
],
"deviceTypes": [
{
"label": "Mobile",
"value": 95.42
},
{
"label": "Tablet",
"value": 4.23
}
],
"trafficTypes": [
{
"label": "App",
"value": 100.0
}
],
"creativeTypes": [
{
"label": "Video",
"value": 63.01
},
{
"label": "Banner",
"value": 26.26
}
]
}
}
}

Step 4: Update an inventory group​


POST
POST

Add or remove inventories (Open Exchange, Private Deals, Contextual) to a group or multiple groups.

Inventories can be added/removed by filtering for results, inputting dealIds, contextual details, or inventoryIds.

Add/remove by inventory ID
Request schema
groupIds
array of integers
Group IDs to add mappings to (addMappings only).
groupId
integer
Group ID to remove mappings from (removeMappings only).
groupTypeId
integer required
Group type. Supported values:
Open Exchange: 1
PMP: 2
Contextual: 3
CTV: 4.
inventoryIds
array of integers
Inventory IDs to add/remove to/from group.

Response properties

addMappings returns data as an array with one object per updated group. removeMappings returns data as a single object for the updated group. Both objects have the properties below.

id
integer
Inventory group ID.
name
string
Inventory group name.
groupTypeId
integer
Inventory group type ID.
created
integer
Unix epoch creation date, in seconds.
modifiedDate
string
Last modified date and time, as an ISO 8601 string in UTC.
owId
integer
Organization Workspace ID.
impressions
integer
Impressions count.
reach
integer
The number of unique individuals reached by an inventory group, does not count repeat views.
uniques
integer
Total number of unique impressions of the inventories in a group.
count
integer
Number of inventories (or deals, for PMP groups) in the group.
inventories
integer
Inventories count.
publishers
integer
Publishers count.
deals
integer
Deals count.
contextualInventories
integer
Contextual inventories count.
isAccountLevelExcluded
boolean
Indicates that account-level excluded group is included.
isShared
boolean
Indicates the inventory group is shared from the Workspace: true.
sharedCount
integer
Number of workspaces or advertisers the group is shared with.
dealIdModelled
boolean
Indicates if the group is modelled on deal IDs.
campaignWhitelistCount
integer
Number of campaigns that include this inventory group.
campaignBlacklistCount
integer
Number of campaigns that exclude this inventory group.
distribution
object
Distribution of the group's impressions by country and other dimensions. The dimensions returned depend on the group type.
distribution object properties
countries
array of objects
Share of impressions by country.
deviceTypes
array of objects
Share of impressions by device type (Open Exchange groups).
trafficTypes
array of objects
Share of impressions by traffic type (Open Exchange groups).
creativeTypes
array of objects
Share of impressions by creative type.
streamingDevices
array of objects
Share of impressions by streaming device (CTV groups).
Distribution item object properties
label
string
Name of the country, device type, traffic type, creative type, or streaming device.
value
number
Percentage of the group's impressions.
Request sample: addMappings
{
"groupIds": [
222533
],
"groupTypeId": 1,
"inventoryIds": [
33012
]
}
Request sample: removeMappings
{
"groupId": 222533,
"groupTypeId": 1,
"inventoryIds": [
33012
]
}
Response 200: addMappings
{
"success": true,
"data": [
{
"id": 222533,
"name": "Inventory Group - Open exchange",
"groupTypeId": 1,
"created": 1793036631,
"modifiedDate": "2026-10-26T17:43:51.260Z",
"owId": 204851,
"impressions": 4845188,
"reach": 65917,
"uniques": 0,
"count": 3,
"inventories": 0,
"publishers": 0,
"deals": 0,
"contextualInventories": 0,
"isAccountLevelExcluded": false,
"isShared": false,
"sharedCount": 0,
"dealIdModelled": false,
"campaignWhitelistCount": 0,
"campaignBlacklistCount": 0,
"distribution": {
"countries": [
{
"label": "United States",
"value": 99.47
},
{
"label": "Canada",
"value": 0.41
}
],
"deviceTypes": [
{
"label": "Mobile",
"value": 95.42
},
{
"label": "Tablet",
"value": 4.23
}
],
"trafficTypes": [
{
"label": "App",
"value": 100.0
}
],
"creativeTypes": [
{
"label": "Video",
"value": 63.01
},
{
"label": "Banner",
"value": 26.26
}
]
}
}
]
}
Response 200: removeMappings
{
"success": true,
"data": {
"id": 222533,
"name": "Inventory Group - Open exchange",
"groupTypeId": 1,
"created": 1793036631,
"modifiedDate": "2026-10-26T17:43:51.260Z",
"owId": 204851,
"impressions": 3634283,
"reach": 50674,
"uniques": 0,
"count": 2,
"inventories": 0,
"publishers": 0,
"deals": 0,
"contextualInventories": 0,
"isAccountLevelExcluded": false,
"isShared": false,
"sharedCount": 0,
"dealIdModelled": false,
"campaignWhitelistCount": 0,
"campaignBlacklistCount": 0,
"distribution": {
"countries": [
{
"label": "United States",
"value": 99.47
},
{
"label": "Canada",
"value": 0.41
}
],
"deviceTypes": [
{
"label": "Mobile",
"value": 95.42
},
{
"label": "Tablet",
"value": 4.23
}
],
"trafficTypes": [
{
"label": "App",
"value": 100.0
}
],
"creativeTypes": [
{
"label": "Video",
"value": 63.01
},
{
"label": "Banner",
"value": 26.26
}
]
}
}
}

Step 5: Target campaigns with an inventory group​

POST

Once an inventory group has been created, you can attach it to a campaign for targeting. Pass the inventory group ID in the groupIds array and the desired campaign ID in the includedCampaignIds field.

Each request replaces the group's list of included campaigns. To keep campaigns that already target the group, send their IDs again with the new ones.

Request schema
groupIds
array of integers required
Inventory group IDs.
includedCampaignIds
string required
Comma-separated campaign IDs to include targeting. This replaces the group's current list. Send an empty string if there are none.
excludedCampaignIds
string required
Comma-separated campaign IDs to exclude targeting. Send an empty string if there are none.
Request sample
{
"groupIds": [
222533
],
"includedCampaignIds": "625977",
"excludedCampaignIds": ""
}
Response 200
{
"success": true,
"data": {
"message": "Changes have been saved successfully"
}
}
Response 400
{
"success": false,
"errorObjects": [
{
"error": "Excluded campaign id is required",
"field": "excludedCampaignIds"
}
]
}

Step 6: Get list of campaigns by group​

GET

Once you have attached an inventory group ID to a campaign for targeting you can check that inventory groupId with this endpoint. You should see the campaignId in the response. Despite shared in the path, this endpoint works for any inventory group, shared or not.

Path parameter
groupId
integer
Inventory group ID.
Response properties
data
array of integers
List of campaign IDs.
Response 200
{
"success": true,
"data": [
625977
]
}
Have a question?
Was this page helpful?