Skip to main content
To prevent duplicate resource creation and depending on your use case, you can include in your POST request (such as one that creates an invoice) a unique value in the X-Chift-Client-RequestId header.

This ensures that each POST request is processed exactly once by our API. Uniquely identifying POST requests that create new resources is particularly crucial when the response outcome is uncertain due to temporary service disruptions, such as server timeouts or network failures.

In such cases, the client application can safely retry the request without the risk of duplicate operations.
API endpoints that guarantee a request is processed only once, regardless of how many times it is retried with the same unique identifier, are referred to as idempotent.

How to use it?

Include in your request to Chift, the following header: x-chift-client-requestid: 123456 The value (123456 in this example) is a unique identifier that you generate and manage on your side:
  1. Format and storage: It must be a varchar(255), meaning it can contain up to 255 characters. You are responsible for generating it in a way that guarantees uniqueness for each request.
  2. Scope and usage: The header is not tied to a specific endpoint and can be included in any request. Each value must be unique per request, regardless of the endpoint, to ensure duplicates are correctly detected.
  • Chift keeps logs of these identifiers for 6 months.

What can you expect?

You can expect a 409 error code in case you request was processed (REQUEST_ALREADY_PROCESSED) or currently in processing (REQUEST_IN_PROCESS): E.g.
{
    "status": "error",
    "message": "Request already processed: 200",
    "detail": "Request with same client request id {client_request_id} was already successfully processed",
    "error_code": "REQUEST_ALREADY_PROCESSED"
}
{
    "status": "error",
    "message": "Request is in processing",
    "detail": "Request with same client request id {client_request_id} is currently processed",
    "error_code": "REQUEST_IN_PROCESS"
}

Monitoring

The endpoint API Reference ↗️ can be used to retrieve information about a transaction using the x-chift-client-requestid. Moreover, for POST-endpoints, this will as well give you the id in response of the created entity.