Requests and responses
The API is plain REST over HTTPS with JSON. This page covers what is the same on every endpoint.
Requests
- Reading is
GET, with filters in the query string. - Creating is
POSTand changing isPATCH, with a JSON body andContent-Type: application/json. APATCHonly changes the fields you send.
curl -X PATCH "https://YOUR-NETWORK-DOMAIN/api/v1/offers/123" \
-H "Authorization: Bearer $LINKNETIK_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Summer sale (EU)"}'
Responses
Success always has the result in data. Lists and reports add meta:
{
"data": [ … ],
"meta": { "page": 1, "per_page": 50, "total": 132 }
}
A failure has no data. It has errors, a list with a stable code, a readable message and, for a bad input, the field at fault:
{
"errors": [
{ "code": "invalid_group_by", "message": "group_by must be one of: day,offer,affiliate,country", "field": "group_by" }
]
}
Branch on the HTTP status and on code, never on the text of message. See Errors.
Paging
| Parameter | Meaning |
|---|---|
page | Page number, from 1. Default 1. |
per_page | Rows per page. Default 50, at most 200. A larger value is cut to 200. |
meta.total is the number of rows that match, across all pages. You have read everything when page × per_page reaches it.
Dates
Reports and the click and conversion lists take date_from and date_to as YYYY-MM-DD. Both days are included in full. Leave them out and you get the last 30 days; the answer repeats the range it used in meta.date_from and meta.date_to.
The click list is the exception: clicks are many, so without dates it covers yesterday and today.
Days are counted in the time zone of the network's instance.
Ids and lookups
Records refer to each other by id: status_id, country_id, currency_id. The Reference endpoints return what each id means, need no scope and rarely change, so read them once and keep them:
curl "https://YOUR-NETWORK-DOMAIN/api/v1/reference/statuses" \
-H "Authorization: Bearer $LINKNETIK_KEY"
Whose data you get
A Network key sees the whole instance. An affiliate or advertiser key sees its own account only, on every endpoint, whatever its scopes:
- An affiliate key gets the offers that affiliate is approved on and that affiliate's own clicks and conversions.
- An advertiser key gets that advertiser's own offers and the traffic on them.
Asking for a record that belongs to someone else answers 404, the same as a record that does not exist.
Companies on the other side of an offer come back with id, company_name, country_id and status_id only. Contact details stay with the network.
Money fields
Two amounts sit on every conversion:
| Field | What it is | Network key | Affiliate key | Advertiser key |
|---|---|---|---|---|
revenue | What the advertiser pays the network | yes | never | yes |
payout | What the network pays the affiliate | yes | yes | never |
The field you do not get is left out of the answer, not sent as zero. epc in the general stats is worked out from payout, so advertiser keys do not get it either. The same rule applies to webhook payloads.