Handling Errors

Amplemarket uses convention HTTP response codes to indicate the success or failure of an API request.

Some errors that could be handled programmatically include an error code that briefly describes the reported error. When this happens, you can find details within the response under the field _errors.

Error Object

An error object MAY have the following members, and MUST contain at least on of:

  • id (string) - a unique identifier for this particular occurrence of the problem

  • status (string) - the HTTP status code applicable to this problem

  • code (string) - an application-specific error code

  • title (string) - human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization

  • detail (string) - a human-readable explanation specific to this occurrence of the problem, and can be localized

  • source (object) - an object containing references to the primary source of the error which SHOULD include one of the following members or be omitted:

    • pointer: a JSON Pointer RFC6901 to the value in the request document that caused the error (e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute). This MUST point to a value in the request document that exists; if it doesn’t, then client SHOULD simply ignore the pointer.

    • parameter: a string indicating which URI query parameter caused the error.

    • header: a string indicating the name of a single request header which caused the error.

Example:

{
	"_errors":[
		{
			"status":"400",
			"code": "unsupported_value",
			"title": "Unsupported Value",
			"detail": "Number of emails exceeds 100000 limit"
			"source": {
				"pointer": "/emails"
			}
		}
	]
}

Error Codes

The following error codes may be returned by the API:

codetitleDescription
internal_server_errorInternal Server ErrorAn unexpected error occurred
insufficient_creditsInsufficient CreditsThe account doesn’t have enough credits to continue the operation
person_not_foundPerson Not FoundA matching person was not found in our database
unavailable_for_legal_reasonsUnavailable For Legal ReasonsA matching person was found in our database, but has been removed due to privacy reasons
unsupported_valueUnsupported ValueRequest has a field containing a value unsupported by the operation; more details within the corresponding error object
missing_fieldMissing FieldRequest is missing a mandatory field; more details within the corresponding error object
unauthorizedUnauthorizedThe API credentials used are either invalid, or the user is not authorized to perform the operation

Compatibility

When receiving data from Amplemarket please take into consideration that adding fields to the JSON output is considered a backwards-compatible change and it may happen without prior warning or through explicit versioning.

It is recommended to future proof your code so that it disregards all JSON fields you don’t actually use.