Error Handling

In case of an error, the Gateway returns appropriate HTTP status code and error body. Embedded Chain uses HTTP status codes to indicate the success or failure of an API request.

  • "2xx": indicates success
  • "4xx": indicates developer or client application related errors
  • "5xx": indicates Embedded Gateway related errors

Error Schema

NAMETYPEDESCRIPTION
status_codeintegerStandard HTTP status code of response
error_typestringIdentifies the broad category of error that occurred. For programmatic use.
error_sub_typestringDescribes the error in more detail For programmatic use. Optional.
messagestringA message explaining the error. Meant for the developer.

Error Types

Common Errors (any Request)

STATUS CODEERROR TYPEERROR SUB TYPEDESCRIPTION
400"invalid_token"The authorization token is missing or invalid
401"unauthorized_token"The authorization token is not authentic
500"server_error"Embedded Gateway encountered an unexpected error.

Operation-specific Errors

STATUS CODEERROR TYPEERROR SUB TYPEDESCRIPTION
504"not_found_error""shipment_not_found"Shipment could not be found on the remote server.
EndpointStatus CodeError TypeError SubtypeMessage
/connection/setup/validate400validation_errorinvalid_client_id scope_missing invalid_scope invalid_redirect_urlIf 'invalid_scope' is returned, will include a list of the invalid scopes.
/ connection/token/exchange401authentication_errorclient_authentication_errorClient could not be authenticated using client_id and client_secret.',
/ connection/token/exchange400invalid_tokenexchange_token_expiredExchange token has expired.
/ connection/token/exchange400invalid_tokenexchange_token_not_foundExchange token could not be found.
/ connection/token/exchange400invalid_tokenexchange_token_environment_mismatchExchange token was created in a different environment. Expected 'production', token was created in 'sandbox',
/ connection/token/exchange400invalid_tokenexchange_token_reusedExchange token has already been exchanged for a connection token
/get-shipment (Not complete)404not_found_errorshipment_not_foundCould not find shipment with id S109 on remote server'
/get-shipment (Not complete)403authorization_errorunauthorized_scopeConnection is not authorized for this scope: SHIPMENT_READ'
/get-shipment (Not complete)403authorization_errorincorrect_environmentconnection is not valid for the environment: sandbox, it was created for production',
503remote_service_unavailable
511invalid_credentials
504remote_service_timeout