Error Handling
All NexSpace API errors return a consistent JSON structure with machine-readable codes and agent-friendly recovery hints.Error Format
| Field | Type | Description |
|---|---|---|
message | string | Human-readable error message |
code | string | Machine-readable error code |
suggestion | string? | Recovery hint for agents |
retryable | boolean? | Whether retry with backoff might succeed |
details | object? | Structured details (e.g., Zod validation issues) |
requestId | string? | Correlation ID for support |
Common Error Codes
| HTTP | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_FAILED | Request body failed schema validation |
| 401 | UNAUTHORIZED | Missing or invalid authentication |
| 401 | INVALID_API_KEY | API key not found or revoked |
| 403 | FORBIDDEN | Insufficient permissions or scope |
| 404 | NOT_FOUND | Resource does not exist |
| 409 | CONFLICT | Idempotency key reused with different body |
| 409 | ALREADY_REVOKED | API key already revoked |
| 410 | VERSION_SUNSET | API version has been removed |
| 429 | RATE_LIMITED | Too many requests |
| 500 | INTERNAL_ERROR | Server error |
Best Practices
- Check
retryable— iftrue, retry with exponential backoff - Read
suggestion— it tells agents exactly how to fix the issue - Log
requestId— include it when contacting support - Handle
codeprogrammatically — don’t parsemessagestrings