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_id

A 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_type

Type of the error. Different error types are ACCESS_ERROR, TECHNICAL_ERROR, RESOURCE_ERROR and INPUT_ERROR.

error_code

Error code for further categorizing the error. We recommend using this error code for building your error handling logic.

error_message

A human readable error message. The error message is not meant to be displayable to customers shopping, but to assist in technical troubleshooting.

doc_url

Link 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/....."
    }
  ]}
Error typeError codeHTTP Status codeDefinitionHandling

NOT_FOUND

404

The requested API route does not exist.Verify the API route.

ACCESS_ERROR

UNAUTHORIZED

401

The presented credentials failed authentication.Verify the credentials, check the authentication method, and confirm the correct endpoint.

RATE_LIMITED

429

The caller was rate limited due to too many requests.See Rate Limiting for more details.

RESOURCE_ERROR

RESOURCE_NOT_FOUND

404

The 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_CONFLICT

409

There 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_FORBIDDEN

403

The 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_LIMITED

429

The 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 LimitingAPI for more details.

INPUT_ERROR

VALIDATION_ERROR

400

One 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_TYPE

400

The input does not conform to the expected content type syntax. For example invalid JSON.Verify that the content type is as expected.

TECHNICAL_ERROR

INTERNAL_ERROR

500

An unknown error occurred.Reach out to your support contact and include the error message and the error id.

SERVER_CONFIGURATION_ERROR

500

The 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_UNAVAILABLE

503

The system is temporarily unavailable to process the request.Reach out to your support contact and include the error message and the error id.