# Idempotent requests Computer networks are imperfect and, occasionally, an HTTP request might be interrupted during transmission and no response will be delivered to the client program. Typically, you will receive an error from your HTTP request library when this happens. As you cannot be certain whether the request succeeded or failed before the communication was interrupted, you must repeat the request using the same idempotency key. In this way, the investment API can recognise that it is a duplicate of the previous request and handle it accordingly. This ability to achieve the same, intended results, no matter how often the request is repeated is called ["Idempotency"](https://en.wikipedia.org/wiki/Idempotence). To make our API idempotent, we require you to use "idempotency keys". If your request contains the same idempotency key as a previous request, that has been successfully handled, the Investment API will know not to repeat the work, but rather to repeat the successful response to the request. ## Implementing idempotency Provide an `idempotency-key` HTTP header with the request. This header must have a [randomly generated UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)) as its value. **Example idempotency key** ```go idempotency-key: ccb07f42-4104-44ad-8e1f-c660bb7b269c ``` Generate a **new and unique** `idempotency-key` value for each new request, but make sure that in case you need to retry a previous request, you use the **same** `idempotency-key` value as for the repeated request. Repeat attempts are recognised as idempotent during a time window of at least 24 hours. ## Request that require idempotency keys The following **POST** requests require idempotency keys; sending idempotent keys for other endpoints or HTTP methods has no effect: - [Create an account group](/api/account-groups/create_account_group) - [Create an account](/api/accounts/create_account) - [Trigger a direct debit](/api/direct-debits/create_direct_debit) - [Create a fee collection](/api/fees/create_fee_collection) - [Create account liquidation request](/api/liquidations/create_account_liquidation) - [Create a mandate](/api/mandates/create_mandate) - [Place an order](/api/orders/place_order) - [Trigger portfolio rebalancing](/api/portfolios-rebalancing/trigger_portfolio_rebalancing) - [Create portfolios allocation](/api/portfolios/create_portfolios_allocation) - [Create portfolios configuration](/api/portfolios/create_portfolios_configuration) - [Create portfolios order](/api/portfolios/create_portfolios_order) - [Create a reference account](/api/reference-accounts/create_reference_account) - [Create savings plan](/api/savings-plans/create_savings_plan) - [Create a tax exemption](/api/tax-exemptions/create_tax_exemption) - [Update tax residencies](/api/tax-residencies/set_tax_residencies) - [Create a tax wrapper for ISA account](/api/tax-wrappers/create_isa_tax_wrapper) - [Trigger a bank transaction](/api/tests/create_bank_transaction) - [Trigger a top-up](/api/top-ups/create_topup) - [Create a user](/api/users/create_user) - [Create a virtual bank account](/api/virtual-bank-accounts/create_virtual_bank_account) - [Trigger a virtual cash decrease](/api/virtual-cash-balances/create_virtual_cash_decrease) - [Trigger a virtual cash increase](/api/virtual-cash-balances/create_virtual_cash_increase) - [Trigger a withdrawal](/api/withdrawals/create_cash_withdrawal)