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"
}
}| Field | Description |
|---|---|
| success | Always false for error responses |
| status | HTTP status code (matches response status) |
| message | Human-readable error summary |
| errors | Array of field-level validation errors (422 only) |
| meta | Timestamp 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
| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Resource created |
| 204 | Success, no body |
| 400 | Bad request (malformed JSON, invalid params) |
| 401 | Unauthorized (missing or invalid token) |
| 403 | Forbidden (valid token, insufficient permissions) |
| 404 | Resource not found |
| 422 | Validation failed (check errors array) |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
Troubleshooting
- 401: Ensure the
X-API-Keyheader 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
errorsarray 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.