API ReferenceError Codes

Error Codes

The Tewdy API uses standard HTTP status codes and returns structured JSON error responses.

Error Response Format

All error responses follow this structure:

{
  "message": "Human-readable error description",
  "code": "MACHINE_READABLE_CODE",
  "status": 400
}

HTTP Status Codes

StatusMeaningDescription
200OKRequest succeeded
201CreatedResource created successfully
400Bad RequestInvalid request body, missing fields, or validation error
401UnauthorizedMissing or invalid authentication
403ForbiddenAuthenticated but insufficient permissions
404Not FoundResource does not exist
409ConflictResource already exists or state conflict
422Unprocessable EntityValidation error with detailed field-level errors
429Too Many RequestsRate limit exceeded
500Internal Server ErrorUnexpected server error
502Bad GatewayExternal service dependency failed
503Service UnavailableServer temporarily unavailable

Authentication Error Codes

CodeStatusDescription
TOKEN_MISSING401No JWT or API key provided
TOKEN_INVALID401JWT is malformed or has an invalid signature
TOKEN_EXPIRED401JWT has expired
API_KEY_MISSING401X-API-Key header is missing
API_KEY_INVALID401API key is invalid, expired, or revoked
SCOPE_INSUFFICIENT403API key does not have the required scope

Troubleshooting

”TOKEN_MISSING” or “API_KEY_MISSING”

Make sure you’re sending your API key in the correct header:

# Correct
curl -H "X-API-Key: tewdy_abc123..." https://api.tewdy.com/api/v1/tasks
 
# Wrong — using Authorization header for API keys
curl -H "Authorization: tewdy_abc123..." https://api.tewdy.com/api/v1/tasks

“API_KEY_INVALID”

Your API key may be:

  • Revoked — check the key status in your dashboard
  • Expired — check the expiration date
  • IP restricted — your request IP may not be in the key’s whitelist
  • Mistyped — ensure the full key is included (starts with tewdy_)

“SCOPE_INSUFFICIENT”

Your API key doesn’t have the required scope for this endpoint. For example, creating a task requires tasks:write but your key may only have tasks:read.

To fix: create a new API key with the required scopes, or update the existing key’s scopes in the dashboard.

”429 Too Many Requests”

You’ve exceeded the rate limit. Check the Retry-After header and wait before retrying. See Rate Limiting for details.

”500 Internal Server Error”

This is an unexpected server error. If it persists, contact support with the request details (endpoint, method, timestamp). Do not retry immediately — use exponential backoff.