API Reference/Documentation
GitHubDashboard
Getting Started

Errors

The Leadron API uses standard HTTP status codes and returns a consistent error envelope. All error responses include a message and optional errors array for validation details.

Consistent envelope

All errors follow the same JSON structure

Validation details

422 responses include field-level error messages

Standard codes

Uses HTTP status codes per RFC 7231

Error Response Format

Error responses include success: false, a message, and optional errors for validation failures.

Error envelope
json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
  "success": false,
  "status": 422,
  "message": "Validation failed",
  "errors": [
    {
      "field": "email",
      "message": "Invalid email format"
    },
    {
      "field": "firstName",
      "message": "Required"
    }
  ],
  "meta": {
    "timestamp": "2026-02-08T12:00:00.000Z",
    "version": "v1"
  }
}
FieldDescription
successAlways false for error responses
statusHTTP status code (matches response status)
messageHuman-readable error summary
errorsArray of field-level validation errors (422 only)
metaTimestamp and API version

Validation Errors (422)

When request validation fails, the API returns 422 with an errors array containing field and message for each issue.

Validation error response
json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
  "success": false,
  "status": 422,
  "message": "Validation failed",
  "errors": [
    {
      "field": "email",
      "message": "Invalid email format"
    },
    {
      "field": "firstName",
      "message": "Required"
    },
    {
      "field": "score",
      "message": "Must be between 0 and 100"
    }
  ],
  "meta": {
    "timestamp": "2026-02-08T12:00:00.000Z",
    "version": "v1"
  }
}

Client-side validation

Validate input on the client before sending to reduce 422 responses. Use the API error structure to highlight invalid fields in your form.

HTTP Status Codes

The API uses standard HTTP status codes. The most common are:

200OK201Created204No Content400Bad Request401Unauthorized403Forbidden404Not Found422Validation429Rate Limited500Server Error
CodeMeaning
200Success
201Resource created
204Success, no body
400Bad request (malformed JSON, invalid params)
401Unauthorized (missing or invalid token)
403Forbidden (valid token, insufficient permissions)
404Resource not found
422Validation failed (check errors array)
429Rate limit exceeded
500Internal server error

Troubleshooting

  • 401: Ensure the X-API-Key header is set with a valid, non-revoked API key.
  • 403: Check that the API key has the required permissions. If using X-On-Behalf-Of, verify the target user exists in the same tenant.
  • 404: Verify the resource ID exists and belongs to your tenant.
  • 422: Inspect the errors array for field-specific messages.
  • 500: Retry with exponential backoff. If persistent, contact support.

Request ID

For support requests, include the X-Request-Id response header (when present) to help debug issues.