Skip to main content

Error response format

All error responses follow a consistent format:
{
  "error": "Human-readable error message",
  "code": "ERROR_CODE",
  "details": {}  // Optional additional context
}

HTTP status codes

StatusMeaningWhen it occurs
400Bad RequestInvalid parameters or malformed request
401UnauthorizedMissing or invalid API key
403ForbiddenAPI key doesn’t have access to this endpoint
404Not FoundEndpoint doesn’t exist
422Unprocessable EntityValid request but invalid data
429Too Many RequestsRate limit exceeded
500Internal Server ErrorSomething went wrong on our end

Common error codes

Authentication errors

{
  "error": "Invalid API key",
  "code": "UNAUTHORIZED"
}
Solution: Check that your API key is correct and included in the X-API-Key header.

Validation errors

{
  "error": "Invalid email format",
  "code": "VALIDATION_ERROR",
  "details": {
    "field": "email",
    "value": "not-an-email"
  }
}
Solution: Check the parameter requirements in the API reference.

Rate limit errors

{
  "error": "Rate limit exceeded",
  "code": "RATE_LIMIT_EXCEEDED",
  "retry_after": 60
}
Solution: Wait for the retry_after seconds before retrying. See Rate Limits.

Error handling examples

try {
  const response = await fetch('https://api.tinyfn.io/v1/validate/email?email=test', {
    headers: { 'X-API-Key': apiKey }
  });

  if (!response.ok) {
    const error = await response.json();
    console.error(`Error ${response.status}: ${error.error}`);
    return;
  }

  const data = await response.json();
} catch (err) {
  console.error('Network error:', err);
}

Getting help

If you encounter persistent errors or believe there’s an issue with the API: