Error Handling

Understand error responses and how to handle them.

Error Response Format

All platform API errors return a consistent JSON envelope:

{
  "error": {
    "code": "platform_invalid_request",
    "message": "Validation failed: questionText is required",
    "status": 400
  }
}

The error.code is a machine-readable identifier you can use in your error handling logic.

Error Codes

CodeHTTP StatusMeaning
platform_invalid_request400Invalid request body or parameters
platform_invalid_api_key401Missing or invalid API key
platform_api_key_revoked401API key has been revoked
platform_api_key_expired401API key has expired
platform_forbidden403API key doesn't have access to this resource
email_verification_required403Workspace email has not been verified
platform_workspace_suspended403Workspace is suspended
platform_not_found404Resource doesn't exist
platform_rate_limit_exceeded429Rate limit exceeded
platform_insufficient_credits402Insufficient credits
platform_internal_error500Something went wrong on our end

HTTP Status Codes

CodeMeaningWhen
200OKRequest succeeded
201CreatedResource created successfully
400Bad RequestInvalid request body or parameters
401UnauthorizedMissing, invalid, revoked, or expired API key
402Payment RequiredInsufficient credits
403ForbiddenWorkspace suspended or access denied
404Not FoundResource doesn't exist
409ConflictResource already exists (e.g. duplicate slug)
429Too Many RequestsRate limit exceeded
500Internal Server ErrorSomething went wrong on our end

Common Errors

Invalid API Key

{
  "error": {
    "code": "platform_invalid_api_key",
    "message": "Invalid or missing API key",
    "status": 401
  }
}

Check that your Authorization header uses the correct format: Bearer tf_platform_...

Workspace Suspended

{
  "error": {
    "code": "platform_workspace_suspended",
    "message": "Workspace is suspended",
    "status": 403
  }
}

Contact support to reactivate your workspace.

Email Verification Required

{
  "error": {
    "code": "email_verification_required",
    "message": "Workspace email has not been verified",
    "status": 403
  }
}

Verify the workspace email address before making API calls. A verification email is sent at registration. If it did not arrive, call POST /v1/platform/agent/verify-email/resend to request a new one.

Insufficient Credits

{
  "error": {
    "code": "platform_insufficient_credits",
    "message": "Insufficient credits",
    "status": 402
  }
}

Add credits to your workspace or upgrade your plan.

Rate Limit Exceeded

{
  "error": {
    "code": "platform_rate_limit_exceeded",
    "message": "Rate limit exceeded",
    "status": 429
  }
}

Wait and retry with exponential backoff. See Rate Limiting.

Best Practices

  • Always check error.code for programmatic error handling.
  • Log error.message for debugging. It may contain specific field-level details.
  • Implement retry logic with exponential backoff for 429 and 5xx errors.
  • Never retry 4xx errors (except 429). They indicate a client-side issue.