---
title: "Cancelpreauth"
source_url: https://docs.rapyd.net/en/cancelpreauth.html
lang: en
---

# Cancelpreauth

Send a request to cancel a pre-authorization on a PAX POS device.

A cancel pre-authorization request releases the funds held by a previously completed pre-authorization. To submit this request, extract the `panFirstSix`, `panLastFour`, `authCode`, `stan`, and `cardLength` from the original pre-authorization response and include them in the new request.

Upon receiving the request, the CloudLink API forwards it to the terminal, which immediately triggers a `SALE_RECEIVED` event sent at the provided `callbackUrl`. Once the terminal successfully releases the hold, it triggers a final `SALE_COMPLETED` callback event.

### Parameters

### Request Header Parameters

- - X-API-KEY
  - Unique access key provided by Rapyd for each partner.

### Request Body Parameters

- - panFirstSix
  - First six digits of PAN from response e.g. 123456******7890 input: "123456"
- - panLastFour
  - Last four digits of PAN from response e.g. 123456******7890 input: "7890"
- - authCode
  - Input authCode from original transaction.
- - stan
  - Input Stan from original transaction.
- - cardLength
  - Input length of card e.g. 123456******7890 input: "16"
- - disablePrinting
  - Indicates if to print a receipt.
- - referenceId
  - Optional reference from merchants.
- - language
  - The language that the PAX POS will use to display information on the device. One of the following:

    - **en_GB**
    - **ar_EG**
    - **da_DK**
    - **de_DE**
    - **es_ES**
    - **fi_FI**
    - **fr_FR**
    - **hi_IN**
    - **is_IS**
    - **it_IT**
    - **nb_NO**
    - **nl_NL**
    - **pl_PL**
    - **pt_PT**
    - **ru_RU**
    - **sl_SI**
    - **sv_SE**
    - **zh_CN**
- - callbackUrl
  - The URL that CloudLinkApi will use to return information to the caller.
- - deviceToken
  - The token of a PAX POS device.
- - correlationId
  - An ID provided by the caller. Will be returned in the callback for message matching. In a cancel request, use the value from the sale/refund that is being cancelled.
- - timeToLive
  - The maximum time, in seconds, for a request to reach the physical terminal. The default value is 5 seconds.
- - terminalId
  - If terminal has more than one merchant, this field is used to identify the merchant. To get a list of merchants, use the requestMerchantConfig request. Value can be null.

### 202 Accepted Response

- - message
  - Accepted

### 400 Error Response

- - type
  - Example: https://tools.ietf.org/html/rfc7231#section-6.5.1

- - title
  - Bad Request

- - status
  - 400

- - detail
  - DeviceId not registered

### 401 Error Response

- - message
  - Unauthorized

### 500 Error Response

- - message
  - Server Error

- /cancelpreauth

- 202 Accepted Cancelpreauth
- ```curl
  curl -X
  post https://CloudLinkApi/cancelpreauth
  -H 'X-API-KEY: your-access-key-here'
  -d '{
       "panFirstSix": "123456",
       "panLastFour": "7890",
       "authCode": "123456",
       "stan": "99",
       "cardLength": "16",
       "disablePrinting": true,
       "referenceId": "merchant-ref-number-abc123",
       "language": "en_GB",
       "callbackUrl": "http://example.com/webhook-endpoint",
       "deviceToken": "b16526c3447ba6cea4818d",
       "correlationId": "5d1d4ea-8229-44d7-b517-26a5ae6c2fda",
       "timeToLive": 5,
       "terminalId": null
  }
  ' 
  ```
- ```json
  {
   "message": "Accepted"
  }
  ```

- 400 Bad Request
- ```curl
  curl -X
  post https://CloudLinkApi/cancelpreauth
  -H 'X-API-KEY: your-access-key-here'
  -d '{
       "panFirstSix": "123456",
       "panLastFour": "7890",
       "authCode": "123456",
       "stan": "99",
       "cardLength": "16",
       "disablePrinting": true,
       "referenceId": "merchant-ref-number-abc123",
       "language": "en_GB",
       "callbackUrl": "http://example.com/webhook-endpoint",
       "deviceToken": "b16526c3447ba6cea4818d",
       "correlationId": "5d1d4ea-8229-44d7-b517-26a5ae6c2fda",
       "timeToLive": 5,
       "terminalId": null
  }
  '  
  ```
- ```json
  {
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
    "title": "Bad Request",
    "status": 400,
    "detail": "DeviceId not registered"
  }  
  ```

- 401 Unauthorized Cancelpreauth
- ```curl
  curl -X
  post https://CloudLinkApi/cancelpreauth
  -H 'X-API-KEY: your-access-key-here'
  -d '{
       "panFirstSix": "123456",
       "panLastFour": "7890",
       "authCode": "123456",
       "stan": "99",
       "cardLength": "16",
       "disablePrinting": true,
       "referenceId": "merchant-ref-number-abc123",
       "language": "en_GB",
       "callbackUrl": "http://example.com/webhook-endpoint",
       "deviceToken": "b16526c3447ba6cea4818d",
       "correlationId": "5d1d4ea-8229-44d7-b517-26a5ae6c2fda",
       "timeToLive": 5,
       "terminalId": null
  }
  ' 
  ```
- ```json
  {
   "message": "Unauthorized"
  }
  ```

- 500 Server Error Cancelpreauth
- ```curl
  curl -X
  post https://CloudLinkApi/cancelpreauth
  -H 'X-API-KEY: your-access-key-here'
  -d '{
       "panFirstSix": "123456",
       "panLastFour": "7890",
       "authCode": "123456",
       "stan": "99",
       "cardLength": "16",
       "disablePrinting": true,
       "referenceId": "merchant-ref-number-abc123",
       "language": "en_GB",
       "callbackUrl": "http://example.com/webhook-endpoint",
       "deviceToken": "b16526c3447ba6cea4818d",
       "correlationId": "5d1d4ea-8229-44d7-b517-26a5ae6c2fda",
       "timeToLive": 5,
       "terminalId": null
  }
  ' 
  ```
- ```json
  {
   "message": "Server Error"
  }
  ```
