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

## Notes

* `card_id` is the same identifier as the `enrollmentId` returned by the SDK's
  [`collectPAN`](/sdk/cards/collect-pan) and the `card_id` in [List Cards](/api-reference/list-cards).
* Deletion also retires the card's network token (the tokenized stand-in for the card at the card
  network) where one exists — `network_token_deleted` in the response tells you whether that happened.
* If the deleted card was the customer's default, `was_default` is `true`; the customer picks a new
  default on their next payment.

## 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](/api-reference/list-cards) |
| 502    | `NETWORK_DELETE_FAILED` | Card-network deletion failed         | Retry the request                                            |


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

````