Skip to content

Error Handling

The API uses standard HTTP status codes to indicate the result of a request.

HTTP Status Codes

CodeMeaning
200Success
201Resource created
204Success with no content (DELETE)
400Bad request
401Unauthenticated — missing or invalid token
403Forbidden — insufficient permissions
404Resource not found
422Validation error
429Rate limit reached
500Server error

Error Format

json
{
  "message": "The given data was invalid.",
  "errors": {
    "email": ["The email field is required."],
    "status": ["The selected status is invalid."]
  },
  "code": 422
}

Validation Errors (422)

Validation errors include an errors object with the failing fields:

bash
curl -X POST https://app.beeving.com/api/v1/contacts \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"email": "invalid-email"}'
json
{
  "message": "The given data was invalid.",
  "errors": {
    "email": ["The email must be a valid email address."]
  },
  "code": 422
}

Rate Limiting (429)

json
{
  "message": "Too Many Attempts.",
  "errors": null,
  "code": 429
}

Check the response headers for quota information:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
Retry-After: 30

Best Practices

  • Always check the HTTP status code before processing the response
  • On 429, wait for the duration indicated by Retry-After
  • Log 5xx errors to detect server-side incidents

API v1.0