Errors, Idempotency, and Retries
Errors use application/problem+json.
Example:
{
"type": "https://subnano.me/problems/validation",
"title": "Validation failed",
"status": 422,
"detail": "One or more fields are invalid",
"errors": [{ "field": "primaryCategoryId", "code": "required" }]
}
Common status codes
400bad request (invalid headers/body)401missing or invalid key403key not allowed for this action404endpoint/post not found409idempotency request still in flight413uploaded file too large422validation failed or idempotency payload mismatch429rate limit exceeded5xxtransient server errors
Idempotency behavior
Idempotency applies to:
POST /api/v1/posts/:id/publish
For the (api key, Idempotency-Key) tuple:
- First request claims and processes.
- Replay with same payload returns stored response.
- Replay with changed payload returns
422. - Replay while first request is processing returns
409. - Calling publish for an already-published post returns
200withpublishResult: "no_op_already_published"andstateChanged: false. - Retention window:
24 hours.
Retry guidance
- Retry transient failures with exponential backoff.
- Reuse the same
Idempotency-Keyfor retries of the exact same publish request. - Generate a new
Idempotency-Keywhen request payload changes. - For
409, wait and retry. - For
422, fix payload before retrying.