Migrate from the legacy API
The legacy api.agentpaid.io API keeps working while you move, and won’t change in ways that break your integration. New resources and dated versions ship on https://api.paid.ai/v1. This guide lists what changes when you move an integration across.
Prerequisites
- Have your API key ready. The same key works on both hosts.
- If your network allowlists outbound domains, add
api.paid.ai.
Change the base URL
Replace the legacy base URL with the new one. The /api/ segment is gone, and the path version is /v1.
Resources move to /v1 as they are released. Until a resource appears in the API reference, keep calling it on the legacy host. The two hosts share the same account and data, so you can move one resource at a time.
Pin a version
Requests to /v1 use your account’s pinned dated version. Send Paid-Version on every request to make your integration independent of the pin:
Update error handling
Legacy errors are a flat object. On /v1, every error is a standard object under error, with a stable type and code:
- Branch on
error.typefor the category anderror.codefor the specific case. Codes are lowercase. error.paramnames the field or header at fault, when there is one.error.requestIdmatches theRequest-Idresponse header. Include it when contacting support.
Use betas instead of experimental resources
Legacy resources with -experimental in their names have no -experimental twin on /v1. Early access uses the Paid-Beta header instead, so the resource keeps its final name. See Use a beta.
Retry safely
POST and PATCH requests on /v1 accept an Idempotency-Key header: 1 to 255 printable ASCII characters, with no spaces. Retrying with the same key and body within 24 hours returns the original response, marked with Idempotent-Replayed: true, instead of repeating the operation.
Move customers
The customers resource on /v1 is in the customers=v1 private beta. Send Paid-Beta: customers=v1 on every customer request.
- One path for both IDs.
/v1/customers/{customer}takes thecus_ID, yourexternalId, or an alias, so the/external/{externalId}routes have no/v1equivalent. - Update is
PATCH. It changes only the fields you send. Sendnullto clear a field. - Archive, don’t delete.
POST /v1/customers/{customer}/archivereplacesDELETE. It fails withcustomer_has_active_orderswhile the customer has an open order. - Cursor pagination. Lists return
{ object: "list", data, hasMore, nextCursor }. SendnextCursorback ascursorinstead of anoffset.