Overview
Every error response from the folksbase API follows a consistent JSON shape. This makes it straightforward to build error handling in your client — you always know what to expect.Error Shape
code field is stable and safe to use in programmatic checks. The message field is for display purposes and may change between releases.
Error Codes
| HTTP Status | Code | When |
|---|---|---|
400 | VALIDATION_ERROR | Request body, query params, or path params fail Zod validation |
401 | UNAUTHORIZED | Missing, invalid, or expired Bearer token |
404 | NOT_FOUND | Resource doesn’t exist or doesn’t belong to the user’s workspace |
429 | RATE_LIMITED | Request exceeds the global or upload rate limit |
500 | INTERNAL_ERROR | Unhandled server error |
Validation Errors
When a request fails Zod validation, thedetails field contains the array of Zod issues. Each issue describes exactly which field failed and why:
path array tells you which field caused the error. Nested fields use dot-separated paths (e.g., ["custom_fields", "department"]).
Authentication Errors
Auth errors always return401 with the UNAUTHORIZED code. The message varies depending on the cause:
How Errors Are Handled
The API uses a global error handler middleware. Route handlers don’t catch errors themselves — they let exceptions propagate to the middleware, which formats them consistently. The middleware handles three categories:- Zod errors — caught by
instanceof ZodError, returned as400with validation details - Auth errors — detected by message content (
"Unauthorized"or JWT-related), returned as401 - Everything else — logged with stack trace, returned as
500with a generic message
{ code, message } with an optional details field.