HTTP status codes
| Code | Meaning | When |
|---|---|---|
200 | Success | GET requests, idempotent retries |
201 | Created | POST that creates a resource |
400 | Bad request | Malformed JSON, missing required fields |
401 | Unauthorized | Invalid or expired JWT |
403 | Forbidden | Insufficient scopes/permissions |
404 | Not found | Resource doesn’t exist or not in your environment |
409 | Conflict | Duplicate idempotency key, invalid state transition |
422 | Validation error | Valid JSON but business rule violated |
Error response format
All errors return a consistent structure:Idempotency
Settlement creation is idempotent viaidempotency_key. If you send the same key:
- First call: creates the settlement (201)
- Subsequent calls: returns the existing settlement (200)
Retrying failed requests
| Scenario | Retry? | Strategy |
|---|---|---|
| Network timeout | Yes | Retry with same idempotency key |
| 5xx server error | Yes | Exponential backoff |
| 401 Unauthorized | Yes | Refresh token first, then retry |
| 400/422 Validation | No | Fix the request |
| 409 Conflict | No | Check current state, decide next action |
| 404 Not Found | No | Verify the resource ID |
Settlement-specific errors
Compliance decision on wrong state
Confirm/reject on non-cross-platform settlement
settlement_type: "cross_platform" support the confirm/reject endpoints.
Template validation failures
required_roles or required_leg_types.
Webhook error handling
If your webhook endpoint returns a non-2xx response:- KeyStone retries with exponential backoff
- Failed deliveries are logged in the delivery log
- The settlement continues regardless (webhooks are notifications, not blocking)