API for affiliate

To get started with the API, you need to 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

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:

Field Description
id* Unique order ID on your side (required)
If you dont have such ID, simply send auto in this field
wm Agency affiliate or source ID
offer* Offer ID (required)
name Customer name
phone* Customer phone, digits only (required)
email Customer email
ip* Customer IP-address (required)
ua Customer's browser User-Agent
country Two-letter ISO code of customer's country

Additional parameters for lead creation:

Field Description
us UTM tag utm_source
uc UTM tag utm_campaign
un UTM tag utm_content
ut UTM tag utm_term
um UTM tag utm_medium
currency Three-letter currency ISO code, like USD or EUR
index ZIP code
addr Delivery address. Can contain full address without the ZIP code, or only house and apartment numbers, if the fields below are used.
area Region part of the delivery address
city City part of the delivery address
street Street part of the delivery address
base Unit price in order currency.
count Quantity of goods.
discount Discount on goods as a percentage.
more The amount of the extra cost of the order, for example, margins for express delivery.
comm Order comment.
item The ID of the nested good to be added to the order. If there are several products, it is listed separated by commas.
items An 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
params Key-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:

Field Description
status The result of the operation: ok if successful, error in case of an error
uid The 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!
id ID of the created order (if successful)
error Error 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 was already 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 }

Check lead status

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

Function ID - list. 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. Array key is the order ID on the agency side. Each item includes the following fields:

Field Description
id Your order ID
src Your affiliate or source ID
uid Our internal order ID
stage Order 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
status Extended 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
reason Cancel 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
count Amount of order goods
comment Order 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
 }
]