WatchCatAlterCPA
WatchCat / API

API documentation

Monitoring JSON interface: the change feed, offer catalog and search, private offers, offer and network subscriptions, per-network stats.

01 Intro & authentication

API requests go over HTTPS. The function base URL is https://cpaw.cat/api/cpaw/<func>.json. The format extension is mandatory (.json).

Parameters may be passed in GET or POST. The response is always JSON in UTF-8, and the HTTP response status is always 200.

Placeholder parameters are shown in curly braces throughout: {id} — the auth string, {offer} — an offer ID, {network} — a network ID. In real requests do not use the curly braces — only the values themselves.

Authentication

The key is passed in the id parameter as <userid>-<key>:

GEThttps://cpaw.cat/api/cpaw/feed.json?id=1234-a1b2c3d4e5f6g7h8i9j0klmnopqrstuv&feed=all
  • <userid> — your numeric user ID;
  • <key> — your personal API key.
Warning! Never share your API key or enter it into third-party services — with this key, anyone can access all of your private information stored in the service.
Back to contents

02 Response format

A successful response has status: ok and the payload in data:

{
    "status": "ok",
    "data": { "...": "..." }
}

The offers function additionally returns a navigation block nav alongside it — its fields are described in that section. The others return everything at once, with no pagination.

Back to contents

03 Error handling

On error the response has status: error and an error field with the error code:

{
    "status": "error",
    "error": "auth"
}

Common error codes:

  • auth — the API key is invalid;
  • ban — the user is banned;
  • access — access to the requested resource is denied;
  • request — malformed request (e.g. the format extension is missing);
  • not-found — the requested object was not found.

Each function may also return its own error codes, described in its section.

Back to contents

04 Event types

Event type IDs are used in the requests and responses of the feed and offer functions:

IDEventIDEvent
1New offer9Price changed
2Offer disabled10Payout changed
3Offer enabled11Upsell changed
4New goal12Cross-sell changed
5Goal disabled13Percentage changed
6Goal enabled14Currency changed
7Type changed15Offer name changed
8Hold changed16Goal name changed
Back to contents

05 feed — Update feed

GET · POSThttps://cpaw.cat/api/cpaw/feed.json?id={id}&feed=all

Returns feed events for the given period. Up to 1000 events per response, sorted newest first (by descending id).

Parameters

FieldDescription
feedFeed type: all — every public event; offer — my offers; subs — my subscriptions. Default — my monitoring (my offers + my subscriptions).
fromStart of range: date YYYY-MM-DD or Unix Timestamp.
toEnd of range: date YYYY-MM-DD or Unix Timestamp.
afterThe ID of the last change after which to start the export.
searchAn offer URL in the affiliate network to search by.
networkAffiliate network ID.
offerOffer ID on the WatchCat side.
goalGoal ID on the WatchCat side.
typeAn event type ID.
For regular export into your own system, use after instead of dates. After each pull, save the largest change id (always first in the list) and pass it in after on the next request.

Response

The data field is an array of events (the feed is time-ordered). Fields of each event:

FieldDescription
idChange ID.
timeEvent time, Unix Timestamp.
tidEvent type, number.
nidNetwork ID.
oidOffer ID.
gidGoal ID (0 if the event isn't about a goal).
dateEvent date, YYYY-MM-DD HH:MM:SS.
typeEvent type name.
networkNetwork name.
offerOffer name.
goalGoal name or false.
valueNew value or false.
oldOld value or false.
urlOffer URL on WatchCat.
mytrue for a personal offer, false for public.
{
    "status": "ok",
    "data": [
        {
            "id": 35400, "time": 1573291851, "tid": 4,
            "nid": 16, "oid": 6113, "gid": 19304,
            "date": "2019-11-09 09:30:51", "type": "New goal",
            "network": "Admitad", "offer": "Edadeal [CPI, Android] RU",
            "goal": "Install on Android",
            "value": false, "old": false,
            "url": "https://cpaw.cat/offer/6113", "my": false
        }
    ]
}
Back to contents

06 network — Networks list

GET · POSThttps://cpaw.cat/api/cpaw/network.json?id={id}

Lists the networks available to work with. No input parameters. data is an object keyed by network ID; each value has:

FieldDescription
idNetwork ID.
nameName.
domainThe domain used to recognize offer links.
privateThe network is private, VIP-only. Present for VIP users only.
offerThe network supports adding your own private offers.
favFeatured network (shown on the dashboard).
prioSort priority (networks ordered by prio desc, then by name).
geoNetwork geo: { code: name } — the union of the geos of the network's active public offers. Empty ([]) until the network's first crawl.
authsThe credentials required (only when offer = true): login/pass — account login and password, user — the API user ID, api/key — the public and secret keys.
subscribedWhether the current user is subscribed to this network's changes.
levelSubscription level: 0 — not subscribed, 1 — new offers only, 2 — any changes.
{
    "status": "ok",
    "data": {
        "2": {
            "id": 2, "name": "Admitad", "domain": "www.admitad.com",
            "offer": true, "fav": true, "prio": 100,
            "geo": { "ru": "Russia", "de": "Germany" },
            "auths": [ "user", "key" ],
            "subscribed": true, "level": 2
        }
    }
}
Back to contents

07 offers — Offer list & search

GET · POSThttps://cpaw.cat/api/cpaw/offers.json?id={id}

Lists offers: the global catalog, private offers, subscriptions. Search by URL, name, or similar offers.

Parameters

FieldDescription
filtermy — my offers; public — public; subs — my subscriptions. Default — mine + public.
likeAn offer ID to find similar offers for (by the name's keywords). If set, search is ignored.
searchAn offer name (full-text search) or its URL in the affiliate network.
geoOffer geo: one or more two-letter ISO country codes separated by space, dash or comma.
activeActivity: 0 — disabled, 1 — active.
networkNetwork ID.
showOffers per page, 10–1000, default 500.
offsetStart position of the slice (0, 500, 1000, …).
pageList page when offset is not given (default 1).

Response

The data field is an object of offers (keyed by offer ID), with a navigation block nav alongside it for pagination:

nav fieldDescription
totaltotal records found
pagecurrent page
pagestotal pages
showrecords per page
offsetstart position of the slice in the full list

Offer fields:

FieldDescription
idOffer ID.
activeOffer is active.
nameOffer name.
infoOffer URL on WatchCat.
nidNetwork ID.
networkNetwork name.
urlOffer URL in the affiliate network.
addWhether the offer can be added as a private one.
timeTime of the last change, Unix.
dateDate of the last change.
firstFirst time the offer was seen, Unix.
subWhether the user is subscribed to the offer.
nowInstant notification for the subscription (otherwise it goes to the digest).
goalNumber of active goals.
goalsTotal goals.
geoOffer geo: { code: name }.
privatefalse for a public offer, or the private-offer object: period, plus login/pass/user/api/key (decrypted, where present).
{
    "status": "ok",
    "data": {
        "2861": {
            "id": 2861, "active": true, "name": "AB Gymnic belt",
            "info": "https://cpaw.cat/offer/2861", "nid": 6, "network": "M1 Shop",
            "url": "http://m1-shop.ru/myoffers/add/453", "add": true,
            "time": 1571411245, "date": "2019-10-18 15:07:25", "first": 1571411245,
            "sub": true, "now": false, "goal": 3, "goals": 5,
            "geo": { "ru": "Russia", "ua": "Ukraine" },
            "private": false
        }
    },
    "nav": { "total": 100, "page": 1, "pages": 1, "show": 500, "offset": 0 }
}
Back to contents

08 offer — Offer details

GET · POSThttps://cpaw.cat/api/cpaw/offer.json?id={id}&offer={offer}

Shows everything about a single offer. Locate the offer three ways:

  • by offer — the offer ID on the WatchCat side (the only way for a private offer);
  • by url — the offer URL in the affiliate network (public only);
  • by network + uid — the network ID and the offer ID on its side (public only).
Param rename: the offer ID is read from the offer parameter (in the legacy API it was id; now id is taken for auth).

Parameters

FieldDescription
offerOffer ID on WatchCat.
urlOffer URL in the affiliate network (public offers only).
networkNetwork ID (with uid, public only).
uidOffer ID on the network's side (with network).

If the offer isn't found — error not-found. On success data holds the offer fields (the same as in offers), plus:

FieldDescription
goalsTotal offer goals.
goalactiveNumber of active goals (in the offers list this field is called goal).
goalAn object of goals, keyed by goal ID (fields below).
changeAn array of offer changes (fields below).

Goal fields (goal):

FieldDescription
idGoal ID.
activeGoal is active.
nameGoal name.
typeModel: CPS/CPL/CPA/CoD/CPC/RS.
codeGoal code in the network.
geoISO geo code of the goal.
priceLanding price.
cashBase payout or its lower bound.
upUpsell / upper bound.
crossCross-sell.
percentPercentage.
currencyCurrency or false.

Change fields (change): id, time, tid, gid, date, type, goal, value, old (see feed).

{
    "status": "ok",
    "data": {
        "id": 2874, "active": true, "name": "Detoxic - anti-parasite remedy",
        "info": "https://cpaw.cat/offer/2874", "nid": 6, "network": "M1 Shop",
        "url": "http://m1-shop.ru/myoffers/add/897", "add": true,
        "time": 1571432786, "date": "2019-10-18 21:06:26", "first": 1571429261,
        "sub": true, "now": false,
        "private": false, "goals": 1, "goalactive": 1,
        "geo": { "tj": "Tajikistan" },
        "goal": {
            "11419": {
                "id": 11419, "active": true, "name": "Tajikistan", "type": "CPS",
                "code": "tj", "geo": "tj", "price": 200, "cash": 350,
                "up": 0, "cross": 0, "percent": 0, "currency": "rub"
            }
        },
        "change": [
            { "id": 24201, "time": 1571432786, "tid": 4, "gid": 11419,
              "date": "2019-10-18 21:06:26", "type": "New goal",
              "goal": "Tajikistan", "value": false, "old": false }
        ]
    }
}
Back to contents

09 stat — Per-network stats

GET · POSThttps://cpaw.cat/api/cpaw/stat.json?id={id}

Aggregates for each public network. No input parameters. data holds:

  • nets — an array of networks with fields id, name, url (catalog filtered by this network), nomy (the network does not support adding your own offers), domain, offer (offers), goal (goals), change (changes);
  • total — grand totals: networks, offers, goals, changes.
{
    "status": "ok",
    "data": {
        "nets": [
            {
                "id": 2, "name": "Admitad",
                "url": "https://cpaw.cat/offers?n=2", "nomy": true,
                "domain": "www.admitad.com", "offer": 5820, "goal": 14310, "change": 92034
            }
        ],
        "total": { "networks": 48, "offers": 99358, "goals": 229257, "changes": 3293186 }
    }
}
Back to contents

10 daily — Daily stats

GET · POSThttps://cpaw.cat/api/cpaw/daily.json?id={id}

Global counters. No input parameters. data:

FieldDescription
netTotal working networks.
netsOf those, public networks.
offerTotal offers.
offersOffers added in the last 24 hours.
goalTotal goals.
goalsGoals added in the last 24 hours.
changeTotal changes.
changesChanges in the last 24 hours.
{
    "status": "ok",
    "data": {
        "net": 48, "nets": 47,
        "offer": 99358, "offers": 42,
        "goal": 229257, "goals": 118,
        "change": 3293186, "changes": 1204
    }
}
Back to contents

11 add — Add a private offer

POSThttps://cpaw.cat/api/cpaw/add.json?id={id}

Creates a private offer and enables its once-a-day check. The source offer is given one of three ways.

Parameters

FieldDescription
offerAn existing public WatchCat offer (first way).
urlThe offer URL in the affiliate network (second way).
network + uidThe network ID and the offer ID on its side (third way).
login, pass, user, api, keyNetwork credentials. The exact set of fields comes from the networks list (the auths field).
This function makes a live request to the affiliate network at call time — the response may take a noticeable while.

On success data holds the id of the added offer (needed for edit / del).

Error codes: not-found — offer/network not found; no-private — the network doesn't support own offers; bad-auth — the network rejected the credentials; error — save failed.

{ "status": "ok", "data": { "id": 1234 } }
Back to contents

12 edit — Configure a private offer

POSThttps://cpaw.cat/api/cpaw/edit.json?id={id}&offer={offer}

Changes the credentials and check frequency. Send only the fields you want to change; only offer is required.

Parameters

FieldDescription
offer*The offer ID on the WatchCat side (required).
periodCheck period in minutes: 1440 — once a day (optimal), 720 — twice a day, 360 — every 6 hours, 180 — every 3 hours, 120 — every 2 hours, 60 — hourly; VIP also gets 30 and 10.
login, pass, user, api, keyCredentials (only fields already set on the offer are updated).

On success data holds id and changed — the fields actually changed (empty if a field already had the desired value).

Error codes: bad-idoffer not given; access — the offer isn't yours; edit — save failed.

{ "status": "ok", "data": { "id": 1234, "changed": [ "api" ] } }
Back to contents

13 del — Delete a private offer

POSThttps://cpaw.cat/api/cpaw/del.json?id={id}&offer={offer}

Deletes a previously added private offer and its entire check history.

Parameters

FieldDescription
offer*The offer ID on the WatchCat side (required).

Error codes: bad-idoffer not given; access — the offer isn't yours.

{ "status": "ok", "data": { "id": 1234 } }
Back to contents

14 sub — Subscribe to an offer

POSThttps://cpaw.cat/api/cpaw/sub.json?id={id}&offer={offer}

Adds a subscription to a public offer. Idempotent: a repeat call doesn't create a duplicate, but lets you toggle the instant-notification flag.

Parameters

FieldDescription
offer*The public offer ID (required).
nowInstant notification: 1 — notify immediately, 0 — include in the digest. If omitted: 0 on a new subscription, unchanged on an existing one.

On success data holds id and the current value of the now flag.

Error codes: bad-idoffer not given; access — the offer is private or the network is unavailable.

{ "status": "ok", "data": { "id": 1234, "now": 1 } }
Back to contents

15 unsub — Unsubscribe from an offer

POSThttps://cpaw.cat/api/cpaw/unsub.json?id={id}&offer={offer}

Removes a subscription to a public offer.

Parameters

FieldDescription
offer*The offer ID (required).

Error codes: bad-idoffer not given; access — the offer is private or the network is unavailable.

{ "status": "ok", "data": { "id": 1234 } }
Back to contents

16 nwsub — Subscribe to a network

POSThttps://cpaw.cat/api/cpaw/nwsub.json?id={id}&network={network}

Adds a subscription to a whole affiliate network. Idempotent: a repeat call doesn't create a duplicate, but lets you change the subscription level.

Parameters

FieldDescription
network*The network ID (required).
levelSubscription level: 1 — new offers only, 2 — any changes. Default 1.

On success data holds the network id and the current level.

Error codes: bad-idnetwork not given; access — the network is unavailable (a private network for a non-VIP user).

{ "status": "ok", "data": { "id": 2, "level": 2 } }
Back to contents

17 nwunsub — Unsubscribe from a network

POSThttps://cpaw.cat/api/cpaw/nwunsub.json?id={id}&network={network}

Removes a network subscription. Always allowed (including when the network has become private).

Parameters

FieldDescription
network*The network ID (required).

Error codes: bad-idnetwork not given.

{ "status": "ok", "data": { "id": 2 } }
Back to contents