API and webhooks
Errors, limits and pagination
What the API sends back when something goes wrong, and how much a list returns.
Status codes
| Status | Means |
|---|---|
200 | It worked. Products, prices and discounts return 200 whether the call created or updated the record. |
201 | A new record was created: a checkout session, a webhook endpoint, a new link, a first-time affiliate sale. |
202 | You reported an affiliate refund, credit or dispute before its sale; Plandalf applies it once you report the sale. |
401 | No credential, or one that isn't valid. See Authentication. |
403 | The credential is valid but can't do this, for example a site-connection token calling an endpoint outside its scope. |
404 | The record doesn't exist, or it belongs to another organization. |
422 | The request didn't pass validation. |
Error bodies
Validation errors (422) list each field's problems:
{
"message": "The amount cents field is required.",
"errors": {
"amount_cents": ["The amount cents field is required."]
}
}
A missing record, or a rule that spans several fields, returns a short error instead:
{ "error": "Discount not found" }
Authentication failures add "code": "UNAUTHORIZED".
Create or update
The POST endpoints for products, prices, discounts and links are upserts. Each matches an existing record by a key you choose (lookup_key, code, or the link's price and external object), so you can send the same call whenever the record changes in your system without making duplicates. Each resource's page says what it matches on.
Pagination and list sizes
Only GET /api/v1/checkouts pages. It returns 15 sessions by default; set per_page to change that. Follow next_page_url, or pass next_cursor as cursor, until it's null.
curl "https://admin.plandalf.dev/api/v1/checkouts?per_page=50&cursor=$NEXT_CURSOR" \
-H "Authorization: Bearer $PLANDALF_API_KEY"
Other lists return everything up to a cap, newest first unless noted:
| List | Returns at most |
|---|---|
GET /api/v1/offers | 200 offers |
GET /api/v1/prices | 100 prices |
GET /api/v1/links | 500 links, in creation order |
Use their filters to narrow a long list.
Rate limits
The API has no rate limit today. Keep to what you need: cache the catalog rather than fetching it on every page view.
Test mode
Test and live keys reach the same records. A key's mode decides which webhook events its endpoints receive. See Webhooks.