Appearance
Errors
Every HTTP error is an RFC 9457 problem document with Content-Type: application/problem+json. Internal details never leave the server.
json
{
"type": "https://api.plemuz.com/errors/wallet-insufficient-funds",
"title": "Your balance is too low for this",
"status": 422,
"code": "WALLET_INSUFFICIENT_FUNDS",
"instance": "/v1/wallet/transfers",
"requestId": "0192f6c4-7a1e-7c3b-9d0f-2b6a1e4c8d10",
"retryable": false,
"actions": [
{ "kind": "top_up", "label": "Top up", "deepLink": "https://spread.plemuz.com/wallet/top-up" }
]
}Fields
| Field | Always | Meaning |
|---|---|---|
type | yes | https://api.plemuz.com/errors/<code-in-kebab-case>. |
title | yes | A calm, specific sentence, safe to show to people as is. It may be reworded or translated; never parse it. |
status | yes | The HTTP status, repeated. |
code | yes | The stable contract, DOMAIN_REASON (for example PLAYBACK_LEASE_STALE). A published code keeps its meaning. Branch on this. |
instance | yes | The request path. |
requestId | yes | Matches X-Request-Id and meta.requestId. Include it in support tickets. |
retryable | yes | true means the same request, unchanged, may succeed later. |
actions | no | Next steps the person can take. See below. |
errors | no | Field errors for validation: [{ path, code, message }]. |
detail | no | Extra context for developers. Don't show it to end users. |
remedy | no | A short hint for refusals that have an answer. |
Next actions
actions turns a refusal into a way forward. Render each as a button with its label; open deepLink when present. Call-site actions come first, then the code's defaults, with no duplicate kinds.
ts
interface NextAction {
kind: NextActionKind;
label: string; // Show as is
deepLink?: string; // Opens the exact screen, see Deep links
retryAfterSeconds?: number; // For retry and wait
}kind | Meaning |
|---|---|
retry | Try the same request again, after retryAfterSeconds if given. |
wait | Nothing to do now; try later. |
sign_in | Sign in or sign in again. |
verify_email | Confirm the email address. |
verify_phone | Confirm the phone number. |
verify_identity | Complete KYC (BVN or ID document). |
subscribe | Choose a plan. |
start_trial | Start the free trial. |
top_up | Add money to the wallet. |
update_payment_method | Fix the card or payment method on file. |
update_app | This app version can't do this; update. |
complete_profile | Fill in missing profile details. |
contact_support | Only support can help. |
open | Open the screen in deepLink. |
Unknown kinds may be added. Show their label with deepLink if present, and ignore them otherwise.
Common codes
| Code | Status | Retryable |
|---|---|---|
VALIDATION_FAILED | 400 | no (see errors) |
UNAUTHENTICATED | 401 | no |
AUTH_TOKEN_EXPIRED | 401 | yes, after refresh |
FORBIDDEN, ACCESS_DENIED | 403 | no |
NOT_FOUND | 404 | no |
PAGINATION_CURSOR_INVALID | 400 | no |
IDEMPOTENCY_KEY_REQUIRED | 400 | no |
IDEMPOTENCY_KEY_REUSED | 422 | no |
IDEMPOTENCY_IN_PROGRESS | 409 | yes (Retry-After: 2) |
RATE_LIMITED | 429 | yes (Retry-After) |
INTERNAL_ERROR | 500 | yes |
DEPENDENCY_UNAVAILABLE | 503 | yes |
Each reference page lists the codes its endpoints return.
Not found, on purpose
Where existence itself is private (someone else's draft, a session you aren't in), the API answers with the subject's *_NOT_FOUND rather than 403, so nothing leaks.
Realtime errors
Socket acknowledgements carry the same codes: { ok: false, error: { code, message, retryable, actions? } }, where message is the same safe title. See Realtime.