Program Terms API

Program Term API Reference

Endpoint: https://programs.api.cj.com/query

The Program Terms API is a GraphQL API available to publishers to access all Program Term commission rates for Pending, Active, and Expired Program Terms. This API is useful for publishers who need to access commission rates for their existing or previous advertiser relationships. The Program Terms API includes all available commission rates in a Program Term, including Situations, Item Lists, and Promotional Properties commission rates.

This API does not include contract information for advertisers where the publisher does not have a relationship. Advertiser details like name, program URL, EPC, and others can be found in CJ's Advertiser Lookup API. The Advertiser Lookup API also includes some commission rate information, but does not include Situations or Promotional Properties commission rates, so it is recommended to use the Program Terms API to access commission rate information.


Sample Query and Response

Sample Query

{
  publisher {
    contracts(
      publisherId: "1234",
      limit: 1,
      filters: { advertiserId: "5678" }
    ) {
      totalCount
      count
      resultList {
        startTime
        endTime
        status
        advertiserId
        programTerms {
          id
          name
          specialTerms {
            name
            body
          }
          isDefault
          actionTerms {
            id
            actionTracker {
              id
              name
              description
              type
            }
            referralPeriod
            referralOccurrences
            lockingMethod {
              type
              durationInDays
            }
            performanceIncentives {
              threshold {
                type
                value
              }
              reward {
                type
                commissionType
                value
              }
              currency
            }
            commissions {
              rank
              situation {
                id
                name
              }
              itemList {
                id
                name
              }
              promotionalProperties {
                id
                name
              }
              isViewThrough
              rate {
                type
                value
                currency
              }
            }
          }
        }
      }
    }
  }
}

Sample curl Request

curl 'https://programs.api.cj.com/query' \
  -H 'Authorization: Bearer <your-personal-access-token>' \
  -H 'Content-Type: application/json' \
  -d '{"query":"{ publisher { contracts(publisherId: \"1234\", limit: 1, filters: {advertiserId: \"5678\"}) { totalCount count resultList { startTime endTime status advertiserId programTerms { id name specialTerms { name body } isDefault actionTerms { id actionTracker { id name description type } referralPeriod referralOccurrences lockingMethod { type durationInDays } performanceIncentives { threshold { type value } reward { type commissionType value } currency } commissions { rank situation { id name } itemList { id name } promotionalProperties { id name } isViewThrough rate { type value currency } } } } } } } }","variables":null}'

Sample Response

{
  "data": {
    "publisher": {
      "contracts": {
        "totalCount": 48,
        "count": 1,
        "resultList": [
          {
            "startTime": "2020-04-28T16:08:55Z",
            "endTime": null,
            "status": "ACTIVE",
            "advertiserId": "5678",
            "programTerms": {
              "id": "266444",
              "name": "Program Terms with PID",
              "specialTerms": {
                "name": null,
                "body": null
              },
              "isDefault": false,
              "actionTerms": [
                {
                  "id": "723158",
                  "actionTracker": {
                    "id": "347167",
                    "name": "action tracker name",
                    "description": null,
                    "type": "item_sale"
                  },
                  "referralPeriod": 45,
                  "referralOccurrences": null,
                  "lockingMethod": {
                    "type": "FIXED_DURATION",
                    "durationInDays": 60
                  },
                  "performanceIncentives": [
                    {
                      "threshold": {
                        "type": "TOTAL_SALES_AMOUNT",
                        "value": 100000
                      },
                      "reward": {
                        "type": "INCREASE_COMMISSION_TO",
                        "value": 2
                      },
                      "currency": "USD"
                    }
                  ],
                  "commissions": [
                    {
                      "rank": 0,
                      "situation": null,
                      "itemList": null,
                      "promotionalProperties": [],
                      "isViewThrough": false,
                      "rate": {
                        "type": "PERCENT",
                        "value": 1,
                        "currency": null
                      }
                    },
                    {
                      "rank": 1,
                      "situation": null,
                      "itemList": {
                        "id": "54",
                        "name": "item list 1"
                      },
                      "promotionalProperties": [],
                      "isViewThrough": false,
                      "rate": {
                        "type": "FIXED",
                        "value": 2,
                        "currency": "USD"
                      }
                    },
                    {
                      "rank": 3,
                      "situation": {
                        "id": "58094",
                        "name": "loyaltyearned is greater than or equal to 100"
                      },
                      "itemList": {
                        "id": "54",
                        "name": "item list 1"
                      },
                      "promotionalProperties": [],
                      "isViewThrough": false,
                      "rate": {
                        "type": "FIXED_PER_ORDER",
                        "value": 4,
                        "currency": "USD"
                      }
                    },
                    {
                      "rank": 5,
                      "situation": null,
                      "itemList": null,
                      "promotionalProperties": [
                        { "id": "8067264", "name": "PID 1" },
                        { "id": "100125586", "name": "PID 2" }
                      ],
                      "isViewThrough": false,
                      "rate": {
                        "type": "PERCENT",
                        "value": 5,
                        "currency": null
                      }
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    }
  }
}

Pagination

The API returns up to 10 records by default. There is a limit of 100 records returned per request. To retrieve more, use the offset and limit arguments across multiple requests.

Example — paging through data 50 records at a time:

  1. First request: (offset: 0, limit: 50)
  2. Subsequent request: (offset: 50, limit: 50)
  3. Continue incrementing offset by limit until all records are retrieved.

Errors

Authentication / Authorization Errors

  • Ensure you are including a valid Personal Access Token in the Authorization header.
  • Ensure you have included the correct publisherId argument and that your token has permission to query on behalf of that company.

Enums

ActionTrackerType

Action Tracker type.

ValueDescription
item_saleItem Sale action tracker
item_leadItem Lead action tracker
sim_leadSimple Lead action tracker
sim_saleSimple Sale action tracker
clickClick action tracker
impImpression action tracker

CommissionRateType

Commission type.

ValueDescription
FIXED_PER_ORDERFixed per order commission
FIXEDFixed per item commission
PERCENTPercent commission

ContractStatus

Status of a contract.

ValueDescription
PENDING_REVERSIONPending reversion contract
PENDING_OFFERPending publisher accept contract
CANCELLEDCancelled contract
EXPIREDExpired contract
ACTIVEActive contract

LockingMethodType

Determines how actions will be locked.

ValueDescription
FIXED_DURATIONActions will be locked the specified number of days after event date
OPEN_ENDEDActions will be locked by advertisers
FIXED_DATEActions will be locked after the 10th of the month
IMMEDIATEActions will be locked as soon as they are posted or otherwise determined by CJ

PerformanceIncentiveRewardCommissionType

Type of commission associated to the performance incentive.

ValueDescription
FIXEDWhen adjusted commission is expressed as a fixed amount, either increase to or bonus
PERCENTWhen adjusted commission is expressed as a percent

PerformanceIncentiveRewardType

Type of reward associated to the performance incentive.

ValueDescription
ONE_TIME_BONUSOne time bonus applied on top of existing commission
INCREASE_COMMISSION_TONew value of commission after applying performance incentive

PerformanceIncentiveThresholdType

Type of threshold associated to the performance incentive.

ValueDescription
TOTAL_SALES_AMOUNTThreshold is based on amount of sales in given currency
TOTAL_COMMISSIONSThreshold is based on amount of commission in given currency
NUMBER_OF_ACTIONSThreshold is based on number of actions

Scalars

NameDescription
BigDecimalSigned fractional values with arbitrary precision.
BooleanRepresents true or false.
IDUnique identifier, often used to refetch an object or as a cache key. Appears as a String in JSON; accepts string or integer input.
ISODateTimeISO 8601 datetime. e.g. 1999-12-31T23:59:59Z
IntNon-fractional signed whole numeric values. Range: -(2^31) to 2^31 - 1.
LongNon-fractional signed whole numeric values. Range: -(2^63) to 2^63 - 1.
StringTextual data represented as UTF-8 character sequences.