SutraID|Developer Docs
QuickstartAPI ReferenceDashboard

Error Handling

SutraID uses standard HTTP status codes and returns structured JSON error responses. All errors follow a consistent format.

Error Response Format

{
  "statusCode": 401,
  "message": "Invalid or expired token",
  "error": "Unauthorized"
}

Validation errors (400) include an array of specific field errors:

{
  "statusCode": 400,
  "message": [
    "email must be an email",
    "password must be longer than or equal to 8 characters"
  ],
  "error": "Bad Request"
}

HTTP Status Codes

CodeTitleDescriptionResolution
400Bad RequestThe request body failed validation. Check required fields and data types.Review the request body against the API reference. Ensure all required fields are present and correctly typed.
401UnauthorizedMissing, invalid, or expired authentication token.Include a valid access token in the Authorization header. If expired, obtain a new token using your refresh token.
403ForbiddenThe authenticated user lacks permission for this action.Check the user's organization role. The required permission is listed in each endpoint's documentation.
404Not FoundThe requested resource does not exist or is not accessible to the current user.Verify the resource ID in the URL path. Ensure you are querying within the correct organization scope.
409ConflictA resource with the same unique identifier already exists.Check for duplicate emails, slugs, or names. Use a unique value.
422Unprocessable EntityThe request was well-formed but contained semantic errors.Review the validation error messages in the response body for specific field issues.
429Too Many RequestsRate limit exceeded. You are sending too many requests.Implement exponential backoff. Reduce request frequency. Check the Retry-After header for wait time.
500Internal Server ErrorAn unexpected error occurred on the server.Retry the request after a brief delay. If the error persists, contact support with the request ID.

Best Practices

  • Always check the HTTP status code before parsing the response body.
  • Handle 401 errors by refreshing the access token using your refresh token, then retrying the request.
  • Implement exponential backoff for 429 and 500 errors.
  • Log the full error response (including message) for debugging purposes.
  • Never expose raw error messages to end users in production — map them to user-friendly messages.