API documentation

The tracker APIs allow you to work with traffic and statistics. To get an API token, go to your profile page in the system. Interaction with the service is carried out via the HTTP protocol, the response status is always 200. The standard request format is GET or "pure" POST (form-urlencoded). When submitting in JSON, don't forget the Content-type: application/json header. The result format is JSON. There is no limit on the number of requests.

The functions can work for both the webmaster and the team. For regular work, use the URL for user. For team-level work, use the URL for team with the key of any of the team leads.

Further in the text, important parameters are shown in curly brackets:

  • {token} - your API key from personal account, for example 123-abdce.
  • {key} - your postback key from any flow, for example 666c93ba7cebe113.
  • {flow} - symbolic identifier of a flow from the list, for example ef1c.
  • {click} - character ID of a click from the tracker, for example ca1337.

Important! When using links and data, don't use curly braces, only the values themselves!

01 Contents

Back to contents

02 Integration

Integration functions are responsible for connecting third-party services and transmitting conversion data.

Postback

URL https://www.altercpa.red/postbacks/{key}?click={click}

API URL for user https://www.altercpa.red/api/tracker/postback.json?id={token}&click={click}

API URL for team https://www.altercpa.red/api/gangs/postback.json?id={token}&click={click}

The most important function of interaction with the tracker. Creates a new lead or modifies an existing lead based on the click or flow IDs sent. You can use two calling options:

  • Standard operation: with the click parameter. The data for the lead is taken from the click ID. Used by default, this is the recommended approach.
  • Fallback operation: with the flow and subid parameters. The data for the lead is taken from the stream ID, the uniqueness of the request is determined by the subid parameter. Suitable for cases where there is no concept of a click and a click on a link, for example, for application integration.

The function can take the following parameters as input:

FieldDescription
clickCharacter click ID.
flowCharacter flow ID.
uidUnique lead identifier on the advertiser's side.
statusLead status, optimal: new, hold, approve, cancel, trash.
goalCharacter ID of goal.
createCreate new lead on each postback received. Value must be 1.
priceLead price (commission payment).
addpriceAdd amount to existing lead price.
currencyThree-letter ISO code for the lead currency, by default usd.
convertThe ISO code of the currency to convert the payout amount to is not used by default.
costLead cost (not commission!).
addcostAdd amount to existing lead cost.
costcurThree-letter ISO code for the lead cost currency, by default usd.
costconvThe ISO code of the currency to convert the cost to is not used by default.
nameCustomer's name.
phoneCustomer's phone (without validation and correction).
emailCustomer's email (without validation and correction).
commentCustom comment to the lead.
meta[xxx]Custom lead field with name xxx.
utm_sourceTag UTM Source to replace the one received from the click.
utm_campaignTag UTM Campaign to replace the one received from the click.
utm_contentTag UTM Content to replace the one received from the click.
utm_termTag UTM Term to replace the one received from the click.
utm_mediumTag UTM Medium to replace the one received from the click.
subidTag SubID to replace the one received from the click.
adidAd click ID to replace the one received from the click.
data1Custom data 1 to replace the one received from the click.
data2Custom data 2 to replace the one received from the click.
data3Custom data 3 to replace the one received from the click.
data4Custom data 4 to replace the one received from the click.
data5Custom data 5 to replace the one received from the click.
stnStatus or list of statuses that are recognized as new lead.
sthStatus or list of statuses that are recognized as lead in hold.
staStatus or list of statuses that are recognized as approved lead.
stcStatus or list of statuses that are recognized as cancelled lead.
sttStatus or list of statuses that are recognized as trash.
ipLead IP address.
geoTwo-letter ISO code of lead country.
uaUser-Agent of the lead to determine the OS and browser.

The result of the function is an associative array:

FieldDescription
statusThe result of the operation: ok in case of success, error in case of an error.
errorError code for status error with value from the list:
  • access - the specified click or flow does not belong to you.
  • bad-click - no click found with this ID.
  • bad-flow - no flow found with this ID.
  • db - a system error occurred while working with the database.
  • no-changes - no changes were required, the lead is already in the right state.
  • no-click - no click ID or flow specified.
idThe numeric ID of the lead that the action was taken on.
createIf a new lead was created - true, if an existing one was changed - false.
stageThe status the lead is in: new, hold, approve, cancel, trash.

Example of a successful server response:

{
    "status": "ok",
    "id": 1337,
    "create": true,
    "stage": "new"
}

Example of a server response with an error:

{
    "status": "error",
    "error": "no-changes"
}

Spend import

URL for user https://www.altercpa.red/api/tracker/spend.json?id={token}

URL for team https://www.altercpa.red/api/gangs/spend.json?id={token}

The function sets the click price for traffic according to the specified conditions. Allows you to use the ROI calculation functionality. Data can be transmitted in both GET and POST requests. The request must contain the cpc or cost parameters and at least one condition (dates, flow, UTM tags).

The function can take the following parameters as input:

FieldDescription
costThe total price for all clicks during this period.
cpcPrice per one click.
fromThe start date of the period in the format YYYY-MM-DD, Unix Timestamp, or any other format recognized by the strtotime function.
toThe end date of the period in the format YYYY-MM-DD, Unix Timestamp, or any other format recognized by the strtotime function.
flowCharacter identifier of the flow. You can pass an array of identifiers.
wayNumeric identifier of the way within the flow. You can pass an array of identifiers.
currencyThree-letter ISO code for the click currency, by default usd.
geoTwo-letter ISO code of click country.
domainThe domain where click appeared.
utm_sourceThe UTM Source tag by which the click was registered.
utm_campaignThe UTM Campaign tag by which the click was registered.
utm_contentThe UTM Content tag by which the click was registered.
utm_termThe UTM Term tag by which the click was registered.
utm_mediumThe UTM Medium tag by which the click was registered.
subidThe SubID tag by which the click was registered.
customerThe Customer tag by which the click was registered.
validSet the price only for valid clicks: targeted clicks that pass the filter.
uniqueSet the price only for unique clicks.

You can also simultaneously update several price tags with one request; to do this, combine all requests into a batch array and send it via POST, for example:

{
    "batch": [
        {
            "flow": "face",
            "cost": 1984,
            "currency": "usd"
        },
        {
            "from": "2020-04-04 00:00:00",
            "to": "2020-04-07 23:59:59",
            "cpc": 1.337,
            "currency": "eur"
        }
    ]
}

The result of the function is an associative array:

FieldDescription
statusThe result of the operation: ok in case of success, error in case of an error.
errorError code for status error with value from the list:
  • empty - no data to put into price tags.
ok / badNumber of successful and unsuccessful price setting requests. Usually contains the response ok=1

Example of a successful server response:

{
    "status": "ok",
    "ok": 1,
    "bad": 0
}

Example of a server response with an error:

{
    "status": "error",
    "error": "empty"
}
Back to contents

03 Statistics

Statistics functions provide access to reports on leads and clicks.

Leads list

URL for user https://www.altercpa.red/api/tracker/leads.json?id={token}

URL for team https://www.altercpa.red/api/gangs/leads.json?id={token}

The function retrieves the list of leads and returns it as an associative array in the leads field. The function has no formal limits on the number of leads displayed, but it is not recommended to load more than a thousand leads at a time. If you get a 500 error, it means that there was not enough memory for your request, you need to reduce the request period.

The function can accept the following GET filtering parameters as input:

FieldDescription
fromReport start date in YYYY-MM-DD format and tracker timezone.
toReport end date in YYYY-MM-DD format and tracker timezone.
ufromReport start date in Unix Timestamp format.
utoReport end date in Unix Timestamp format.
statusCharacter status of the lead:
  • new - new leads.
  • hold - leads in the hold.
  • approve - approved leads.
  • cancel - cancelled leads.
  • trash - leads in trash.
  • valid - valid leads (everything except trash).
  • wait - pending leads (new and hold).
  • good - good leads (hold and approve).
  • bad - bad leads (cancelled and trash).
geoTwo-letter ISO code of lead country.
flowCharacter flow ID.
wayNumeric way ID.
clickCharacter click ID.
siteNumeric site ID.
goalCharacter goal ID.
filterThe result of the filters:
  • 0 - target visits.
  • 1 - blocked: bot.
  • 2 - blocked: blacklist.
  • 3 - blocked: country.
  • 4 - blocked: language.
  • 5 - blocked: filtering campaign.
domainThe domain from which the lead was sent.
ipLead IP address.
utm_sourceThe value of UTM Source tag.
utm_campaignThe value of UTM Campaign tag.
utm_contentThe value of UTM Content tag.
utm_termThe value of UTM Term tag.
utm_mediumThe value of UTM Medium tag.
subidThe value of SubID tag.
customerThe value of Customer tag.
userUser ID in team.

The result of the function is an associative array:

FieldDescription
statusThe result of the operation: ok in case of success, error in case of an error.
leadsAn array of leads, the composition of the fields is analyzed further.
errorError code for status error with value from the list:
  • access - you are trying to access data that does not belong to you.
  • payment-required - your subscription has expired, renew your subscription.

Inside the leads field, leads are represented by an associative array with fields:

FieldDescription
idLead numeric ID.
userUser ID in team.
timeLead arrival time in UNIX Timestamp format.
clickCharacter click ID.
uidUnique lead identifier on the advertiser's side.
flowCharacter flow ID.
wayNumeric way ID.
siteNumeric site ID.
siteurlSite URL.
filterThe result of the filters:
  • 0 - target visits.
  • 1 - blocked: bot.
  • 2 - blocked: blacklist.
  • 3 - blocked: country.
  • 4 - blocked: language.
  • 5 - blocked: filtering campaign.
statusCharacter status of the lead:
  • new - new lead.
  • hold - lead in the hold.
  • approve - approved lead.
  • cancel - cancelled lead.
  • trash - lead in trash.
customReal statustext of the lead sent by the advertiser.
goalCharacter goal ID.
priceLead price (always available regardless of status).
currencyLead price currency, by default usd.
costLead cost (not the commission price, it's above).
costcurLead cost currency, by default usd.
ipLead IP address.
geoTwo-letter ISO code of lead country.
nameCustomer's name.
phoneCustomer's phone (without validation and correction).
emailCustomer's email (without validation and correction).
commentLead comment.
metaArray of additional lead fields.
uaBrowser User Agent
adidAd click ID (fbclid, gclid, adclid, clid, adid).
data1Custom data 1.
data2Custom data 2.
data2Custom data 3.
data2Custom data 4.
data2Custom data 5.
domainThe domain from which the lead was sent.
utm_sourceThe value of UTM Source tag.
utm_campaignThe value of UTM Campaign tag.
utm_contentThe value of UTM Content tag.
utm_termThe value of UTM Term tag.
utm_mediumThe value of UTM Medium tag.
customerThe value of Customer tag.
subidThe value of subid tag.

Example of a successful server response:

{
    "status": "ok",
    "leads": [
        {
            "id": 1,
            "user": 13,
            "time": 1691303223,
            "click": "ac13",
            "uid": "c1vvkg272m16",
            "flow": "ecb4",
            "way": 123,
            "site": 42,
            "siteurl": "https://meow.pro/c8/cfb72fe561f0/",
            "filter": 0,
            "status": "approve",
            "custom": "Confirmed",
            "goal": "paid",
            "price": 18,
            "currency": "usd",
            "cost": 35,
            "costcur": "eur",
            "ip": "12.34.56.78",
            "geo": "de",
            "name": "Hans",
            "phone": "+49 (30) 226-511-83",
            "email": "noreply@gmx.de",
            "comment": "Confirmed on sunday",
            "meta": {
                "foo": "bar",
                "bar": "foo"
            },
            "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Safari\605.1.15",
            "adid": "bf9d4aa8-4979-11ee-94c6-005056aec456",
            "data1": "wj80b89eit8epaarikhe2oge",
            "data2": false,
            "utm_source": "fb",
            "utm_campaign": "1013444211662",
            "utm_content": "432211555332166",
            "utm_term": false,
            "utm_medium": false,
            "domain": "meow.pro",
            "customer": "vendoso",
            "subid": "purr"
        },
        ...
    ]
}

Example of a server response with an error:

{
    "status": "error",
    "error": "payment-required"
}

Click statistics

URL for user https://www.altercpa.red/api/tracker/stats.json?id={token}

URL for team https://www.altercpa.red/api/gangs/stats.json?id={token}

The function collects general statistics on the number of clicks and leads, broken down by goals for the selected period according to the specified criterion.

The function can accept the following GET filtering parameters as input:

FieldDescription
from*Report start date in YYYY-MM-DD format (required).
to*Report end date in YYYY-MM-DD format (required).
item*Element by which statistics are grouped (required):
  • date - the date the click and lead were received.
  • hour - hour of the click and lead.
  • flow - flow ID.
  • way - way ID.
  • site - site ID.
  • filter - filtering results.
  • geo - country.
  • mobile - device type.
  • os - operating system.
  • browser - browser.
  • ip - IP address.
  • utmd - domain.
  • utmu - customer.
  • subid - SubID tag.
  • utms - UTM Source tag.
  • utmc - UTM Campaign tag.
  • utmn - UTM Content tag.
  • utmt - UTM Term tag.
  • utmm - UTM Medium tag.
  • user - user ID in team.
geoTwo-letter ISO code of lead country.
flowCharacter flow ID.
wayNumeric way ID.
siteNumeric site ID.
filterThe result of the filters:
  • 0 - target visits.
  • 1 - blocked: bot.
  • 2 - blocked: blacklist.
  • 3 - blocked: country.
  • 4 - blocked: language.
  • 5 - blocked: filtering campaign.
hourLead arrival hour (number from 0 to 23).
mobileTraffic type:
  • 0 - desktop traffic.
  • 1 - mobile traffic.
osOperating system:
  • 0 - Other
  • 1 - Windows
  • 2 - MacOS
  • 3 - Linux
  • 4 - iOS
  • 5 - Android
  • 6 - Windows Mobile
  • 7 - Symbian
  • 8 - BlackBerry
browserBrowser:
  • 0 - Other
  • 1 - Chrome
  • 2 - Firefox
  • 3 - MSIE
  • 4 - Safari
  • 5 - Opera
  • 6 - Edge
  • 7 - Facebook
  • 8 - Instagram
  • 9 - Tik-Tok
  • 10 - WebView
  • 11 - Bot
domainThe domain from which the lead was sent.
ipLead IP address.
utm_sourceThe value of UTM Source tag.
utm_campaignThe value of UTM Campaign tag.
utm_contentThe value of UTM Content tag.
utm_termThe value of UTM Term tag.
utm_mediumThe value of UTM Medium tag.
customerThe value of Customer tag.
subidThe value of subid tag.

The result of the function is an associative array:

FieldDescription
statusThe result of the operation: ok in case of success, error in case of an error.
statsThe array of statistics results, the composition of the fields is analyzed further.
totalThe total results for the entire query.
errorError code for status error with value from the list:
  • access - you are trying to access data that does not belong to you.
  • no-item - the criterion by which statistics should be grouped is not specified.
  • no-from - start date of statistics period is not specified.
  • no-to - end date of statistics period is not specified.
  • payment-required - your subscription has expired, renew your subscription.

The stats array and the total field are an associative array:

FieldDescription
idStatistics element ID.
nameStatistics element name.
clickTotal clicks amount.
uniqueUnique clicks amount.
nextAmount of clicks moved to next step.
perPercent of clicks moved to next step.
totalTotal leads number.
cvValid leads number.
cnNew leads number.
chHold leads number.
caApproved leads number.
ccCancelled leads number.
ctTrash leads number.
mtTotal earnings.
mhHeld leads earnings.
maApproved leads earnings.
mctTotal cost.
mchHeld leads cost.
mcaApproved leads cost.
mmtAverage (mean) cost.
mmhHeld leads average (mean) cost.
mmaApproved leads average (mean) cost.
crConversion: the ratio of valid leads to unique clicks.
crtTotal conversion: the ratio of all the leads to unique clicks.
epcEPC: the ratio of all earnings to unique clicks.
epcEPL: earn per approved and held leads.
apprApprove: the ratio of approved leads to valid ones.
appTotal approve: the ratio of approved leads to all leads.
cpcAverage cost per click.
cplAverage cost per lead in any status.
cpxAverage cost per valid lead.
cpaAverage cost per approved lead.
spendTotal cost for all clicks.
profitEarnings: amount for approved leads minus expenses.
roiROI as a percentage, where a positive number represents profit, zero represents a full return on investment, and -100 represents a complete loss.
goalThe array with statistics for each individual goal. Contains the same fields as the rest of the statistics.

Example of a successful server response:

{
    "status": "ok",
    "stats": {
        "20230805": {
            "id": 20230805,
            "name": "2023-08-05",
            "click": 44,
            "unique": 22,
            "total": 6,
            "cv": 4,
            "cn": 1,
            "ch": 1,
            "ca": 2,
            "cc": 0,
            "ct": 2,
            "mh": 20.0,
            "ma": 135.0,
            "mt": 155.0,
            "cr": 18.2,
            "epc": 6.75,
            "appr": 66.7,
            "app": 33.3
        },
        ...
    },
    "total": {
        "click": 175,
        "unique": 58,
        "total": 25,
        "cv": 23,
        "cn": 11,
        "ch": 8,
        "ca": 9,
        "cc": 0,
        "ct": 2,
        "mh": 160.0,
        "ma": 1200.0,
        "mt": 1360.0,
        "cr": 5.17,
        "epc": 12.3,
        "appr": 46.7,
        "app": 31.0
    }
}

Example of a server response with an error:

{
    "status": "error",
    "error": "no-item"
}
Back to contents