api_version envelope, while others return the error fields at the top level.
Error response formats
Envelope format
Some responses includeapi_version and an error object.
Flat format
Other responses returncode and message at the top level.
Check the API reference for the exact error shape per endpoint.
Common status codes
| Status | Meaning | Typical action |
|---|---|---|
| 400 | Bad request | Validate request payloads and required fields. |
| 401 | Unauthorized | Confirm X-SFPY-AGGREGATOR-SECRET-KEY and environment. |
| 404 | Not found | Verify the resource ID exists and belongs to your aggregator. |
| 409 | Conflict | Retry with a new idempotency key or resolve duplicate creation. |
| 500 | Internal error | Retry with backoff and contact support if persistent. |
Handling errors safely
- Use
request_idfor idempotent create calls and reuse it only when retrying the same payload. - Log
code,message, and the HTTP status for support escalations. - Prefer webhooks as the source of truth for asynchronous workflows.