Error Handling
The API uses standard HTTP status codes and returns detailed error information in JSON format.
Error Response Format
{
"error": {
"code": "VALIDATION_ERROR",
"message": "The request body is invalid",
"details": [
{
"field": "email",
"message": "Must be a valid email address"
}
]
}
}
HTTP Status Codes
| Status | Description |
|---|---|
200 | Success |
201 | Resource created |
400 | Bad request - Invalid parameters |
401 | Unauthorized - Invalid or missing authentication |
403 | Forbidden - Insufficient permissions |
404 | Not found - Resource doesn't exist |
409 | Conflict - Resource state conflict |
422 | Unprocessable - Validation failed |
429 | Too many requests - Rate limit exceeded |
500 | Server error |
Common Error Codes
| Code | Description |
|---|---|
VALIDATION_ERROR | Request validation failed |
AUTHENTICATION_ERROR | Invalid credentials |
AUTHORIZATION_ERROR | Insufficient permissions |
NOT_FOUND | Resource not found |
RATE_LIMIT_EXCEEDED | Too many requests |
DOCUMENT_ALREADY_SIGNED | Document cannot be modified |
Handling Errors
try {
const response = await fetch('https://api.propper.ai/v1/documents', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(documentData),
});
if (!response.ok) {
const error = await response.json();
console.error(`Error: ${error.error.code} - ${error.error.message}`);
}
} catch (err) {
console.error('Network error:', err);
}