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

# Expire a checkout session

Manually expires a checkout session. Only works on sessions with status 'open'.

` POST /checkout-sessions/{sessionId}/expire `

Expire a checkout session

Manually expires a checkout session. Only works on sessions with status 'open'.

## Servers

- ` https://mainnet.anyspend.com ` — Production server

## Parameters

### ` sessionId ` (path, required)

Checkout session UUID

- ` value `: type ` string `; format ` uuid `

Example:

```json
"550e8400-e29b-41d4-a716-446655440000"
```

## Responses

### ` 200 ` — Checkout session expired successfully

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` success `, ` message `, ` data `, ` statusCode `

  - ` success `: type ` boolean `

    - example: ` true `

  - ` message `: type ` string `

    - example: ` "Checkout session expired" `

  - ` data `: type ` object `

    - Required fields: ` id `, ` status `

    - ` id `: type ` string `; format ` uuid `

    - ` status `: type ` string `

      - enum: ` ["expired"] `

  - ` statusCode `: type ` number `

    - example: ` 200 `

### ` 400 ` — Cannot expire session (not found or not open)

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` success `, ` message `, ` statusCode `

  - ` success `: type ` boolean `

    - example: ` false `

  - ` message `: type ` string `

    - example: ` "Cannot expire session with status 'processing'" `

  - ` statusCode `: type ` number `

    - example: ` 400 `

## Request examples

### cURL

```curl
curl -X POST 'https://mainnet.anyspend.com/checkout-sessions/550e8400-e29b-41d4-a716-446655440000/expire'
```

### JavaScript

```javascript
const response = await fetch('https://mainnet.anyspend.com/checkout-sessions/550e8400-e29b-41d4-a716-446655440000/expire', {
  method: 'POST'
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

response = requests.post('https://mainnet.anyspend.com/checkout-sessions/550e8400-e29b-41d4-a716-446655440000/expire')
print(response.json())
```