The API of GGLead allows you to perform most of the actions of the affiliate and the merchant implemented on the site itself. To connect the API, go to your profile page. API requests are carried out via HTTP. The request format is pure POST. The result format is JSON or serialized PHP data. There are no restrictions on the number of requests.

To get started with the API, you need to get the API token. You can find it in your "Profile". Please log in to see your API token.

The data for the request is transmitted in the POST-part of the request in its pure form. You don't need to encode them anyhow, don't need to convert to JSON of XML. But if you really want it and need it, you can use JSON POST with Content-type: application/json header.

The affiliate functions allow you to work with your flows and to receive account statistics.

Add new lead

URL: https://gglead.net/api/wm/push.json?id={token}

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

Attention! This function is usually disabled and must be activated via technical support.

The function accepts the following data about the lead:

Field Description
flow* Flow ID (required)
offer* Offer ID from this list (required)
ip* Customer IP-address (required)
name Customer full name or first name
last Customer last name
phone* Customer phone in international format including country code, digits only (required)
phonecc Phone country code in +7 format (optional). When specifying this parameter, the phone number in phone must still be passed with the country code.
email Customer email
ua Customer's browser User-Agent
country Two-letter ISO code of customer's country, if empty - discovered by the IP address.
currency Three-letter currency ISO code, like USD or EUR.
comment Lead comments.
utm_source UTM tag utm_source max 255 characters, useful for statistics
utm_campaign UTM tag utm_campaign max 255 characters, useful for statistics
utm_content UTM tag utm_content max 255 characters, useful for statistics
utm_term UTM tag utm_term max 255 characters, useful for statistics
utm_medium UTM tag utm_medium max 255 characters, useful for statistics
subid Tracking tag subid max 255 characters, for tracker use only - not avaliable in statistics
uuid Tracking tag uuid max 255 characters, for tracker use only - not avaliable in statistics
sub1 Tracking tag sub1 max 255 characters, for tracker use only - not avaliable in statistics
sub2 Tracking tag sub2 max 255 characters, for tracker use only - not avaliable in statistics
sub3 Tracking tag sub3 max 255 characters, for tracker use only - not avaliable in statistics
sub4 Tracking tag sub4 max 255 characters, for tracker use only - not avaliable in statistics
sub5 Tracking tag sub5 max 255 characters, for tracker use only - not avaliable in statistics
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.
mobile Use 0 for desktop traffic and 1 for mobile traffic

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
id ID of the created order (if successful)
pin The lead's internal password for data clarification, you can ignore it.
url URL to access the personal account (autologin). If empty - no autologin used for the offer.
message An error message that can be shown to the customer.
error Error codes:
  • access - sending leads via API is not available for you yet, contact your personal manager to activate it.
  • key - invalid API key, check settings in profile.
  • nooffer - no offer ID specified, you may be sending JSON without Content-type: application/json header.
  • noflow - no flow ID specified, create a flow in "Offers" section.
  • badflow - invalid flow ID specified, check the ID in "Flows" section.
  • no-api - the offer does not support work via the API. Probable error: the form on the landing page has a hidden offer field with an extraneous value.
  • nophone - phone is not specified, or its length is less than 6 or more than 15 characters.
  • phone - the specified phone did not pass validation.
  • email - the specified email did not pass validation.
  • duplicate - an order with such data is already in CRM
  • offer - the specified offer was not found.
  • security - your user is blocked, contact the administration.
  • ban - the customer's phone or IP address is blacklisted. The reason is shown in the info field.
  • traffic - the offer or site is not available to you. At the same time, the customer sees the error "The product is out of stock".
  • data - required fields are missing or incorrectly specified, the list of errors is shown in the bad field.
  • db - an internal error occurred while adding an order, please try sending again.
bad List of required fields that were not specified when submitting.
info The reason for blocking a lead for ban, access and traffic:
  • no-push - you are not granted access to send leads via API, request access from your personal manager.
  • phone - blacklisted customer's phone.
  • bad-ip - the customer's IP address is incorrect.
  • ip - blacklisted customer's IP address.
  • filter - the customer's IP address has been blocked by the filtering system.
  • flood - the number of requests to send a lead has been exceeded.
  • geo and country - the country is not available in this offer.
  • offer - you do not have access to the private offer.
  • site - you do not have access to the private site.
  • search - traffic without specifying the source.
  • ext - you are using the wrong function, yours is agency.
  • comp - you are using the wrong function, yours is company.

Successful response example:

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

Error response example:

{ "status" : "error", "error" : "nooffer" }

Import cost per click

URL: https://gglead.net/api/wm/cost.json?id={token}

The function sets cost of the clicks matching the following criteria. Allows using the ROI statistics. You can send the data either via GET or via POST. The request must contain either the cpc or the cost parameter and at least one condition (dates, flow ID, UTM tags). The price is assigned only to those clicks that the system considers to be incoming - unique clicks on the prelanding pages and unique clicks on the landing pages without using the prelanding page.

The function accepts the following data about the click cost:

Field Description
cpc* Cost per single click
cost* Total cost of all the amount of the clicks matching the following criteria
currency Currency ISO-code, for example: USD
from и to Dates of the beginning and end of the period for which to set the price. It can be transmitted both in UNIX Timestamp format and in the form of YYYY-MM-DD HH:MM:SS or another standard date format.
flow Flow identifier
utms UTM tag utm_source
utmc UTM tag utm_campaign
utmn UTM tag utm_content
utmt UTM tag utm_term
um UTM tag utm_medium
extu Agency tag "Identifier"
exts Agency tag "Source"

You can also update several price tags at the same time with a single request. Simply combine all the requests into the batch array and send it via POST, for example:

{
    "batch": [
        {
            "flow": 42,
            "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:

Field Description
status The result of the operation: ok if successful, error in case of an error
ok and bad Number of successful and failer operations of setting cost per click. Usually: ok=1

Successful response example:

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

Error response example:

{ "status" : "error", "error" : "nooffer" }

Statistics by lead

URL: https://gglead.net/api/wm/lead.json?id={token}

Function shows the list of leads and their status by ID list or for selected date.

Field Description
ids Lead IDs list separated by comma. Use 20-30 IDs at a time.
day Date for statistics in format of YYYY-MM-DD. Optional. By default, today is used. Ignored if IDs list is set.
from
to
Show orders between from and to dates. Date is set as YYYY-MM-DD. You can use both fields or just one of them.
offer Offer ID. Optional. By default, all offers are shown.
flow Flow ID. Optional. By default, all offers are shown
site Site ID. You can get site IDs list with function sites.
status Order status:
  • w - processing leads
  • h - leads in hold (awaiting approval)
  • a - approved leads
  • c - cancelled leads
  • c - invalid leads (trash)
  • not set - all leads

The result of the function is an array of leads. Each item includes the following fields:

Field Description
id Order ID
time Order time as UNIX-timestamp
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
phase Integer order status code:
  • 1 - processing order
  • 2 - order in hold stage
  • 3 - order is approved
  • 4 - order is cancelled by generic reason
  • 5 - order is cancelled as trash
custom Original lead status text from advertiser's CRM (if available)
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 – Trash or test (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
  • 16 – Consultation
  • 17 – Cancelled by timer
  • 18 – Blacklist
  • 19 – Misslead or misstarget
reason_text Cancel reason text interpretation
offer Offer ID
offer_name Offer name
flow Flow ID
site Landing site ID
site_url Landing site URL
space Prelanding site ID
space_url Prelanding site URL
ip Customer IP address
utm_* UTM tags: utm_source, utm_content, utm_campaign, utm_medium, utm_term

Function response example:

[
    {
	"id": 10101,
	"time": "1498127780",
	"stage": "trash",
	"phase": 5,
	"reason": 1,
	"reason_text": "Incorrect phone",
	"hold": 0,
	"comment": null,
	"cash": 700,
	"offer": 234,
	"offer_name": "Shiny test offer",
	"flow": 4838,
	"site": 123,
	"site_url": "land.cpa/test-offer",
	"space": 0,
	"space_url": false,
	"ip": "12.34.56.78",
	"utm_source": "google",
	"utm_content": "321012",
	"utm_campaign": "321",
	"utm_medium": "cpc",
	"utm_term": "neverland"
    }
]

Statistics by date

URL: https://gglead.net/api/wm/stats.json?id={token}

Function shows statistics table for leads and clicks, grouped by date, same as «Statistics by date».

Function can use following input parameters:

Field Description
from Statistics start date like YYYY-MM-DD. Optional parameter. By default, one week ago is used.
to Statistics end date like YYYY-MM-DD. Optional parameter. By default, today is used.
offer Offer ID. Optional. By default, all offers are shown.
flow Flow ID. Optional. By default, all offers are shown

The result of the function is an associative array. Each row ID has format YYYYMMDD. Each item includes following fields:

Field Description
id Statistics date like YYYYMMDD
spaces Amount of prelanding clicks
suni Amount of unique prelanding clicks
sgood Amount of successful prelanding visits
stime Average time spent on prelanding in seconds
clicks Amount of landing clicks
unique Amount of unique landing clicks
good Amount of successful landing visits
time Average time spent on landing in seconds
ct Total amount of leads without trash
mt Total revenue without trash
ca Amount of approved leads
ma Revenue for approved leads
cc Amount of cancelled leads without trash
mc Revenue from cancelled leads without trash
cw Amount of processing leads
mw Revenue from processing leads
cw Amount of holding leads
mw Revenue from holding leads
cx Amount of invalid leads (trash)
mx Revenue from invalid leads (trash)

Function response example:

{
    "20250906": {
	"id": "20250906",
	"space": 321,
	"suni": 291,
	"sgood": 153,
	"stime": 23.45,
	"clicks": 113,
	"unique": 93,
	"time": 34.56,
	"good": 80,
	"ct": 13,
	"mt": 9100,
	"ca": 5,
	"ma": 3500,
	"cc": 3,
	"mc": 2100,
	"cw": 5,
	"mw": 3500,
	"ch": 1,
	"mh": 1000,
	"cx": 2,
	"mx": 1400
    }
}

Statistics by click

URL: https://gglead.net/api/wm/click.json?id={token}

Function shows statistics for clicks and leads grouped by selected parameter. This function can be used by both affiliates and agencies.

Function can use following input parameters:

Field Description
item* Required. Parameter to group statistics by:
  • offer - offer ID
  • flow - flow ID
  • site - site ID
  • utms - UTM tag utm_source
  • utmc - UTM tag utm_campaing
  • utmn - UTM tag utm_content
  • utmt - UTM tag utm_term
  • utmm - UTM tag utm_medium
  • extu - agency lead unique ID
  • exts - agency webmaster ID
from Statistics start date like YYYY-MM-DD. By default, one week ago is used.
to Statistics end date like YYYY-MM-DD. By default, today is used.
offer Filter by offer ID.
flow Filter by flow ID.
site Filter by site ID.
utms Filter by utm_source.
utmc Filter by utm_campaign.
utmn Filter by utm_content.
utmt Filter by utm_term.
utmm Filter by utm_medium.
extu Filter by agency lead unique ID.
exts Filter by agency webmaster ID.

The result of the function is an associative array. Each element is identified by the ID of grouping field. Each item includes following fields:

Field Description
id Grouping field element ID
name Grouping field element name, if applicable
spaces Amount of prelanding clicks
suni Amount of unique prelanding clicks
sgood Amount of successful prelanding visits
stime Average time spent on prelanding in seconds
clicks Amount of landing clicks
unique Amount of unique landing clicks
good Amount of successful landing visits
time Average time spent on landing in seconds
ct Total amount of leads without trash
mt Total revenue without trash
ca Amount of approved leads
ma Revenue for approved leads
cc Amount of cancelled leads without trash
mc Revenue from cancelled leads without trash
cw Amount of processing leads
mw Revenue from processing leads
ch Amount of holding leads
mh Revenue from holding leads
cx Amount of invalid leads (trash)
mx Revenue from invalid leads (trash)

Function response example:

{
    "123": {
	"id": "123",
	"name": "Shiny test offer",
	"space": 321,
	"suni": 291,
	"sgood": 153,
	"stime": 23.45,
	"clicks": 113,
	"unique": 93,
	"time": 34.56,
	"good": 80,
	"ct": 13,
	"mt": 9100,
	"ca": 5,
	"ma": 3500,
	"cc": 3,
	"mc": 2100,
	"cw": 5,
	"mw": 3500,
	"ch": 1,
	"mh": 1000,
	"cx": 2,
	"mx": 1400
    }
}

Offers list

URL: https://gglead.net/api/wm/offers.json?id={token}

The function allows you to get a list of active offers, their description and conversion data. To show information only for one offer, specify its identifier in the offer parameter.

The result of the function is an associative array of offers with following fields:

Field Description
id Offer ID
name Offer full name
short Offer short name
cid Offer category ID
cat Offer category name
epc EPC - earn per click
cr Convert Ratio, the ratio of unique visitors to the number of received orders
approve Orders approval percentage
geo
goal
List of geographical or generic goals for offer with price and payments:
  • code - country or goal code
  • name - country or goal name
  • price - price on the landing
  • currency - currency
  • cr - conversion rate
  • epc - earn per click
  • approve - order approval percentage
  • desktop and mobile - payments for desktop and mobile lead
Payments can contain following parameters:
  • base - basic fixed part of payment
  • upsale - additional payment for upsell item
  • xsale - additional payment for cross sell item
  • percent - percentage payment from order total price
  • currency - payment currency
land
space
List of landings and prelandings for the offer, like site list:
  • id - site ID
  • url - site URL
  • epc - earn per click
  • cr - conversion rate
  • approve - order approval percentage
  • mobile - mobile device optimization
  • default - site is used by default

Function response example:

{
    "31": {
        "id": 31,
        "name": "Shiny test offer",
        "short": "Testing",
        "cid": 2,
        "cat": "Health and beauty",
        "epc": 262.5,
        "cr": 150,
        "appr": 42.9,
        "geo": {
            "ru": {
                "code": "ru",
                "name": "Russia",
                "price": 990,
                "currency": "rub",
                "cr": 6.2,
                "epc": 18.4,
                "approve": 71.2,
                "desktop": {
                    "base": 600,
                    "upsale": 30,
                    "crossale": 30,
                    "percent": 0,
                    "currency": "rub"
                },
                "mobile": {
                    "base": 500,
                    "upsale": 25,
                    "crossale": 25,
                    "percent": 0,
                    "currency": "rub"
                }
            },
        },
        "land": {
            "123": {
                "id": 123,
                "url": "http://land.cpa/test-land/",
                "epc": 23.4,
                "cr": 5.6,
                "approve": 78.9,
                "mobile": 1,
                "default": true
            },
        },
        "space": {
            "234": {
                "id": 234,
                "url": "http://blog.cpa/test-space/",
                "epc": 12.3,
                "cr": 4.5,
                "approve": 67.8,
                "mobile": 0,
                "default": false
            },
        }
    }
}

Offer sites

URL: https://gglead.net/api/wm/sites.json?id={token}

Function shows the list of sites of selected offer. Offer ID must be specified by offer parameter.

The result of the function is an associative array with two fields: land for landings list and space for prelandings list. Each site contains following information:

Field Description
id Site ID
url Site URL
epc EPC - earn per click
cr Convert Ratio, the ratio of unique visitors to the number of received orders
approve Orders approval percentage
mobile Mobile device optimization:
  • 0 - not suitable for mobile devices
  • 1 - redirects to mobile landing
  • 2 - optimized for mobile devices only
  • 3 - adaptive site suitable for any devices

Function response example

{
    "land": {
        "123": {
            "id": 123,
            "url": "http://land.cpa/test-land/",
            "epc": 23.4,
            "cr": 5.6,
            "approve": 78.9,
            "mobile": 1
        },
    },
    "space": {
        "234": {
            "id": 234,
            "url": "http://blog.cpa/test-space/",
            "epc": 12.3,
            "cr": 4.5,
            "approve": 67.8,
            "mobile": 0
        },
    }
}

Flows list

URL: https://gglead.net/api/wm/flows.json?id={token}

Function shows the list of affiliate flows. Can use parameter offer as offer ID to filter flows.

The result of the function is an associative array with flows list:

Field Description
id Flow ID
url Flow full URL
offer Offer ID
offername Offer name
name Flow name
epc EPC - earn per click
cr Convert Ratio, the ratio of unique visitors to the number of received orders
total Flow total revenue
site Landing ID
siteurl Landing URL
space Prelanding ID (zero - not used)
spaceurl Prelanding URL (false - not used)
traffback Traffback URL to redirect customers with wrong GEO
postback Postback URL
metrika Yandex.Metrika counter ID
google Google Tag Manager counter ID
vkcom VKcom pixel ID
facebook Facebook pixel ID
utm_* UTM tags: utm_source, utm_campaign, utm_content, utm_term, utm_medium

Function response example:

{
    "123": {
        "id": 123,
        "url": "http://blog.cpa/test-space/?flow=123&l=234",
        "offer": 45,
        "offername": "Shiny test offer",
        "name": "Still shiny 45",
        "epc": 12.3,
        "cr": 4.5,
        "total": 550,
        "site": 234,
        "siteurl": "land.cpa/test-site",
        "space": 345,
        "spaceurl": "blog.cpa/test-space",
        "traffback": "",
        "postback": "http://help.me/iamtrapped.php?key=inroom&number=5&status={stage}",
        "metrika": "123456789",
        "google": "123-ABDC",
        "vkcom": "VK-ABCD-1234",
        "facebook": "1234-56-7890",
        "utm_source": "google",
        "utm_campaign": "343",
        "utm_content": "987652",
        "utm_term": "helloworld",
        "utm_medium": "cpc"
    },
}

Add new flow

URL: https://gglead.net/api/wm/add.json?id={token}

Function creates new flow for the selected offer.

Required parameter is offer with the offer ID from function offers.

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
id New flow ID
error Error code: offer-inactive if offer doesn't exist or is inactive, request-error in case of internal error

Successful response example:

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

Error response example:

{ "status" : "error", "error" : "offer-inactive" }

Flow settings

URL: https://gglead.net/api/wm/edit.json?id={token}

Function changes flow settings by ID. Flow ID is the only required parameter, other parameters are optional

Function can use following input parameters:

Field Description
flow* Flow ID to change
name New flow name
site Landing ID
space Prelanding ID (zero - not used)
drt Redirect parked domain ID (zero - not used)
dst Landing parked domain ID (zero - not used)
dsp Prelanding parked domain ID (zero - not used)
url Traffback URL to redirect customers with wrong GEO
pbu Postback requests URL
mtrk Yandex.Metrika counter ID
ga Google Tag Manager counter ID
vk VKcom pixel ID
fb Facebook pixel ID
utms UTM tag utm_source
utmc UTM tag utm_campaign
utmn UTM tag utm_content
utmt UTM tag utm_term
utmm UTM tag utm_medium

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
error Error code: access-denied when using wrong flow ID, request-error in case of internal error

Successful response example:

{ "status" : "ok" }

Error response example:

{ "status" : "error", "error" : "access-denied" }

Delete the flow

URL: https://gglead.net/api/wm/del.json?id={token}

Function deletes the flow specified by flow ID in parameter flow.

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
error Error code: access-denied when using wrong flow ID, request-error in case of internal error

Successful response example:

{ "status" : "ok" }

Error response example:

{ "status" : "error", "error" : "access-denied" }

Merchant API-interface allow you to integrate our CRM with yours.

Add new order

URL: https://gglead.net/api/comp/add.json?id={token}

The function allows you to add a new lead as the company, with no order source specified. New lead data is transmitted in a POST request.

Attention! This function is usually disabled and must be activated via technical support.

The function accepts the following data about the lead:

Field Description
offer* Offer ID from this list (required)
ip* Customer IP-address (required)
name Customer full name or first name
last Customer last name
phone* Customer phone in international format including country code, digits only (required)
phonecc Phone country code in +7 format (optional). When specifying this parameter, the phone number in phone must still be passed with the country code.
email Customer email
ua Customer's browser User-Agent
country Two-letter ISO code of customer's country, if empty - discovered by the IP address.
currency Three-letter currency ISO code, like USD or EUR.
comment Lead comments.
utm_source UTM tag utm_source max 255 characters, useful for statistics
utm_campaign UTM tag utm_campaign max 255 characters, useful for statistics
utm_content UTM tag utm_content max 255 characters, useful for statistics
utm_term UTM tag utm_term max 255 characters, useful for statistics
utm_medium UTM tag utm_medium max 255 characters, useful for statistics
subid Tracking tag subid max 255 characters, for tracker use only - not avaliable in statistics
uuid Tracking tag uuid max 255 characters, for tracker use only - not avaliable in statistics
sub1 Tracking tag sub1 max 255 characters, for tracker use only - not avaliable in statistics
sub2 Tracking tag sub2 max 255 characters, for tracker use only - not avaliable in statistics
sub3 Tracking tag sub3 max 255 characters, for tracker use only - not avaliable in statistics
sub4 Tracking tag sub4 max 255 characters, for tracker use only - not avaliable in statistics
sub5 Tracking tag sub5 max 255 characters, for tracker use only - not avaliable in statistics
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.
mobile Use 0 for desktop traffic and 1 for mobile traffic

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
id ID of the created order (if successful)
pin The lead's internal password for data clarification, you can ignore it.
url URL to access the personal account (autologin). If empty - no autologin used for the offer.
message An error message that can be shown to the customer.
error Error codes:
  • access-denied - you are not allowed to send leads, contact the administrator.
  • no-money - your account has been blocked due to lack of funds.
  • key - invalid API key, check settings in profile.
  • nooffer - no offer ID specified, you may be sending JSON without Content-type: application/json header.
  • no-api - the offer does not support work via the API. Probable error: the form on the landing page has a hidden offer field with an extraneous value.
  • nophone - phone is not specified, or its length is less than 6 or more than 15 characters.
  • phone - the specified phone did not pass validation.
  • email - the specified email did not pass validation.
  • duplicate - an order with such data is already in CRM
  • offer - the specified offer was not found.
  • security - your user is blocked, contact the administration.
  • ban - the customer's phone or IP address is blacklisted. The reason is shown in the info field.
  • traffic - the offer or site is not available to you. At the same time, the customer sees the error "The product is out of stock".
  • data - required fields are missing or incorrectly specified, the list of errors is shown in the bad field.
  • db - an internal error occurred while adding an order, please try sending again.
bad List of required fields that were not specified when submitting.
info The reason for blocking a lead for ban, access and traffic:
  • phone - blacklisted customer's phone.
  • bad-ip - the customer's IP address is incorrect.
  • ip - blacklisted customer's IP address.
  • filter - the customer's IP address has been blocked by the filtering system.
  • flood - the number of requests to send a lead has been exceeded.
  • geo and country - the country is not available in this offer.
  • offer - you do not have access to the private offer.
  • site - you do not have access to the private site.
  • search - traffic without specifying the source.

Function response example:

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

List orders

URL: https://gglead.net/api/comp/list.json?id={token}

Function shows the list of orders. Request parameters can be sent via both GET and POST.

You can use following parameters for order filtering:

Field Description
oid Internal order ID of GGLead or IDs list separated by comma
ids[] Array of internal IDs of GGLead.
eid Your CRM order ID or list of IDs separated by comma
eids[] Array of your CRM order IDs.
status Order status code:
  • 1 - processing order
  • 2 - order in hold stage
  • 3 - order is approved
  • 4 - order is cancelled by generic reason
  • 5 - order is cancelled as trash
from
to
Show orders between from and to time. Time is set as UNIX-timestamp. You can use both fields or just one of them. You can use it to load orders to your CRM, but the following field will suit you better.
after The ID of last order after which start listing. You should use this parameter to load orders to your CRM. Simply send the ID of the last received orders and the list will contain only the orders received after that one.

The result of the function is an array of elements with following fields:

Field Description
id Internal order ID of GGLead
ext Your CRM order ID
offer Offer ID from this list
wm Affiliate ID
stage Order status code for affiliate:
  • 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
phase Integer order status code for affiliate:
  • 1 - processing order
  • 2 - order in hold stage
  • 3 - order is approved
  • 4 - order is cancelled by generic reason
  • 5 - order is cancelled as trash
status Real order status code in CRM:
  • 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 Reason code for cancel status:
  • 1 – Incorrect phone (trash)
  • 2 – Changed his mind
  • 3 – Did not order (trash)
  • 4 – Requires certificate
  • 5 – Wrong GEO (trash)
  • 6 – Trash or test (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
  • 16 – Consultation
  • 17 – Cancelled by timer
  • 18 – Blacklist
  • 19 – Misslead or misstarget
check If set to 1 - order is suspicious.
site Landing URL where order was created
ip Customer IP address
time Time order was created, UNIX-timestamp
name Customer full name
gender Customer gender. 0 - unknown, 1 - male, 2 - female.
phone Customer phone, digits only
country Two-letter customer country ISO code
index ZIP postal 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
count Quantity of goods.
items Order contents. Array with item ID as the key, amount and unit price as value.
delivery Delivery service code.
discount Order discount in percent.
currency Three-letter currency ISO-code.
base Unit price in selected currency.
delpr Delivery price in selected currency.
more The amount of the extra cost of the order, for example, margins for express delivery.
price Order total price.
comment Order additional comments.

Function response example:

[
    {
        "id": 13131,
        "ext": 2424,
        "offer": 15,
        "offername": "Shiny test offer",
        "wm": 59,
        "stage": "approve",
        "phase": 3,
        "status": 8,
        "reason": 0,
        "check": 0,
        "site": 12,
        "siteurl": "land.cpa/test-offer",
        "space": 23,
        "spaceurl": "blog.cpa/test-space",
        "ip": "12.34.56.78",
        "time": 1757184922,
        "name": "John Doe",
        "gender": 0,
        "phone": "123456789000",
        "country": "ru",
        "index": "100000",
        "area": "",
        "city": "Moscow",
        "street": "Lenina street",
        "addr": "1",
        "comment": "Will pick up order in three days",
        "count": 6,
        "items": {
            "12": [ 3, 665 ],
            "23": [ 1, 665 ],
            "34": [ 2, 665 ]
        },
        "delivery": 1,
        "discount": 0,
        "currency": "rub",
        "base": "0.00",
        "more": "0.00",
        "delpr": "350.00",
        "price": "4340.00"
    }
]

Set order status

URL: https://gglead.net/api/comp/status.json?id={token}

Function changes order status and can set some order fields. Almost all the parameters can be sent via both GET and POST. Optimal for use in postbacks.

Function can use following input parameters:

Field Description
oid
eid
Order ID to work with. Use oid for internal order ID of GGLead or eid for your CRM order ID. Required field. GET only.
status Text representation of order status linked to st* parameters and recognized automatically:
  • Approve: a, accept, accepted, approve, approved, confirm, confirmed
  • Hold: h, hold, holding
  • Cancel: c, d, decline, declined, cancel, cancelled, canceled, reject, rejected
  • Trash: t, trash, error, wrong, bad
sta Order name to recognize as approve
stc Order name to recognize as cancel
stt Order name to recognize as trash
sth Order name to recognize as hold
stw Order name to recognize as processing order
name Customer full name
phone Customer phone, digits only
email Customer email
comment Order additional comments.
country Two-letter country ISO-code
currency Three-letter currency ISO-code
base Unit price or conversion cost in selected currency
count Quantity of goods
delpr Delivery price in selected currency

Order ID and status are required parameters, other fields are optional. 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
error Error code: orderid if order ID is missing, edit if no fields changed, access-denied if order ID is incorrect, request-error in case of internal error.

Successful response example:

{ "status" : "ok" }

Error response example:

{ "status" : "error", "error" : "access-denied" }

Edit order info

URL: https://gglead.net/api/comp/edit.json?id={token}

Function edits order info. Generally, all the parameters should be send via POST, but some of them can also can be sent via GET.

Function can use following input parameters:

Field Description
oid
eid
Order ID to work with. Use oid for internal order ID of GGLead or eid for your CRM order ID. Required field. Can be send via GET.
accept Order approve flag. Use it to approve the order instead of changing status. Can be send via GET.
status Order new status code. Can be send via GET.
  • 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
To cancel order use status 5 and reason field.
Important! To approve the order use accept=1, not status change!
reason Order cancel reason code required for status=5. Can be send via GET.
  • 1 – Incorrect phone (trash)
  • 2 – Changed his mind
  • 3 – Did not order (trash)
  • 4 – Requires certificate
  • 5 – Wrong GEO (trash)
  • 6 – Trash or test (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
  • 16 – Consultation
  • 17 – Cancelled by timer
  • 18 – Blacklist
  • 19 – Misslead or misstarget
check Security check flag. 1 - send to check, 0 - remove from check. Can be send via GET.
track Parcel tracking code. Can be send via GET.
name Customer full name
phone Customer phone, digits only
email Customer email
index ZIP postal 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
delivery Delivery service ID
base Unit price in selected currency
delpr Delivery price in selected currency
discount Order discount in percent. Number from 0 to 99.
count Quantity of goods.
items Order contents. Array with item ID as the key, amount and unit price as value. Your IDs you can get from our support tea. If you use items, you shouldn't send count.
more The amount of the extra cost of the order, for example, margins for express delivery. Added to total price after all the discounts.
comment Order additional comments.

Order ID is the only required field, other fields are optional. 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
error Error code: orderid if order ID not set, edit if no changes were required, access-denied if order ID is incorrect, request-error in case of internal error.

Successful response example:

{ "status" : "ok" }

Error response example:

{ "status" : "error", "error" : "access-denied" }

Order analytics

URL: https://gglead.net/api/comp/stats.json?id={token}

Function shows order statistics, groupped by the parameter specified. This function gives detailed statistics on the number of orders in each of the statuses.

Function can use following input parameters:

Field Description
item* Required. Parameter to group statistics by:
  • offer - offer ID
  • site - landing ID
  • space - prelanding ID
  • date - order date
  • hour - order hour
  • stage - processing stage
  • geo - country code
from Statistics start date like YYYY-MM-DD. By default, one week ago is used.
to Statistics end date like YYYY-MM-DD. By default, today is used.
offer Filter by offer ID.
site Filter by landing ID.
space Filter by prelanding ID.
stage Filter by stage ID (not stage name!).
status Filter by status.
hour Filter by hour.
geo Filter by country ISO code.

The result of the function is an associative array. Each element is identified by the ID of grouping field. Each item includes following fields:

Field Description
id Grouping field element ID
name Grouping field element name, if applicable
count Total number of orders
pay Total amount of paymens
app Percantage of applove without trash orders
apps Percantage of applove including trash orders
cash Distribution of number and total cash amount by currency. Associaive array, key is the currency ISO code, value is pair [ number of leads, cash ].
status Distribution of orders by status. Associaive array, key is the status code, value contains the following fields:
  • count - number of orders in this status
  • pay - payment amount for this status
  • cash - distribution of number and total cash amount by currency, as described in previous field.

Function response example:

{
    "20190801": {
        "id": 20190801, // Element ID
        "name": "2019-08-01" // Element name
        "count": 24, // Number of orders
        "pay": 11150, // Payment amount
        "app": 100, // Approve percentage
        "apps": 100, // Approve percentage including trash
        "cash": { // Distribution by currency
            "usd": [ // Currency ISO code
                23, // Number of orders
                40477 // Orders total
            ],
            "rub": [ 1, 13990 ]
        },
        "status": { // Distribution by status
            "6": { // Status ID
                "count": 24, // Number of orders
                "pay": 11150, // Payment amount
                "cash": { // Distribution by currency
                    "usd": [ 23, 40477 ],
                    "rub": [ 1, 13990 ]
                }
            }
        },
    },
}

Agency API-interface allow external CPA networks and affiliate teams to add new leads and to check leads processing status.

Add new lead

URL: https://gglead.net/api/ext/add.json?id={token}

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

The function accepts the following data about the lead:

Field Description
extu* Unique order ID on the side of the agency (required)
If you send auto in this field, ID will be generated automatically.
exts Agency affiliate or source ID
offer* Offer ID from this list (required)
ip* Customer IP-address (required)
name Customer full name or first name
last Customer last name
phone* Customer phone in international format including country code, digits only (required)
phonecc Phone country code in +7 format (optional). When specifying this parameter, the phone number in phone must still be passed with the country code.
email Customer email
ua Customer's browser User-Agent
country Two-letter ISO code of customer's country, if empty - discovered by the IP address.
currency Three-letter currency ISO code, like USD or EUR.
comment Lead comments.
utm_source UTM tag utm_source max 255 characters, useful for statistics
utm_campaign UTM tag utm_campaign max 255 characters, useful for statistics
utm_content UTM tag utm_content max 255 characters, useful for statistics
utm_term UTM tag utm_term max 255 characters, useful for statistics
utm_medium UTM tag utm_medium max 255 characters, useful for statistics
subid Tracking tag subid max 255 characters, for tracker use only - not avaliable in statistics
uuid Tracking tag uuid max 255 characters, for tracker use only - not avaliable in statistics
sub1 Tracking tag sub1 max 255 characters, for tracker use only - not avaliable in statistics
sub2 Tracking tag sub2 max 255 characters, for tracker use only - not avaliable in statistics
sub3 Tracking tag sub3 max 255 characters, for tracker use only - not avaliable in statistics
sub4 Tracking tag sub4 max 255 characters, for tracker use only - not avaliable in statistics
sub5 Tracking tag sub5 max 255 characters, for tracker use only - not avaliable in statistics
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.
mobile Use 0 for desktop traffic and 1 for mobile traffic

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
id ID of the created order (if successful)
uid External order ID from extu field
pin The lead's internal password for data clarification, you can ignore it.
url URL to access the personal account (autologin). If empty - no autologin used for the offer.
message An error message that can be shown to the customer.
error Error codes:
  • no-ext - you are trying to send a lead without being an agency. Use the webmaster function.
  • key - invalid API key, check settings in profile.
  • nooffer - no offer ID specified, you may be sending JSON without Content-type: application/json header.
  • no-api - the offer does not support work via the API. Probable error: the form on the landing page has a hidden offer field with an extraneous value.
  • noid - no order ID on your side sent.
  • nophone - phone is not specified, or its length is less than 6 or more than 15 characters.
  • phone - the specified phone did not pass validation.
  • email - the specified email did not pass validation.
  • duplicate - an order with such data is already in CRM
  • offer - the specified offer was not found.
  • security - your user is blocked, contact the administration.
  • ban - the customer's phone or IP address is blacklisted. The reason is shown in the info field.
  • traffic - the offer or site is not available to you. At the same time, the customer sees the error "The product is out of stock".
  • data - required fields are missing or incorrectly specified, the list of errors is shown in the bad field.
  • db - an internal error occurred while adding an order, please try sending again.
bad List of required fields that were not specified when submitting.
info The reason for blocking a lead for ban, access and traffic:
  • phone - blacklisted customer's phone.
  • bad-ip - the customer's IP address is incorrect.
  • ip - blacklisted customer's IP address.
  • filter - the customer's IP address has been blocked by the filtering system.
  • flood - the number of requests to send a lead has been exceeded.
  • geo and country - the country is not available in this offer.
  • offer - you do not have access to the private offer.
  • site - you do not have access to the private site.
  • search - traffic without specifying the source.

Function response example:

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

Check status

URL: https://gglead.net/api/ext/list.json?id={token}

Function shows the information about order processing status.

You can use following parameters for order filtering:

Field Description
ids A comma-separated list of your lead IDs. This specifies the identifier sent in the id field in the add request or received in the uid field in the response to this request (if the ID is automatically generated). No more than 100 pieces at a time is recommended.
oid Internal order ID of GGLead or comma-separated list of IDs. It is displayed in the id field when adding a lead. No more than 100 pieces at a time is recommended.
status Lead status code:
  • 1 - processing lead
  • 2 - lead in hold stage
  • 3 - lead is approved
  • 4 - lead is cancelled by generic reason
  • 5 - lead is cancelled as trash
from
to
Show orders between from and to dates. Date is set as YYYY-MM-DD. You can use both fields or just one of them.

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 Agency order ID
src Agency 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
phase Integer status code:
  • 1 - processing order
  • 2 - order in hold stage
  • 3 - order is approved
  • 4 - order is cancelled by generic reason
  • 5 - order is cancelled as trash
custom Original lead status text from advertiser's CRM (if available)
status Extended order status ID, available after support request only:
  • 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 – Trash or test (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
  • 16 – Consultation
  • 17 – Cancelled by timer
  • 18 – Blacklist
  • 19 – Misslead or misstarget
cash Payment for the order
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
  "phase": 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
  "phase": 3, // Status code
  "stage": "approve", // Stage code
  "count: 2, // Items amount
 }
]