When an error occurs on API request, Klarna responds with an error type, an error code, an error message and a corresponding HTTP status code.

Klarna’s APIs use HTTP status codes together with error objects to handle errors. When an API call fails Klarna will respond with a 4xx or 5xx status code together with a response body containing an error object with the error code, an array of error messages and a unique error id to be used to identify the request.

ParameterDefinition
error_idA unique identifier for the request generated by Klarna. This ID will help you in investigations in case you need help from our support team.
error_typeType of the error. Different error types are ACCESS_ERROR, TECHNICAL_ERROR, RESOURCE_ERROR and INPUT_ERROR.
error_codeError code for further categorizing the error. We recommend using this error code for building your error handling logic.
error_messageA human readable error message. The error message is not meant to be displayable to customers shopping, but to assist in technical troubleshooting.
doc_urlLink to Klarna docs describing how to use the API to avoid the error, or a more detailed explanation of why the error occurred. To be provided when available.

Example of API response with an error details:

JSON
  "error_id": "abcd1234-12ab-1234-abcd-abcd12345678",
  "error_type": "INPUT_ERROR",
  "error_code": "VALIDATION_ERROR",
  "errors": [
    {
      "parameter": "line_items[0].quantity",
      "error_message": "Parameter line_items[0].quantity must be greater than or equal to 1",
      "doc_url": "https://docs.klarna.com/....."
    }
  ]}

Defined error types, and how to handle them

Error typeError codeHTTP Status codeDefinitionHandling
NOT_FOUND404The requested API route does not exist.Verify the API route.
ACCESS_ERRORUNAUTHORIZED401The presented credentials failed authentication.Verify the credentials, check the authentication method, and confirm the correct endpoint.
RATE_LIMITED429The caller was rate limited due to too many requests.See Rate Limiting for more details.
RESOURCE_ERRORRESOURCE_NOT_FOUND404The resource was not found.Verify the token provided in the request path. This issue may also occur if an attempt is made to update an expired shopping session.
RESOURCE_CONFLICT409There was a conflict in using the resource.The transaction details are conflicting with the request details. Might occur due to concurrent updates to the resource.
OPERATION_FORBIDDEN403The provided credentials (authorization) does not have enough privileges to perform the requested operation.Ensure that the credentials being used have the necessary permissions for the operation.
RATE_LIMITED429The specific resource was rate limited. For example creation of resources are rate limited, but it is still possible to run on already existing resources.See Rate Limiting for more details.
INPUT_ERRORVALIDATION_ERROR400One or more input parameters failed input validation. For example exceeding a max value, or failed pattern matching, invalid type.Verify that the request details and formats are correct. See the error message for more info.
INVALID_CONTENT_TYPE400The input does not conform to the expected content type syntax. For example invalid JSON.Verify that the content type is as expected.
TECHNICAL_ERRORINTERNAL_ERROR500An unknown error occurred.Reach out to your support contact and include the error message and the error id.
SERVER_CONFIGURATION_ERROR500The system is misconfigured. For example, price plan is misconfigured.Reach out to your support contact and include the error message and the error id.
TEMPORARY_UNAVAILABLE503The system is temporarily unavailable to process the request.Reach out to your support contact and include the error message and the error id.
TIMEOUT500The request timed out due to exceeding the maximum thresholdRetry the API-operation using same recommendations as for rate limited requests. If the error persists, reach out to your suport contact and include the error message and error id.

Related articles

Rate Limiting