{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Errors","description":"Reference, guides, and webhooks for the Aiwyn API: clients, contacts, engagements, projects, billing, payments, time, and files.","llmstxt":{"title":"Aiwyn API","description":"Aiwyn Product API documentation. Start with reference/quickstart.md; the API reference lists every endpoint, its required role, its request and response schemas, and the webhook payload."}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"errors","__idx":0},"children":["Errors"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Product API uses standard HTTP status codes and returns a consistent JSON error"," ","body on failure."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"error-response-shape","__idx":1},"children":["Error response shape"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"error\": \"Unexpected variable clientId\",\n  \"code\": \"bad-request\",\n  \"path\": \"$\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Human-readable description of what went wrong. Always present."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["code"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Machine-readable error code you can branch on. Present on errors from the query itself; absent on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageSize"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}," validation errors."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["path"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Where in the request the error was found. Present on errors from the query itself."]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An out-of-range ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageSize"]}," or a negative ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}," on a list or search endpoint is rejected before the query runs, and the body carries only ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{ \"error\": \"pageSize must be an integer from 1 to 1000\" }\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{ \"error\": \"page must be an integer of 0 or more\" }\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"status-codes","__idx":2},"children":["Status codes"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Status"},"children":["Status"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Meaning"},"children":["Meaning"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Typical cause"},"children":["Typical cause"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["400 Bad Request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The request was malformed or a parameter was invalid."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Out-of-range ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageSize"]},", negative ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]},", malformed body."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["401 Unauthorized"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["No valid token was supplied."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Missing, malformed, or expired bearer token. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/reference/authentication"},"children":["Authentication"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["403 Forbidden"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The token is valid but lacks the required role."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Key not provisioned with the endpoint's role. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/reference/authorization"},"children":["Authentication & authorization"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["404 Not Found"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The requested resource does not exist."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unknown id or reference."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["429 Too Many Requests"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Too many new tokens were issued for one API user."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Issuing new tokens in a loop on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v1/auth/token"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v1/auth/refresh-token"]},", or across many keys of one API user. Wait ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Retry-After"]}," seconds and reuse the token."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["500 Internal Server Error"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An unexpected error occurred."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Transient server error. Retry with backoff."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"batch-writes-per-record-results","__idx":3},"children":["Batch writes: per-record results"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Endpoints that write a batch of records (for example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /api/v1/codes"]}," and"," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /api/v1/entries"]},") process each record independently and report it in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.records[]"]}," ","with its ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status"]}," and, for a failed record, an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["code"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message"]},", optional ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fieldErrors"]},")."," ","The response status summarizes the batch:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Status"},"children":["Status"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Meaning"},"children":["Meaning"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200 OK"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Every record succeeded; ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["meta.success"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["207 Multi-Status"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Some records failed; ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["meta.success"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," carries the per-record results."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["422 Unprocessable Entity"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Every record failed; ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["meta.success"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," carries the per-record errors (for example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PERSIST_ERROR"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UNRESOLVED_REFERENCE"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["400 Bad Request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The request itself is invalid (for example no ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["records"]},", or more than 100); no record is processed."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"example-error-bodies","__idx":4},"children":["Example error bodies"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["401 Unauthorized"]}," on an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/api/v1"]}," endpoint: the bearer token or API key is missing, malformed, invalid or expired."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"message\": \"Authentication required\",\n  \"extensions\": { \"code\": 401, \"details\": { \"reason\": \"UNAUTHENTICATED\" } }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["403 Forbidden"]}," on an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/api/v1"]}," endpoint: the token is valid but its key lacks the endpoint's role. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["requiredRoles"]}," ","lists the roles that would be accepted."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"message\": \"Access denied. This endpoint requires one of the following roles: TM_ENTRY_C.\",\n  \"extensions\": { \"code\": 403, \"details\": { \"reason\": \"INSUFFICIENT_ROLE\", \"requiredRoles\": [\"TM_ENTRY_C\"] } }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["401 / 403 from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v1/auth/token"]}]},": the token endpoint answers with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["code"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"error\": \"UnauthorizedException\",\n  \"message\": \"Authentication failed\",\n  \"code\": \"UNAUTHORIZED\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A refused key gets ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UnauthorizedException"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UNAUTHORIZED"]},". A valid key without an active ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["API_ADMIN"]}," role gets"," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ForbiddenException"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FORBIDDEN"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message"]}," \"Access denied\"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["429 from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v1/auth/token"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v1/auth/refresh-token"]}]},": too many new tokens were issued for the API user"," ","this key belongs to in the last 10 minutes; both endpoints and all of the user's keys share one budget. The"," ","response has a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Retry-After"]}," header (seconds) and the same body shape, with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RateLimitExceeded"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["code"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TOO_MANY_REQUESTS"]},". A token exchange answered with the token already cached for its key does not count; every new"," ","token does (the first exchange with each key, one each time the cached token expires, and every refresh). Requesting a"," ","token before each call with one key stays within the budget; issuing new tokens in a loop, or cycling through many keys"," ","of one API user, does not. Reuse a token until it answers ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["401"]},". A ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["429"]}," without this body and"," ","without ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Retry-After"]}," comes from the per-address limit at the network edge: back off and retry later."]}]},"headings":[{"value":"Errors","id":"errors","depth":1},{"value":"Error response shape","id":"error-response-shape","depth":2},{"value":"Status codes","id":"status-codes","depth":2},{"value":"Batch writes: per-record results","id":"batch-writes-per-record-results","depth":2},{"value":"Example error bodies","id":"example-error-bodies","depth":2}],"frontmatter":{"seo":{"title":"Errors"}},"lastModified":"2026-11-17T23:30:03.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/reference/errors","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}