> ## Documentation Index
> Fetch the complete documentation index at: https://developers.pcibooking.net/llms.txt
> Use this file to discover all available pages before exploring further.

# End Card Display Session

> Stop a Card Display with OTP session before it expires. The link and any codes stop working.

> [card] [Card Display with OTP Guide](https://developers.pcibooking.net/use-tokens/card-display-otp.md)
>
> How the OTP verification flow works end-to-end

Ends a session created with [Initiate Card Display with OTP](https://developers.pcibooking.net/api-reference/process-cards/card-display-otp.md) before `TtlMinutes` runs out. From then on, the link and any codes stop working. See [After the session ends](https://developers.pcibooking.net/use-tokens/card-display-otp.md#after-the-session-ends) for what the viewer sees.

Ending a session that has already ended or expired changes nothing. The call returns the session status either way, so it is safe to repeat.

If the session has a `CallbackUrl`, PCI Booking sends a callback with `event` set to `ended`. See [Callbacks](https://developers.pcibooking.net/use-tokens/card-display-otp.md#callbacks).

> [!NOTE]
>
> Ending the session does not clear a card that is already shown on the viewer's screen. It stops any further views.

## Error Responses

| Code | HTTP Status | Condition |
| - | - | - |
| none | 400 | `requestId` is not a 32-character alphanumeric string. |
| none | 401 | The `Authorization` header is missing, badly formatted, or the API key is not valid. The response body is empty. See [Authentication and Permission Failures](https://developers.pcibooking.net/reference/error-handling.md#authentication-and-permission-failures). |
| -1003 | 403 | Your user does not have the **Retrieve cards** or the **Perform Card display operations** permission, or your IP address is not in your account's allowed IP list. `message` names the reason. |
| -160 | 404 | No card display session with this ID exists for your account. A session created by another account returns the same response. |
| -150 | 500 | The session could not be read, or the end could not be saved. |

## Parameters

### Authentication

**API key only.** This endpoint does not accept access tokens or session tokens.

**Authorization** `string` *required*

Your API key prefixed with `APIKEY`. Example: `APIKEY your-api-key`. The `x-pcibooking-api-key` header is also accepted. See the [Authentication guide](https://developers.pcibooking.net/getting-started/authentication.md).

### Path Parameters

**requestId** `string` *required*

The `requestId` returned by [Initiate Card Display with OTP](https://developers.pcibooking.net/api-reference/process-cards/card-display-otp.md).

```javascript Node.js theme={null}
const requestId = 's4iMrBQioE0JBCJIMN9kjnsLNDeGZUmG';

const response = await fetch(`https://service.pcibooking.net/api/card-view-request/${requestId}/end`, {
  method: 'POST',
  headers: {
    'Authorization': 'APIKEY your-api-key'
  }
});

console.log(await response.json());
```

```python Python theme={null}
import requests

request_id = 's4iMrBQioE0JBCJIMN9kjnsLNDeGZUmG'

response = requests.post(
    f'https://service.pcibooking.net/api/card-view-request/{request_id}/end',
    headers={'Authorization': 'APIKEY your-api-key'}
)

print(response.json())
```

## Response

The session status after the end, with the same fields as [Get Card Display Session Status](https://developers.pcibooking.net/api-reference/process-cards/card-display-otp-status.md#response). `status` is `Ended` and `endReason` is `Customer`, unless the session had already expired or ended for another reason.

```json 200 theme={null}
{
  "requestId": "s4iMrBQioE0JBCJIMN9kjnsLNDeGZUmG",
  "status": "Ended",
  "createdAt": "2026-01-12T14:00:00Z",
  "expiresAt": "2026-01-12T14:15:00Z",
  "linkOpenedAt": "2026-01-12T14:02:10Z",
  "lastOtpSentAt": "2026-01-12T14:02:30Z",
  "otpSentCount": 1,
  "viewCount": 1,
  "maxViews": 3,
  "firstViewedAt": "2026-01-12T14:03:05Z",
  "lastViewedAt": "2026-01-12T14:03:05Z",
  "endedAt": "2026-01-12T14:05:00Z",
  "endReason": "Customer",
  "locked": false,
  "metadata": "BOOKING-12345"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.