Errors
The YSUITE External API uses standard HTTP status codes. Every response — success or error — uses the same envelope shape.
Error response format
{
"success": false,
"message": "No organisation assigned to user"
}
For validation errors, the response may include an errors object with field-level details:
{
"success": false,
"message": "The cstname field is required.",
"errors": {
"cstname": ["Lead name is required."]
}
}
HTTP status codes
| Code | Meaning |
|---|---|
200 OK |
Request successful (including creates and deletes) |
400 Bad Request |
Business logic error (e.g. resource not found, org not set) |
401 Unauthorized |
Missing or invalid x-ysuite-access-key / x-ysuite-secret-key |
403 Forbidden |
Required subscription add-on not active on this account |
422 Unprocessable Entity |
Validation error on submitted fields |
500 Internal Server Error |
Unexpected server error — contact support |
Handling errors in code
const res = await fetch('https://api.ysuite.org/v1/contacts', {
headers: {
'x-ysuite-access-key': process.env.YSUITE_ACCESS_KEY,
'x-ysuite-secret-key': process.env.YSUITE_SECRET_KEY,
}
});
const body = await res.json();
if (!body.success) {
console.error(res.status, body.message);
}
Common errors
| HTTP | message |
Fix |
|---|---|---|
401 |
Invalid API credentials. |
Check your access key and secret key |
403 |
Subscription-related message | Ensure the required add-on is active on your plan |
400 |
No organisation assigned to user |
The API key is not linked to an organisation |
422 |
Field-level validation message | Review the errors object in the response |