Errors
Error Handling
The Aftermarket Portfolio API uses standard HTTP status codes to indicate the success or failure of requests. Error responses include detailed information to help you identify and resolve issues.
Error Response Format
All error responses follow a consistent JSON structure:
{
"code": "ERROR_CODE",
"message": "Human-readable error description",
"details": "More details about the error",
"fields": [
{
"code": "VALIDATION_ERROR",
"message": "Human-readable error description",
"path": "Query parameter or request body field which failed validation"
}
]
}HTTP Status Codes
2xx Success
- 200 OK: Request succeeded
- 201 Created: Resource created successfully
- 204 No Content: Request succeeded with no response body
4xx Client Errors
- 400 Bad Request: Invalid request syntax or parameters
- 401 Unauthorized: Missing or invalid authentication credentials
- 403 Forbidden: Valid credentials but insufficient permissions
- 404 Not Found: Requested resource doesn't exist
- 409 Conflict: Resource already exists
- 422 Unprocessable Entity: A business-rule conflict, or the request was rejected for a reason that doesn't fit a per-item result (see below)
- 429 Too Many Requests: Rate limit exceeded
5xx Server Errors
- 500 Internal Server Error: Unexpected server error, including an unexpected error from a dependency
- 503 Service Unavailable: The authentication service is temporarily unreachable
- 504 Gateway Timeout: A dependency didn't respond in time. Only Get job results and Upload data to job can return this; every other endpoint surfaces a timeout as
500instead
Common Error Codes
400 Bad Request
BAD_REQUEST
{
"code": "BAD_REQUEST",
"message": "Invalid request body"
}400 is also used for validation errors
{
"code": "BAD_REQUEST",
"message": "Invalid request body",
"fields": [
{
"code": "VALIDATION_ERROR",
"path": "name",
"message": "'invalid_domain.invalid_tld' is not a valid value for name (see documentation for valid values)"
},
{
"code": "VALIDATION_ERROR",
"path": "displayName",
"message": "'Invalid_domain.Invalid_tld' is not a valid value for displayName (see documentation for valid values)"
}
]
}And finally its also used for bulk operation jobs in case the limit has been reached. TOO_MANY_JOBS
{
"code": "TOO_MANY_JOBS",
"message": "Unable to create new bulk operation job",
"detail": "Unable to create new bulk operation job with 3 or more in created state. Please use one of the previous jobs in the created state instead"
}401 Unauthorized
Besides the account-linkage errors below, a malformed or invalid Authorization header returns one of several
AUTH_CODE_* codes (for example AUTH_CODE_API_KEY_MISSING, AUTH_CODE_API_KEY_SECRET_INVALID,
AUTH_CODE_API_KEY_SECRET_AUTHORIZATION_HEADER_MALFORMED) — see the Authentication guide
for the expected header format.
CUSTOMER_NOT_FOUND
{
"code": "CUSTOMER_NOT_FOUND",
"message": "Could not find Afternic user for your account. Please contact support."
}CUSTOMER_LINK_NOT_FOUND
{
"code": "CUSTOMER_LINK_NOT_FOUND",
"message": "Could not find a linked Afternic user for your GoDaddy account. Please contact support"
}CUSTOMER_ID_MISMATCH This usually happens in case the Customer ID does not match with what is parsed in the Authentication Token.
{
"code": "CUSTOMER_ID_MISMATCH",
"message": "Customer ID does not match the authenticated token"
}403 Forbidden
CUSTOMER_ACCESS_DENIED
{
"code": "CUSTOMER_ACCESS_DENIED",
"message": "Customer is not allowed to access this resource"
}404 Not Found
RESOURCE_NOT_FOUND
{
"code": "RESOURCE_NOT_FOUND",
"message": "The requested domain was not found in your portfolio"
}409 Conflict
CONFLICT
{
"code": "CONFLICT",
"message": "Domain 'example.com' already exists"
}Only Create domain returns this, for a domain you already own. A conflict on an
existing domain (e.g. it's on hold) is reported as 422 instead — see below.
422 Unprocessable Entity
Returned for two different reasons, depending on the operation:
On Delete domain, a business-rule conflict (e.g. the domain is on hold) is reported
with this API's own VALIDATION_ERROR code rather than a new top-level status:
VALIDATION_ERROR
{
"code": "VALIDATION_ERROR",
"message": "Domain 'example.com' is on hold and cannot be deleted"
}On several single-item write operations (Create domain,
Replace domain, Update domain,
Update job, Upload data to job, Update sale,
Send sale message), this is returned when the request fails validation. The
top-level code varies by the kind of failure — including at least the two below.
Bulk operations: per-domain results vs. a top-level error
Upsert multiple domains and Relist multiple domains
do not always return 200. Which status you get back depends on where the failure is caught:
-
A domain in the batch fails, but the batch itself is well-formed →
200. Each domain gets its own result in the response map, each with its owncode. This holds even if every domain in the batch fails — a200can still mean every single item failed, so always inspect each item'scoderather than assuming success from the top-level status.Example: upserting
["good.com", "bad.com"]wherebad.com'smaxLeasePeriodandleaseDownPaymentAmountare each individually valid, but their relationship tobuynowPricemakes the request for thebad.cominvalid, returns200with:{ "good.com": { "code": 201, "domain": { "name": "good.com", "..." : "..." } }, "bad.com": { "code": 422, "error": { "code": "VALIDATION_ERROR", "message": "Validation error(s) on fields", "fields": [{ "path": "maxLeasePeriod", "code": "VALIDATION_ERROR", "message": "maximum lease period allowed is 10 with the configured down payment" }] } } }Example: relisting
["good.com", "onhold.com"]whereonhold.comcan't be relisted returns200with:{ "good.com": { "code": 204 }, "onhold.com": { "code": 422, "error": { "code": "VALIDATION_ERROR", "message": "Domain is on hold and cannot be relisted" } } }Unlike upsert's per-domain error, relist's per-domain error never includes
fields— justcodeandmessage. -
The request body itself fails validation before any domain is processed →
400, not200. For example, submitting{"domains": []}to Upsert multiple domains fails validation on thedomainsarray itself (it requires at least one entry), so there's nothing to report a per-domain result for:{ "code": "BAD_REQUEST", "message": "Invalid Request Body", "fields": [ { "code": "VALIDATION_ERROR", "path": "domains", "message": "domains is required" } ] }The same applies to an individual domain entry that fails this API's own request-shape validation (e.g. an invalid domain name) — it's reported the same way, as a field error on that entry's path (e.g.
domains[1].name), not as a per-domain200result, since the request as a whole is rejected before any domain is processed. -
A failure applies to the whole batch but isn't attributable to any one domain → a real error status, not
200. Relist multiple domains can return400,404,409, or422for this.
MALFORMED_INPUT — a request-shape validation failure
{
"code": "MALFORMED_INPUT",
"message": "Validation errors parsing request",
"fields": [
{
"code": "VALIDATION_ERROR",
"path": "name",
"message": "must use only lowercase characters"
}
]
}DEPENDENCY_ISSUE — a business-rule/state-conflict validation failure
{
"code": "DEPENDENCY_ISSUE",
"message": "Status has to be either CLOSED or CANCELED"
}429 Too Many Requests
RATE_LIMIT_EXCEEDED
{
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests"
}500 Internal Server Error
INTERNAL_SERVER_ERROR
{
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred"
}DEPENDENCY_ISSUE
{
"code": "DEPENDENCY_ISSUE",
"message": "Unable to communicate with a dependency"
}Account resolution (which runs on every authenticated request) can also surface its own dependency failures at 500, with the underlying error's own code rather than one of the two above:
HTTP_CLIENT_ERROR — the account-linkage service couldn't be reached
{
"code": "HTTP_CLIENT_ERROR",
"message": "Internal Error occurred while fetching Afternic User. Please contact support."
}UNMARSHAL_ERROR — the account-linkage service returned a response that couldn't be parsed
{
"code": "UNMARSHAL_ERROR",
"message": "Internal Error occurred while fetching Afternic User. Please contact support."
}503 Service Unavailable
AUTH_CODE_AUTH_SERVICE
{
"code": "AUTH_CODE_AUTH_SERVICE",
"message": "Auth service is unavailable"
}This means the authentication service itself is down, not your credentials — retry with backoff.
504 Gateway Timeout
REQUEST_TIMEOUT
{
"code": "REQUEST_TIMEOUT",
"message": "Downstream request timeout"
}Error Handling Best Practices
- Always Check Status Codes: Don't assume success, check the HTTP status
- Parse Error Details: Use the error code and details for specific handling
- Implement Retry Logic:
- Retry 5xx errors with exponential backoff
- Respect
Retry-Afterheader for 429 errors - Don't retry 4xx errors (except 429)
- Log Request IDs: Include
X-Request-Idwhen contacting support - Handle Network Errors: Implement timeouts and connection error handling
Need Help?
If you encounter persistent errors:
- Check the error code and message
- Verify your request format and parameters
- Ensure your API credentials are valid
- Contact Afternic Support with the
X-Request-Id