Errors and idempotency

Status codes, the error shape, and how to safely retry writes.

Error shape

Every error returns the same JSON shape:

{ "success": false, "message": "Missing or invalid API key" }

Status codes

codemeaning
200OK. Also returned for an idempotent duplicate (deduped: true).
201Created.
400Invalid request (missing or malformed field).
401Missing or invalid API key.
403The resource does not belong to your organization.
404Not found, or no attribution could be resolved.
409Conflict (e.g. an affiliate slug is already taken).
410Attribution window expired (the click is older than the program's window).
500Internal error. Safe to retry.

Idempotency

Writes that represent money are idempotent, so you can retry them without
double-counting.

  • Conversions are idempotent on external_id. A re-sent conversion returns
    the existing record with deduped: true instead of creating a new one. Always
    send a stable external_id (your order or invoice id).
  • Customers are idempotent on customer_id. A repeat call returns the
    existing customer with deduped: true.
  • Affiliates are idempotent per (email, program). Re-creating the same
    affiliate in the same program returns the existing membership.

Attribution failures

POST /api/conversions and POST /api/customers return 404 with
"No attribution found" when the referral cannot be resolved. Check that:

  • the cookie_id / ref / click_id you sent is the one PartnerBee issued, and
  • the affiliate link belongs to the same organization as the API key.

For recurring charges, attribute by customer_id only after the customer has
been tracked with POST /api/customers.


Did this page help you?