Standard error response format and common error codes.
TalentScreen API uses standard HTTP status codes and returns consistent JSON error objects to help you handle errors gracefully.
All errors return a JSON object with code, message, and status fields. Additional context may be provided in the details field.
{
"error": {
"code": "validation_error",
"message": "Request validation failed",
"status": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
}| Code | Description |
|---|---|
| 200 | Success |
| 201 | Resource created |
| 400 | Bad request - validation error |
| 401 | Unauthorized - invalid token |
| 403 | Forbidden - insufficient permissions |
| 404 | Resource not found |
| 409 | Conflict - duplicate resource |
| 429 | Too many requests - rate limit exceeded |
| 500 | Internal server error |
| Code | Status | Description |
|---|---|---|
| invalid_token | 401 | API token is invalid or expired |
| insufficient_permissions | 403 | Token lacks required scope |
| validation_error | 400 | Request body validation failed |
| not_found | 404 | Requested resource does not exist |
| rate_limit_exceeded | 429 | Too many requests |
| duplicate_resource | 409 | Resource already exists |
| internal_error | 500 | Unexpected server error |
try {
const response = await fetch(url, options);
const data = await response.json();
if (!response.ok) {
throw new Error(`${data.error.code}: ${data.error.message}`);
}
return data;
} catch (err) {
logError("module-name", "functionName", "API request failed", { error: err });
// Handle specific error codes
}Always check the status code and handle errors appropriately. Log error details for debugging but never expose sensitive information to end users.
Was this article helpful?