Skip to main content

Errors

Every failure is a GoodchargeError with status, code, details ({ path, message }[]) and retryAfter.

StatuscodeWhat to do
400invalid_jsonSend valid JSON.
401unauthorizedCheck or regenerate the key.
409not_publishedCall publish before updatePoints or heartbeat.
413payload_too_largeKeep the body under 64 KB.
422invalid_payloadFix the fields listed in details.
429too_many_requestsOne request per second per key; retried automatically.
5xxinternal_errorRetried automatically.
0timeout, network_errorRetried automatically.
0invalid_api_keyThe key given to the constructor is malformed.
0invalid_optionA constructor or startHeartbeat option is malformed; thrown synchronously, never through a rejected promise.
2xxinvalid_responsegoodcharge answered success but the body was not JSON; not retried.

A 429 or 5xx is retried honouring Retry-After (seconds, or an HTTP-date) when the response carries one; a Retry-After above 60 seconds is not retried — the error is thrown instead, still carrying retryAfter so you can decide yourself whether and when to try again.

A rejected request is also shown on the station page of the portal, with its reason.