Errors
Peer REST returns a consistent JSON error object. Clients should branch on HTTP status and error.code.
Error envelope
{
"error": {
"code": "INVALID_REQUEST",
"message": "Invalid request body",
"details": []
}
}
code— stable machine-readable stringmessage— human-readable summary (safe to log; may omit sensitive payload)details— optional validation issues (e.g. Zod field errors)
Status meanings
| Status | Meaning |
|---|---|
400 | Request body or query failed validation |
401 | Missing API key when required |
403 | Invalid API key |
404 | Resource not found |
503 | Dependency or admin auth unavailable |
5xx | Peer / ledger failure — retry with backoff |
Common codes
| Code | Typical use |
|---|---|
UNAUTHORIZED | Missing X-Api-Key |
FORBIDDEN | Wrong X-Api-Key |
INVALID_REQUEST | Schema / query validation failure |
UNKNOWN_CHAINCODE | Peer configured for an unrecognized chaincode mapping |
ISSUE_FAILED / TRANSFER_FAILED / REDEEM_FAILED | Token submit failures |
QUOTE_FAILED / BALANCE_FAILED / HISTORY_FAILED / STATS_FAILED | Token evaluate failures |
ADMIN_AUTH_UNAVAILABLE | Admin route without configured admin key |