Skip to content

Error Handling

All API errors return a JSON object with an error field containing a human-readable message:

{
"error": "Resource not found"
}

When request validation fails (invalid body, query params, or path params), the API returns a 400 status with field-level details:

{
"error": "Validation failed",
"details": {
"formErrors": [],
"fieldErrors": {
"name": ["Required"],
"unit_price": ["Expected number, received string"]
}
}
}
FieldTypeDescription
formErrorsstring[]Errors that apply to the entire request body
fieldErrorsRecord<string, string[]>Per-field validation errors, keyed by field name
StatusMeaningUsed When
200 OKRequest succeededGET, PATCH, DELETE operations
201 CreatedResource createdPOST operations that create a new resource
StatusMeaningUsed When
400 Bad RequestInvalid inputValidation failure, invalid UUID format, missing required fields
401 UnauthorizedAuthentication requiredNo token provided or token is invalid/expired
403 ForbiddenInsufficient permissionsValid token but insufficient access for this operation
404 Not FoundResource does not existRequesting a resource ID that does not exist, or unknown URL path
409 ConflictDuplicate resourceCreating a resource that violates a unique constraint
500 Internal Server ErrorUnexpected failureUnhandled server errors

Returned when creating a resource that would violate a uniqueness constraint.

Terminal window
curl -X POST https://api.getadva.ai/api/v1/core/products \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Premium Lawn Treatment", "category": "turf"}'
{
"error": "Resource already exists",
"code": "23505"
}

Returned when referencing a related record that does not exist.

Terminal window
curl -X POST https://api.getadva.ai/api/v1/ops/jobs \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"customer_id": "00000000-0000-0000-0000-000000000000"}'
{
"error": "Referenced resource not found",
"code": "23503"
}

Returned when querying by ID and no matching record exists.

Terminal window
curl -X GET https://api.getadva.ai/api/v1/core/customers/00000000-0000-0000-0000-000000000000 \
-H "Authorization: Bearer $TOKEN"
{
"error": "Customer not found"
}

All resource IDs must be valid UUIDs. Passing a malformed ID returns a validation error:

{
"error": "Validation failed",
"details": {
"formErrors": [],
"fieldErrors": {
"id": ["Invalid uuid"]
}
}
}

Omitting required fields from a POST request:

{
"error": "Validation failed",
"details": {
"formErrors": [],
"fieldErrors": {
"name": ["Required"]
}
}
}
  1. Always check the status code before parsing the response body. Any non-2xx status indicates an error.
  2. Handle validation errors by inspecting details.fieldErrors to show per-field messages in your UI.
  3. Retry on 500 errors with exponential backoff — these are typically transient.
  4. Do not retry 4xx errors without fixing the request. These indicate a problem with your input.