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

# Revoke Session

> Revoke an active payment session

Revoke a payment session before it is used. Revocation is immediate and cannot be undone — a revoked session can no longer collect a card or produce credentials.

`POST /v1/sessions/{id}/revoke` · Authenticated with your secret key.

## Path parameters

**id** `string` *required*

The `session_id` returned by [Create Session](https://docs.prava.space/api-reference/create-session.md).

## Response

**success** `boolean`

Always `true` on successful revocation.

## Notes

* Once revoked, the session token can no longer be used for any SDK operations.
* Any in-progress card collection or intent registration (the step that creates the payment's spending
  permission) within the session will fail.
* Revocation is **immediate and irreversible**.

## Error responses

| Status | Code | Cause |
| - | - | - |
| 401 | `AUTH_1001` | Invalid API key |
| 401 | `AUTH_1002` | Missing or invalid Authorization header |
| 404 | `NOT_FOUND` | Session not found or doesn't belong to your merchant account |

```bash cURL theme={null}
curl -X POST https://sandbox.api.prava.space/v1/sessions/ses_123/revoke \
  -H "Authorization: Bearer sk_test_..."
```

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

resp = requests.post(
    "https://sandbox.api.prava.space/v1/sessions/ses_123/revoke",
    headers={"Authorization": "Bearer sk_test_..."},
)
```

```javascript JavaScript theme={null}
const resp = await fetch("https://sandbox.api.prava.space/v1/sessions/ses_123/revoke", {
  method: "POST",
  headers: {
    Authorization: "Bearer sk_test_...",
  },
});
```

```json 200 Success theme={null}
{ "success": true }
```

```json 401 Unauthorized theme={null}
{
  "error": { "code": "AUTH_1002", "message": "Missing or invalid Authorization header" }
}
```

```json 404 Not Found theme={null}
{
  "error": { "code": "NOT_FOUND", "message": "Session not found" }
}
```


## OpenAPI

````yaml api-reference/openapi.json POST /v1/sessions/{id}/revoke
openapi: 3.1.0
info:
  title: Prava Payments API
  description: >-
    Server-side REST API for Prava Payments. All requests are authenticated with
    your secret key (sk_test_* in sandbox, sk_live_* in production).
  version: 1.0.0
servers:
  - url: https://sandbox.api.prava.space
    description: Sandbox
  - url: https://api.prava.space
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/sessions/{id}/revoke:
    post:
      summary: Revoke Session
      description: >-
        Revoke an active payment session. Revocation is immediate and
        irreversible.
      operationId: revokeSession
      parameters:
        - name: id
          in: path
          required: true
          description: The session_id of the session to revoke
          schema:
            type: string
      responses:
        '200':
          description: Session revoked
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Always true on successful revocation
        '401':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
components:
  responses:
    Error:
      description: Error response
      headers:
        X-Response-ID:
          $ref: '#/components/headers/XResponseId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  headers:
    XResponseId:
      description: >-
        UUID correlation identifier for this response. Include it when
        contacting Prava support.
      schema:
        type: string
        format: uuid
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code (e.g. VAL_2001, AUTH_1001)
            message:
              type: string
              description: Human-readable error message
            details:
              type: object
              description: >-
                Optional — included for validation errors to specify which
                fields failed
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your secret key: sk_test_* (sandbox) or sk_live_* (production).'

````

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