The Sell API uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx indicate an error with the provided information (errors with the information provided), and codes in the 5xx range indicate a server-side error.

An error response should specify the Content-Language of the response and have Content-Type set to the application/json; charset=utf-8 value.


Body

The general format of an error's envelope includes two fields: errors and meta. They are described below in a separate subsection.

This is the basic structure of the error response:

{  "errors":[{    "error": {      "resource": "resource name",      "field": "field name",      "code": "error_code",      "message": "End user human readable description",      "details": "Detailed description"    },    "meta": {      "type": "error",      "links": {        "more_info": "$link_to_error_related_doc"      }    }  }],  "meta": {    "type": "errors",    "http_status": "http_status_code http_status_message",    "logref": "$Headers[X-Request-Id]",    "links": {      "more_info": "$link_to_helpful_resource"    }  }}

Errors Attributes

The errors attribute is a JSON collection of objects that holds error information and related metadata, such as links to related documentation. Each error object can hold additional metadata in the meta object.

Error object represent either an invalid request error or a resource error.

The error fields are described below:

NameDescription
codeThe error code.
messageHuman readable error description in a language specified by the Content-Language header.
detailsAn optional detailed descriptive text targeted at the client developer in English.
resourceAn optional resource name the error relates to. Present only if the error represents a resource error.
fieldAn optional field name of the resource the error relates to, in the JSON Pointer format. Present only if the error represents a resource error.

Meta Attributes

NameDescription
http_statusHTTP status code of the response plus HTTP response status message.
logrefUnique id of the request. This is the same value as the X-Request-Id header.
links/more_infoAn optional link to resources that can be helpful in solving the issue.

Invalid request error codes summary

CodeDescription
not_foundResource you are looking for was not found.
incorrect_pathRequested path was not found.
unauthorizedRequired access token is missing, malformed, expired, or invalid.
insufficient_scopeThe request requires higher access privileges than those provided by the access token.
rate_limit_exceededThe api rate limit was exceeded. Contact Sell Support in order to change the rate limits for your account.
invalid_paramA request query parameter is malformed, missing, or has an invalid value
invalid_headerA header is malformed, missing, or has an invalid value.
invalid_payloadUnexpected token found when parsing the request body.
incorrect_payloadThe request envelope is malformed, missing, or has an invalid value.
server_errorThe authorization server encountered an unexpected condition which prevented it from fulfilling the request.
temporarily_unavailableThe authorization server is currently unable to handle the request due to maintenance or temporary overload.

Resource error codes summary

CodeDescription
unknownAn attribute is not a known attribute for the resource.
missingA required attribute must be present in the request.
already_existsA resource with an attribute value already exists.
blankAn attribute can't be blank (neither null nor empty).
invalid_typeAn attribute has an invalid type.
incorrect_valueAn attribute value is incorrect e.g. is too long, has an invalid format etc.

Full example

{  "errors": [{    "error": {      "resource": "Contact",      "field": "/data/last_name",      "code": "blank",      "message": "attribute can't be blank",      "details": "The attribute '/data/last_name' can't be blank (neither null nor empty)."    },    "meta": {      "links": {        "type": "error",        "more_info": "https://developers.getbase.com/docs/rest/articles/errors"      }    }  }],  "meta": {    "type": "errors",    "http_status": "422 Unprocessable Entity",    "logref": "b4bce554-8df2-48b1-9f68-a88e741463f0",    "links": {      "more_info": "https://developers.getbase.com/docs/rest/articles/errors"    }  }}

HTTP status codes summary

CodeMessageMeaning
200OKEverything worked as expected. The response includes a non empty body.
201CreatedEverything worked as expected. Returned instead of 200 if your operation creates a new resource.
202AcceptedEverything worked as expected. The request has been accepted for future processing. Used by asynchronous APIs.
204No ContentEverything worked as expected. The response includes an empty body.
301Moved PermanentlyThe resource you are looking for has been moved somewhere else.
304Not ModifiedThe requested resource has not changed. Returned only if If-None-Match or If-Modified-Since headers were used in the request.
400Bad RequestReturned whenever the request is missing required information or is malformed in another way, e.g. the payload is malformed.
401UnauthorizedThe API consumer credentials are invalid, e.g. the API key is revoked or the username or password is invalid.
402Payment RequiredSubscription payment is required.
403ForbiddenThe request has been refused because of insufficient user access privileges.
404Not FoundThe requested resource could not be found.
405Method Not AllowedThe API consumer tried to access an endpoint with an invalid HTTP method, e.g. using PUT on a read-only resource.
406Not AcceptableThe API consumer requested a format that the server cannot produce - an invalid Accept header.
409ConflictThe request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected the user might be able to resolve the conflict and resubmit the request.
410The target resource is no longer available and that this condition is likely to be permanentThe position parameter expired or resources such as contact id or deal id are missing.
415Unsupported Media TypeThe API consumer used an unsupported media type in the Content-Type or Content-Encoding headers.
422Unprocessable EntityThe request is well-formed but cannot be processed due to semantic issues with the payload, e.g. some required fields are missing.
429Too Many RequestsThe rate limit was exceeded and access is temporarily blocked.
500, 502, 503, 504-Something went wrong on Sell's end.