> ## 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.

# Delete Card

> Delete a customer's enrolled card and retire its network token

Delete an enrolled card. Deletion also retires the card's network token (the tokenized stand-in for the card at the card network) where one exists.

`POST /v1/deleteCard` · Authenticated with your secret key.

Subscribe to [`card.deleted`](https://docs.prava.space/webhooks/events#card-lifecycle) to reconcile card deletions. The event identifies the card, its Prava customer and your original `user_id`. Repeated deletion requests do not create another logical event.

## Body

**customer\_id** `string` *required*

The customer whose card to delete (the `user_id` used at session creation).

**card\_id** `string` *required*

The card to delete — the same identifier as the `enrollmentId` from the SDK's [`collectPAN`](https://docs.prava.space/sdk/cards/collect-pan) and the `card_id` in [List Cards](https://docs.prava.space/api-reference/list-cards.md).

**reason** `string` (default: OTHER)

Why the card is being deleted: `CUSTOMER_CONFIRMED`, `LOST`, `STOLEN`, `SUSPECTED_FRAUD`, `CLOSED_ACCOUNT`, or `OTHER`.

## Response

**success** `boolean`

Whether the card was deleted.

**card\_id** `string`

The deleted card id.

**was\_default** `boolean`

Whether the deleted card was the customer's default. If `true`, the oldest remaining active card is preselected until a new default is set with [Set Default Card](https://docs.prava.space/api-reference/set-default-card.md).

**network\_token\_deleted** `boolean`

Whether a card-network token was retired as part of the deletion.

## Error responses

| Status | Code | Cause | Resolution |
| - | - | - | - |
| 401 | `AUTH_1001` | Invalid API key | Check your secret key |
| 400 | `INVALID_REQUEST` | Missing `customer_id` or `card_id` | Include both fields |
| 404 | `CUSTOMER_NOT_FOUND` | No customer for the given identifier | Verify `customer_id` |
| 404 | `NOT_FOUND` | Card not found | Verify `card_id` via [List Cards](https://docs.prava.space/api-reference/list-cards.md) |
| 502 | `NETWORK_DELETE_FAILED` | Card-network deletion failed | Retry the request |

```bash cURL theme={null}
curl -X POST https://sandbox.api.prava.space/v1/deleteCard \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{ "customer_id": "user_123", "card_id": "card_1", "reason": "CUSTOMER_CONFIRMED" }'
```

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

resp = requests.post(
    "https://sandbox.api.prava.space/v1/deleteCard",
    headers={"Authorization": "Bearer sk_test_..."},
    json={"customer_id": "user_123", "card_id": "card_1", "reason": "CUSTOMER_CONFIRMED"},
)
```

```javascript JavaScript theme={null}
const resp = await fetch("https://sandbox.api.prava.space/v1/deleteCard", {
  method: "POST",
  headers: {
    Authorization: "Bearer sk_test_...",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    customer_id: "user_123",
    card_id: "card_1",
    reason: "CUSTOMER_CONFIRMED",
  }),
});
```

```json 200 Success theme={null}
{ "success": true, "card_id": "card_1", "was_default": false, "network_token_deleted": true }
```

```json 400 Validation theme={null}
{
  "error": { "code": "INVALID_REQUEST", "message": "Missing customer_id or card_id" }
}
```

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


## OpenAPI

````yaml api-reference/openapi.json POST /v1/deleteCard
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/deleteCard:
    post:
      summary: Delete Card
      description: >-
        Delete an enrolled card for a customer. Also retires the card's network
        token where one exists.
      operationId: deleteCard
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - customer_id
                - card_id
              properties:
                customer_id:
                  type: string
                  description: >-
                    The customer whose card to delete (the user_id used at
                    session creation)
                card_id:
                  type: string
                  description: >-
                    The card to delete (same as enrollmentId from the SDK's
                    collectPAN())
                reason:
                  type: string
                  enum:
                    - CUSTOMER_CONFIRMED
                    - LOST
                    - STOLEN
                    - SUSPECTED_FRAUD
                    - CLOSED_ACCOUNT
                    - OTHER
                  default: OTHER
                  description: Why the card is being deleted
      responses:
        '200':
          description: Card deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  card_id:
                    type: string
                  was_default:
                    type: boolean
                    description: Whether the deleted card was the customer's default
                  network_token_deleted:
                    type: boolean
                    description: >-
                      Whether a card-network token was retired as part of the
                      deletion
        '400':
          description: Missing required field (INVALID_REQUEST)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid or missing API key (AUTH_1001)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Customer or card not found (CUSTOMER_NOT_FOUND / NOT_FOUND)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Card-network deletion failed — retry (NETWORK_DELETE_FAILED)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  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.