Commission Detail API
Overview
Endpoint: https://commissions.api.cj.com/query
The Commission Detail API is a GraphQL API available to both advertisers and publishers to access near real-time commission data from their accounts. This is useful for anyone who wants the freshest commission data available, or for anyone who needs commission data updated on a regular basis. A variety of search criteria are supported, including posting date range, ad IDs, action statuses, and more.
Sample Requests and Responses
Publisher Request
curl -H "Authorization: Bearer <your-personal-access-token>" \
-XPOST https://commissions.api.cj.com/query \
-d '{
publisherCommissions(
forPublishers: ["999"],
sincePostingDate: "2018-08-08T00:00:00Z",
beforePostingDate: "2018-08-09T00:00:00Z"
) {
count
payloadComplete
records {
actionTrackerName
websiteName
advertiserName
postingDate
pubCommissionAmountUsd
items {
quantity
perItemSaleAmountPubCurrency
totalCommissionPubCurrency
}
}
}
}'Publisher Response
{
"data": {
"publisherCommissions": {
"count": 2,
"payloadComplete": true,
"records": [
{
"actionTrackerName": "Advanced Sale Test",
"websiteName": "Donuts and Denim",
"advertiserName": "Visit Canada",
"commissionId": "2292067663",
"postingDate": "2018-05-03T22:31:48Z",
"pubCommissionAmountUsd": "7.781",
"items": [
{
"quantity": 1,
"perItemSaleAmountPubCurrency": "75.474",
"totalCommissionPubCurrency": "7.548"
}
]
},
{
"actionTrackerName": "Advanced Sale Test",
"websiteName": "Donuts and Denim",
"advertiserName": "Visit Canada",
"commissionId": "2292491812",
"postingDate": "2018-05-04T19:00:21Z",
"pubCommissionAmountUsd": "3.89",
"items": [
{
"quantity": 1,
"perItemSaleAmountPubCurrency": "37.737",
"totalCommissionPubCurrency": "3.773"
}
]
}
]
}
}
}Advertiser Request
curl -H "Authorization: Bearer <your-personal-access-token>" \
-XPOST https://commissions.api.cj.com/query \
-d '{
advertiserCommissions(
forAdvertisers: ["11223344"],
sincePostingDate: "2018-08-08T00:00:00Z",
beforePostingDate: "2018-08-09T00:00:00Z"
) {
count
payloadComplete
records {
actionTrackerName
websiteName
advertiserName
postingDate
pubCommissionAmountUsd
items {
quantity
perItemSaleAmountPubCurrency
totalCommissionPubCurrency
}
}
}
}'Advertiser Response
{
"data": {
"advertiserCommissions": {
"count": 2,
"payloadComplete": true,
"records": [
{
"actionTrackerName": "Purchase",
"websiteName": "Site Demo",
"advertiserName": "CJ Affiliate",
"postingDate": "2018-08-08T14:26:42Z",
"pubCommissionAmountUsd": "0",
"items": [
{
"quantity": -1,
"perItemSaleAmountPubCurrency": "100",
"totalCommissionPubCurrency": "0"
}
]
},
{
"actionTrackerName": "Purchase",
"websiteName": "Site Demo",
"advertiserName": "CJ Affiliate",
"postingDate": "2018-08-08T14:27:14Z",
"pubCommissionAmountUsd": "0",
"items": [
{
"quantity": 0,
"perItemSaleAmountPubCurrency": "12",
"totalCommissionPubCurrency": "0"
}
]
}
]
}
}
}Encoding / Compression
Compression is not available at this time.
Errors
| Error | Example | Cause | Fix |
|---|---|---|---|
| Parse error | "Cannot query field 'g' on type 'PublisherCommissions'. (line 5, column 9)" | An invalid or misspelled field was included in the query. | Correct the query field name. |
| Invalid auth token | "message": "Invalid auth token." | The provided auth token or dev key is not valid. | Use a correct auth token. |
| No data | "count": 0 | Query arguments match no data. The auth token may not correspond to the CIDs in forPublishers or forAdvertisers, or other arguments need checking. | Check your arguments, especially the auth token and forPublishers/forAdvertisers values. |
Pagination
This API uses cursor-based paging.
If the value of payloadComplete is false, there is more data to retrieve. Read the value of maxCommissionId to get the current cursor position. In your next query call, set sinceCommissionId to this value. Repeat until payloadComplete is true.
API Usage Caps and Limits
- Date range: No more than 31 days per query.
- Payload size: No more than 10,000 commissions per call. Use
maxCommissionIdfrom each call assinceCommissionIdin subsequent calls to retrieve all data. - Concurrent connections: Maximum 120. If all connections are busy, your query will fail — try again later.
- Call limit: 200 calls per 5 minutes.
Corrections
To identify whether a transaction was the original or a correction, request the original field in the body of your query. It returns true for an original transaction and false for a non-original (corrected) transaction. Both the original and corrected records share the same orderId but have different commissionId values.
Original and corrected records are delta records — combine their values to get the final order amounts:
- Simple sale: Combine the
amountvalues from both records. - Advanced sale (item-level): Combine quantities by item from both records, then multiply the final quantity by the per-item amount and commission fields.
Example of a fully corrected/cancelled order:
{ "original": true, "pubCommissionAmountUsd": "1.852", "saleAmountUsd": "61.742", "orderId": "69461063" }
{ "original": false, "pubCommissionAmountUsd": "-1.852", "saleAmountUsd": "-61.742", "orderId": "69461063" }Best Practices
- Implied date range defaults: If you specify only one bound of a date range (e.g.
sinceEventDatebut notbeforeEventDate), the corresponding bound defaults to 24 hours from the specified bound. If no arguments are specified, data from the past 24 hours by posting date is returned. - Optimize field selection: Some fields take longer to resolve than others — for example, the
situationsfield at both the parent and item levels. Omit fields you do not need to improve query performance.
Shared Objects
Item
A record of an item purchased as part of a commissionable event. Used in both AdvertiserCommission and PublisherCommission.
Computed fields: situations
| Field | Type | Description |
|---|---|---|
commissionItemId | String! | The unique ID of this item record. |
discountAdvCurrency | DecimalNumber | Item discount in the advertiser's currency. |
discountPubCurrency | DecimalNumber | Item discount in the publisher's currency. |
discountUsd | DecimalNumber | Item discount in USD. |
itemListId | String | Unique ID of the item list which applies to this item record. |
perItemSaleAmountAdvCurrency | DecimalNumber! | Per item sale amount in the advertiser's currency. |
perItemSaleAmountPubCurrency | DecimalNumber! | Per item sale amount in the publisher's currency. |
perItemSaleAmountUsd | DecimalNumber! | Per item sale amount in USD. |
quantity | Int! | Item quantity. |
situationDetails | [Situation!]! | Indicates if situations were defined in the commissioning structure. |
situations | [String!]! | Deprecated. Use situationDetails. |
sku | String! | Advertiser's unique identifier for the item. |
totalCommissionAdvCurrency | DecimalNumber! | Total commission for the specified quantity in advertiser's currency. |
totalCommissionPubCurrency | DecimalNumber! | Total commission for the specified quantity in publisher's currency. |
totalCommissionUsd | DecimalNumber! | Total commission for the specified quantity in USD. |
Situation
| Field | Type | Description |
|---|---|---|
id | String! | Situation ID from CJ. |
name | String! | Situation name. |
Enums
CorrectionReason
List of reasons for correcting a transaction.
| Value |
|---|
INVALID_CREDIT_CARD |
RETURNED_MERCHANDISE |
DUPLICATED_ORDER |
CANT_SHIP_OR_SOLD_OUT |
UNQUALIFIED_LEAD |
QUALIFIED_LEAD |
OTHER_REASON |
LockingMethod
| Value | Description |
|---|---|
IMMEDIATE | Actions will be locked as soon as they are posted or otherwise determined by CJ. |
FIXED_DATE | Actions will be locked after the 10th of the month. |
OPEN_ENDED | Actions will be locked by advertisers. |
FIXED_DURATION | Actions will be locked a given number of days after the event date. |
ValidationStatus
Indicates whether an order is pending validation or has been validated by the advertiser.
| Value | Description |
|---|---|
PENDING | Pending validation to release payment. |
ACCEPTED | Advertiser has validated that an order value is correct and may be locked. |
DECLINED | Advertiser has validated that an order has been fully corrected. |
AUTOMATED | Order is not using open-ended locking method. |
Scalars
ActionStatus
Possible values: closed, extended, locked, new.
| Value | Description |
|---|---|
new | All recent transactions begin in this status. Remain new until corrected, extended, or locked. |
extended | Transaction has been extended to the next payment cycle (one-time only). Remains extended until corrected or locked. |
locked | Transactions lock at 2am PST on the 11th of each month. Once locked, they cannot be corrected or extended. |
closed | Transaction has been prepared for payment. |
ActionType
Possible values: bonus, click, imp, item_lead, item_sale, perf_inc, sim_lead, sim_sale.
| Value | Description |
|---|---|
sim_sale | Simple Sale — traditional sale without item-level detail. |
sim_lead | Simple Lead — lead-based transaction without item-level detail. |
item_sale | Item Sale — traditional sale with item-level details (quantity, SKU, etc.). |
item_lead | Item Lead — lead-based transaction with item-level details. |
imp | Impression — used if an advertiser tracks/pays on impression. |
click | Click — used if an advertiser tracks/pays on click. |
perf_inc | Performance Incentive — paid out when certain program thresholds are met. |
bonus | Bonus — used when an advertiser needs to bonus a publisher a one-time amount. |
Other Scalars
| Name | Description |
|---|---|
Boolean | Represents true or false. |
DecimalNumber | A numerical value rendered in JSON as a string. Matches the pattern (-)?[0-9]+(\.[0-9]+)?. Allows a greater range of expression than GraphQL's default Float type. |
Instant | A datetime in UTC ISO 8601 format with Z as the zone designator, rendered as a string. |
Int | Non-fractional signed whole numeric values. Range: -(2^31) to 2^31 - 1. |
String | Textual data represented as UTF-8 character sequences. |
Updated 9 days ago
