API conventions
Tenant namespace, formats, errors, pagination, and idempotency.
API conventions
Base and namespace
Examples start from:
https://crm.lacrypta.ar/api/organizations/{organizationSlug}Public operations for an Event also use this namespace. Do not replace the slug with an ID or rely on tenant headers supplied by a client.
Formats
- JSON uses
Content-Type: application/json. - Dates and times use ISO 8601; interpret timestamps without an offset as UTC only when the schema says so.
- Fields ending in
_satsare integer satoshi amounts. - Slugs are lowercase and stable; entity IDs are usually UUIDs.
- Omitting a field and sending it as
nullcan have different effects in a partial update.
Responses and errors
A 2xx response confirms that the HTTP operation completed; later work such as message delivery or payment reconciliation may continue asynchronously.
Errors commonly include:
{
"error": "machine_readable_code",
"detail": "Optional human context"
}Use the HTTP status first, then error. Do not depend on translated text. Each operation’s reference identifies additional fields such as conflict, pagination, or per-recipient results.
| Status | General meaning |
|---|---|
400 | Invalid JSON, parameters, or transition |
401 | No valid session or credential |
403 | Invalid origin/CSRF or explicitly forbidden action |
404 | Resource is not visible in the current tenant and role |
409 | Identity, capacity, state, or uniqueness conflict |
422 | Syntactically valid data that cannot be processed |
429 | Rate limit; honor Retry-After when present |
500/503 | Temporary service or provider failure |
Pagination
Three contracts are common:
page+page_size, withtotal,page, andpage_size.limit+offset, withtotal,limit, andoffset.page+limit, with apaginationobject.
Do not interchange styles between endpoints. Apply maximum limits and filters exactly as shown in the OpenAPI reference.
Idempotency and retries
- Reads are safe to retry.
- Payment and settlement flows protect against double application, but clients should retain the original order or invoice identifier.
- Confirmation and check-in return states such as
already_*when a repeat is safe. - For bulk sends, read the state before repeating: a disconnect does not mean no message was sent.
- Never automatically retry
DELETE, transfers, or destructive resets without checking current state.
Cache and real time
SSE events are signals to update the interface, not a definitive ledger. When one arrives, read the corresponding resource again. See Real-time updates with SSE.