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

ErrorExampleCauseFix
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": 0Query 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 maxCommissionId from each call as sinceCommissionId in 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 amount values 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. sinceEventDate but not beforeEventDate), 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 situations field 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

FieldTypeDescription
commissionItemIdString!The unique ID of this item record.
discountAdvCurrencyDecimalNumberItem discount in the advertiser's currency.
discountPubCurrencyDecimalNumberItem discount in the publisher's currency.
discountUsdDecimalNumberItem discount in USD.
itemListIdStringUnique ID of the item list which applies to this item record.
perItemSaleAmountAdvCurrencyDecimalNumber!Per item sale amount in the advertiser's currency.
perItemSaleAmountPubCurrencyDecimalNumber!Per item sale amount in the publisher's currency.
perItemSaleAmountUsdDecimalNumber!Per item sale amount in USD.
quantityInt!Item quantity.
situationDetails[Situation!]!Indicates if situations were defined in the commissioning structure.
situations[String!]!Deprecated. Use situationDetails.
skuString!Advertiser's unique identifier for the item.
totalCommissionAdvCurrencyDecimalNumber!Total commission for the specified quantity in advertiser's currency.
totalCommissionPubCurrencyDecimalNumber!Total commission for the specified quantity in publisher's currency.
totalCommissionUsdDecimalNumber!Total commission for the specified quantity in USD.

Situation

FieldTypeDescription
idString!Situation ID from CJ.
nameString!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

ValueDescription
IMMEDIATEActions will be locked as soon as they are posted or otherwise determined by CJ.
FIXED_DATEActions will be locked after the 10th of the month.
OPEN_ENDEDActions will be locked by advertisers.
FIXED_DURATIONActions 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.

ValueDescription
PENDINGPending validation to release payment.
ACCEPTEDAdvertiser has validated that an order value is correct and may be locked.
DECLINEDAdvertiser has validated that an order has been fully corrected.
AUTOMATEDOrder is not using open-ended locking method.

Scalars

ActionStatus

Possible values: closed, extended, locked, new.

ValueDescription
newAll recent transactions begin in this status. Remain new until corrected, extended, or locked.
extendedTransaction has been extended to the next payment cycle (one-time only). Remains extended until corrected or locked.
lockedTransactions lock at 2am PST on the 11th of each month. Once locked, they cannot be corrected or extended.
closedTransaction has been prepared for payment.

ActionType

Possible values: bonus, click, imp, item_lead, item_sale, perf_inc, sim_lead, sim_sale.

ValueDescription
sim_saleSimple Sale — traditional sale without item-level detail.
sim_leadSimple Lead — lead-based transaction without item-level detail.
item_saleItem Sale — traditional sale with item-level details (quantity, SKU, etc.).
item_leadItem Lead — lead-based transaction with item-level details.
impImpression — used if an advertiser tracks/pays on impression.
clickClick — used if an advertiser tracks/pays on click.
perf_incPerformance Incentive — paid out when certain program thresholds are met.
bonusBonus — used when an advertiser needs to bonus a publisher a one-time amount.

Other Scalars

NameDescription
BooleanRepresents true or false.
DecimalNumberA 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.
InstantA datetime in UTC ISO 8601 format with Z as the zone designator, rendered as a string.
IntNon-fractional signed whole numeric values. Range: -(2^31) to 2^31 - 1.
StringTextual data represented as UTF-8 character sequences.