> For the complete documentation index, see [llms.txt](https://ctracker-docs.keywordrush.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ctracker-docs.keywordrush.com/for-developers/rest-api.md).

# REST API

For developers. Everything else in this guide needs no code.

Cashback Tracker's admin screens are React, and they talk to the site over a REST namespace. That namespace is available to your own code too.

### Namespace

```
/wp-json/cbtrkr/v1/
```

### Authentication

Every route requires the **`manage_options`** capability — administrator, in practice.

There is no public or member-facing part of this namespace. A member's own data reaches them through the account page, not through here.

From the admin screens, WordPress's cookie authentication and REST nonce apply, exactly as for core routes. From outside WordPress, use whatever your site already uses for authenticated REST — application passwords, for example.

{% hint style="warning" %}
These routes read and write money. Anything holding credentials for them holds the ability to change member balances — treat them as you would admin credentials, because that is what they are.
{% endhint %}

### What is available

Grouped by what they are for. Each supports the usual `page` and `per_page` where a list is returned.

**Shops**

```
GET    /advertisers                          the catalog
GET    /advertisers/{module}/{advertiser}     one shop
POST   /advertisers/sync                      refresh shops
GET|POST|DELETE /advertisers/pages            bulk page creation
GET|POST|DELETE /advertisers/logos            bulk logo fetching
POST   /advertisers/{module}/{advertiser}/page   create one page
POST   /advertisers/{module}/{advertiser}/logo   fetch one logo
```

**Members and money**

```
GET    /ledger/members                        balances per member
GET    /ledger/entries                        one member's ledger
POST   /ledger/adjustments                    credit or debit a member
POST   /ledger/entries/{id}/reverse           reverse an entry
```

**Networks**

```
GET    /networks                              every network and its state
POST   /networks/{id}                         update a custom network
GET    /networks/{id}/postbacks               recent postbacks received
POST   /networks/{id}/postback/test           send a test postback
```

**Coupons**

```
GET    /coupons                               list
POST   /coupons/{id}                          update
POST   /coupons/{id}/revert                   undo an AI rewrite
POST   /coupons/refresh                       re-import
```

**AI**

```
POST   /ai/shop/{id}                          generate for one shop
POST   /ai/coupon/{id}                        rewrite one coupon
POST   /ai/bulk                               start a bulk run
```

**Other**

```
GET    /logs                                  the plugin log
GET    /lookup/users|advertisers|pages        typeahead lookups
```

Orders, payouts, referrals and the overview have their own routes on the same namespace.

### The postback endpoint is separate

Postbacks do **not** live here. They have their own endpoint, their own authentication, and they are off unless you switch them on.

See [Postbacks](/affiliate-networks/postbacks.md).

### Errors

Failures come back as normal WordPress REST errors — an HTTP status with a `code` and a `message`. The codes are stable enough to branch on; the messages are written for people and may be reworded between versions.

A refusal that is a *rule* rather than a fault uses a specific code — trying to reverse a payout, for instance, answers `409` with `cbtrkr_reverse_payout` rather than a generic failure.

### A word of caution

This namespace exists to serve the admin screens. It is not a versioned public contract: routes may change between plugin versions, and shapes may gain fields.

For anything you intend to keep working, prefer the hooks — they are the stable extension surface. See [Events and hooks](/for-developers/events-and-hooks.md).

### Related

* [Events and hooks](/for-developers/events-and-hooks.md)
* [Postbacks](/affiliate-networks/postbacks.md)
* [Template reference](/for-developers/template-reference.md)
