Skip to navigation

Customer Portal ingestion

Push merchants, businesses, contacts and invoices into the portal your customers sign in to.

The Customer Portal API is the same in v1 and v2. Set PORTAL_HOST to the Customer Portal API domain assigned to your integration.

Authenticate

Your platform receives a Customer Portal API key. Keep it on a trusted server and never ship it in a browser or mobile app.

1

Exchange the key for an access token

The API key is accepted only by this endpoint.

curl -X POST "https://$PORTAL_HOST/api/v1/access-token" \
-H "Authorization: Bearer $PORTAL_API_KEY"
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"tokenType": "Bearer",
"expiresIn": 1800,
"expiresAt": 1717852800000
}
2

Send the token on every other call

curl "https://$PORTAL_HOST/api/v1/ping" \
-H "Authorization: Bearer $TOKEN"
{ "message": "pong" }

When the token expires, exchange the API key again. If your platform has an IP allowlist, an exchange from any other address returns 401.

Send records

Each record type has one create-or-update endpoint.

RecordCreate or updateRead
MerchantPOST /api/v1/onboard/merchantGET /api/v1/onboard/merchant/{id}
BusinessPOST /api/v1/businessGET /api/v1/business/{id}
ContactPOST /api/v1/contactGET /api/v1/contact/{id}
InvoicePOST /api/v1/invoiceGET /api/v1/invoice/{id}

{id} is the record’s id, a UUID, or your own externalId.

Create the merchant first. An invoice names its merchant by id or externalId and is addressed to exactly one of recipientContact or recipientBusiness. To attach documents to an invoice, send multipart/form-data with the invoice JSON in a data field and the files in files.

curl -X POST "https://$PORTAL_HOST/api/v1/onboard/merchant" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "externalId": "merchant_123", "name": "Acme Supply" }'

The record comes back under data.

Retry safely

Send your own externalId on every record. Sending the same externalId again updates that record instead of creating another, so you can retry a JSON request. Without an externalId, a retry can create a duplicate.

externalId deduplicates the invoice, not its files. Every multipart request stores its files as new attachments, so resending the same files adds them again. Invoice reads do not list attachments, so you cannot check for them through this API. Send field updates as JSON, and resend files only when you know the earlier upload did not succeed.

Errors

Errors carry a JSON body with an error message. Validation failures add a details array. Branch on the HTTP status, not on the message.

StatusMeaningWhat to do
400The body failed validation.Fix the fields named in details.
401The key or token is missing, invalid or expired.Exchange the API key again.
404No record with that id or externalId on your platform.Check the identifier.
409Another record already holds a unique value.Read the existing record.
429Too many requests.Wait the seconds in RateLimit-Reset, then retry.
500Unexpected error.Retry with backoff.