API for affiliate

To get started with the API, you should get an ID and a key. They are available in the Profile section. Hereinafter, the user ID will be denoted as {user} and the access key as {key}. Important! You don't need to include curly braces in the query string!

Interaction with the service is carried out via the HTTP protocol. The request format is pure POST. The result format is JSON. There is no limit on the number of requests. If you need to send a request via JSON POST, do not forget to include the header Content-type: application/json

01 Add new lead

URL https://api.cpa.moe/ext/add.json?id={user}-{key}

The function allows you to add a new lead as the affiliate. New lead data is transmitted in a POST request.

The function accepts the following primary data about the lead:

FieldDescription
id*Unique order ID on your side (required)
If you dont have such ID you should set auto in this field
wmAgency affiliate or source ID
offer*Offer ID (required)
nameCustomer name
phone*Customer phone, digits only (required)
emailCustomer email
ip*Customer IP-address (required)
uaCustomer's browser User-Agent
countryTwo-letter ISO code of customer's country

Additional parameters for lead creation:

FieldDescription
usUTM tag utm_source
ucUTM tag utm_campaign
unUTM tag utm_content
utUTM tag utm_term
umUTM tag utm_medium
currencyThree-letter currency ISO code, like USD or EUR
indexZIP code
addrDelivery address. Can contain full address without the ZIP code, or only house and apartment numbers if the fields below are used.
areaDelivery region.
cityDelivery city.
streetDelivery street.
baseUnit price in order currency.
countQuantity of goods.
discountDiscount on goods as a percentage.
moreThe amount of the extra cost of the order, for example, margins for express delivery.
commOrder comment.
itemThe ID of the nested good to be added to the order. If there are several products, it is listed separated by commas.
itemsAn array of nested goods to add to the order, indicating their price. Each product must be represented by an associative array with fields:
  • id - nested good ID
  • price - unit price
  • count - quantity of goods
paramsKey-value array of custom fields.

Example of a simple lead creation request (shown in JSON for convenience):

{
    "id": 112358,
    "wm": 42,
    "offer": 217,
    "ip": "12.34.56.78",
    "name": "John Doe",
    "phone": "77000000000",
    "country": "kz",
}

Example of creating a lead specifying the array of nested goods (shown in JSON for convenience):

{
    "id": 112358,
    "wm": 42,
    "offer": 217,
    "ip": "12.34.56.78",
    "name": "Jane Doe",
    "phone": "79000000000",
    "country": "ru",
    "items": [
        {
            "id": 135,
            "price": 9900,
            "count": 1
        }
    ]
}

Example of a simple lead creation with custom fields (shown in JSON for convenience):

{
    "id": 112358,
    "wm": 42,
    "offer": 217,
    "ip": "12.34.56.78",
    "name": "John",
    "phone": "77000000000",
    "country": "kz",
    "params": {
        "sirname": "Doe",
        "phonecc": "+7"		
    }
}

The result of the function is an associative array:

FieldDescription
statusThe result of the operation: ok if successful, error in case of an error
uidThe order ID is on your side. Make sure to keep this value if you use id=auto when submitting leads. The status check is carried out using this identifier!
idID of the created order (if successful)
errorError code: nooffer if no offer ID present, noid if no lead ID present, nophone if no phone present, duplicate if the order with same info had already been created, offer if offer was not found, security if user is banned, ban if customer IP or phone is banned, traffic if offer is blocked, db in case of internal error.

Function response example:

{ "status": "ok", "id": 1234, "uid": 123456 }

02 Check lead status

URL https://api.cpa.moe/ext/list.json?id={user}-{key}&ids=1,2,3

Function shows the information about order processing status. List of order IDs must be sent via ids parameter containing comma separated list of order IDs on your side. Better don't send more that 50 IDs in one request.

The result of the function is an array of leads. Key parameter is the order ID on the agency side. Each item includes the following fields:

FieldDescription
idYour order ID
srcYour affiliate or source ID
uidOur internal order ID
stageOrder status code:
  • wait - processing order
  • hold - order in hold stage
  • approve - order is approved
  • cancel - order is cancelled by generic reason
  • trash - order is cancelled as trash
statusExtended order status ID:
  • 1 – New order
  • 2 – Processing
  • 3 – Callback
  • 4 – Hold
  • 5 – Cancelled
  • 6 – Packing
  • 7 – Sending
  • 8 – Transfer
  • 9 – Arrived
  • 10 – Completed
  • 11 – Return
  • 12 – Deleted
reasonCancel reason ID for status code 5:
  • 1 – Incorrect phone (trash)
  • 2 – Changed his mind
  • 3 – Did not order (trash)
  • 4 – Requires certificate
  • 5 – Wrong GEO (trash)
  • 6 – Errors or fakes (trash)
  • 7 – Duplicate order (trash)
  • 8 – Ordered elsewhere (trash)
  • 9 – Expensive
  • 10 – Not satisfied with delivery
  • 11 – Could not get through (trash)
  • 12 – Possibly fraud (trash)
  • 13 – Speaks different language (trash)
  • 14 – Product did not fit (trash)
  • 15 – Offer disabled
countAmount of order goods
commentOrder text comment (if applicable)

Function response example:

[
 1234 : {
  "id": 1234, // Order ID on the agency side
  "uid": 432, // Order ID on our side
  "status": 5, // Status code
  "stage": "cancel", // Stage code
  "reason": 2, // Reason code
  "comment: "Purr-purr-purr", // Order comment
 },
 2345 : {
  "id": 2345, // Order ID on the agency side
  "uid": 543, // Order ID on our side
  "status": 6, // Status code
  "count: 2, // Items amount
 }
]