Skip to main content

Error Handling

Error Response Structure​

When a request fails, the API returns an HTTP 401 or 422 with a code and a message.

{
"code": 102,
"message": "Invalid results_endpoint"
}

Error Object Fields​

FieldTypeDescription
codeintegerNumeric error code identifying the problem
messagestringHuman-readable description of the error

Error Code Reference​

Authentication​

CodeHTTPMessageDescription
101422Invalid api_keyThe api-key header is missing or does not match an active key
9401Client is unknownThe credentials supplied could not be resolved to a client
7401No client configuration foundNo configuration exists for your account. POST one before creating jobs

Configuration​

Returned by POST /ereceipts/config.

CodeHTTPMessageDescription
102422Invalid results_endpointThe results_endpoint value is not a valid URL
104422Both global day_cutoff and date_cutoff specifiedYou provided both at the top level; use only one
105422Neither global day_cutoff nor date_cutoff specifiedYou must provide either day_cutoff or date_cutoff at the top level
106422Global day_cutoff is not an integerday_cutoff must be a positive whole number
107422Global date_cutoff is not an integerdate_cutoff must be a positive whole number (UNIX seconds)
103422One or more retailers missing emails keyA retailer object is missing the required email field
127422One or more retailers contains an email that is not a valid email address or domainA retailer email is neither an email address nor a bare domain
108422One or more retailers contains both day_cutoff and date_cutoffA retailer specifies both cutoff types; use only one per retailer
109422One or more retailers contains a day_cutoff that is not an integerA retailer's day_cutoff must be a positive whole number
110422One or more retailers contains a date_cutoff that is not a valid integerA retailer's date_cutoff must be a positive whole number (UNIX seconds)
8422retailers must be an arrayThe retailers field was supplied as something other than an array
128422Failed to save client configurationThe configuration could not be written. Retry the request

Retailers​

Returned by DELETE /ereceipts/retailers.

CodeHTTPMessageDescription
111422No retailers specifiedretailer_emails was missing, not an array, or empty

Jobs​

Returned by POST /ereceipts/create_job.

CodeHTTPMessageDescription
118422You must specify either an email_hash or a client_user_idNeither identifier was provided
13422Existing job in progressA job for this user is already queued or executing
5422Invalid credentialsThe mailbox credentials were malformed, or the provider rejected them
6422Expired OAuth tokenThe OAuth token has expired and must be refreshed
8422Bad inputThe request was missing a required field, or could not be processed
999422Unknown errorThe job could not be queued

Job Status​

Returned by GET /ereceipts/status.

CodeHTTPMessageDescription
119401No job_id presentThe job_id query parameter is missing
120401job_id not foundNo job with that ID exists for your account

History​

Returned by POST /ereceipts/clear_history.

CodeHTTPMessageDescription
121422You must specify either an email_address or a client_user_idNeither identifier was provided
117422Could not find specified accountNo stored data matched the identifier supplied

Handling Common Errors​

101 — Invalid API Key​

Verify that the api-key header is present in every request and matches the key issued to your account. API keys are case-sensitive.

curl -X GET https://api.blinkreceipt.com/ereceipts/config \
-H "api-key: YOUR_CORRECT_API_KEY"

102 — Invalid results_endpoint​

The webhook URL must be a valid HTTPS URL that is publicly reachable. Ensure the URL does not point to localhost or a private network address in production.

{
"results_endpoint": "https://your-server.com/webhooks/ereceipts"
}

104 / 105 — Cutoff Configuration​

You must supply exactly one of day_cutoff or date_cutoff at the global level, not both and not neither. Because a POST replaces your whole configuration, this applies to every request — not only the first.

{
"results_endpoint": "https://your-server.com/webhooks/ereceipts",
"day_cutoff": 14
}

107 / 110 — Cutoff Format​

date_cutoff is a UNIX timestamp in seconds. A millisecond timestamp is a common cause of an unexpected cutoff.

7 — No Client Configuration​

POST /ereceipts/config before creating jobs. This error also appears on GET /ereceipts/config when nothing has been configured yet.

13 — Existing Job In Progress​

Only one job may be in flight per user at a time. Poll GET /ereceipts/status until the current job reports completed or error, then retry.


Job Failures​

Errors that occur while a job is processing are not returned by the API request that created it. They are reported in the job_status object from GET /ereceipts/status, in the error_code and error_message fields.

{
"success": true,
"job_status": {
"id": 98765,
"status": "error",
"error_code": 16,
"error_message": "IMAP connection error"
}
}

These codes are separate from the request errors listed above. For the full list of job status values, see endpoints.md.