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

# Deactivate a Card

> > **Beta:** This endpoint is in beta and may change before general availability.

Transitions a card from `active` or `closed` to `inactive` status.

## Idempotency
The Idempotency-Key header is required.




## OpenAPI

````yaml POST /v0/cards/{id}/deactivate
openapi: 3.0.1
info:
  title: Lead Bank
  description: Lead Bank's APIs
  version: v1.0
servers:
  - url: https://api.sandbox.lead.bank
  - url: https://api.lead.bank
security:
  - bearerAuth: []
tags:
  - name: ACH
  - name: Account Number
  - name: OAuth
  - name: Events
  - name: Instant Payments
  - name: Lending
  - name: Simulation
  - name: Internal Transfer
  - name: Disbursement
  - name: Entity
  - name: Wire
  - name: Originator
  - name: Funding
  - name: Balances
  - name: Compliance
  - name: UserAccount
  - name: Blockchain Payment
paths:
  /v0/cards/{id}/deactivate:
    post:
      tags:
        - Compliance
      summary: Deactivate a card
      description: >
        > **Beta:** This endpoint is in beta and may change before general
        availability.


        Transitions a card from `active` or `closed` to `inactive` status.


        ## Idempotency

        The Idempotency-Key header is required.
      operationId: deactivate-a-card
      parameters:
        - name: id
          in: path
          required: true
          description: The server-generated Card ID.
          schema:
            $ref: '#/components/schemas/CardID'
          example: card_2N5Hk8xYmQpL9rBvC3jD
        - name: Idempotency-Key
          in: header
          required: true
          description: Unique key to ensure idempotent requests
          schema:
            type: string
            maxLength: 255
          example: card-deactivate-12345-abc
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CardDeactivateRequest'
            examples:
              deactivate_with_reason:
                summary: Deactivate with reason
                value:
                  status_reason: dormant
      responses:
        '200':
          description: Card deactivated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Card'
        '400':
          description: Malformed request or missing required header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '401':
          description: Valid access token was not used to call the API.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '403':
          description: Valid access token lacks the proper scopes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '404':
          description: Card ID passed in is not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '422':
          description: Invalid status transition.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
              example:
                code: invalid_status_transition
                title: Invalid status transition.
                detail: Card cannot be deactivated from current status.
                invalid_parameters: []
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '500':
          description: Server error. Please try your request again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
components:
  schemas:
    CardID:
      type: string
      description: The server-generated ID of the Card object.
      example: card_xyz123
      pattern: ^card_\w+$
    CardDeactivateRequest:
      type: object
      description: Request body for deactivating a card.
      properties:
        status_reason:
          $ref: '#/components/schemas/CardDeactivateStatusReason'
      required:
        - status_reason
    Card:
      type: object
      description: A card object
      readOnly: true
      properties:
        id:
          $ref: '#/components/schemas/CardID'
        client_card_id:
          type: string
          readOnly: true
          description: |
            Client-provided identifier for the card. Optional: present only for
            cards created via file upload, and omitted for cards created through
            the API, which are identified solely by their server-generated ID.
        account_id:
          $ref: '#/components/schemas/AccountID'
        entity_id:
          $ref: '#/components/schemas/EntityID'
        status:
          $ref: '#/components/schemas/CardStatus'
        status_reason:
          type: string
          readOnly: true
          description: >
            The reason for the card's current status. Empty when the card is
            `active`; otherwise

            populated. Set via the status-transition endpoints.
        created_at:
          type: string
          format: date-time
          description: Creation timestamp.
          readOnly: true
        updated_at:
          type: string
          format: date-time
          description: Last update timestamp.
          readOnly: true
        details:
          $ref: '#/components/schemas/CardDetails'
        metadata:
          $ref: '#/components/schemas/Metadata'
    APIError:
      type: object
      properties:
        code:
          type: string
          description: The error code.
        title:
          type: string
          description: The error title.
        detail:
          type: string
          description: A detailed error description.
        status:
          type: string
          description: The HTTP status code.
        invalid_parameters:
          type: array
          description: Invalid request parameters with reasons, if applicable.
          items:
            $ref: '#/components/schemas/InvalidParameterDetail'
        instance:
          type: string
          description: >-
            The object causing this specific occurrence of the error, if
            applicable.
    CardDeactivateStatusReason:
      type: string
      description: Valid reasons for deactivating a card.
      enum:
        - dormant
        - frozen
        - other
    AccountID:
      type: string
      description: The ID of the Account object.
      example: account_xyz123
      pattern: ^account_\w+$
    EntityID:
      type: string
      description: The ID of your entity.
      example: entity_xyz123
      pattern: ^entity_[^\s]{1,33}$
    CardStatus:
      type: string
      description: >
        Status is system-managed and cannot be set on create; status changes go
        through the status-transition endpoints.
      enum:
        - active
        - inactive
        - closed
    CardDetails:
      type: object
      description: Physical and product attributes of the card.
      properties:
        card_product_name:
          type: string
          description: The name of the card product in the partner's system.
        is_virtual:
          type: boolean
          description: >-
            True if the card exists as a virtual card; false if a physical
            representation of the card exists.
        card_type:
          $ref: '#/components/schemas/CardType'
        expiry_date:
          type: string
          format: date
          description: >
            ISO 8601 calendar date (YYYY-MM-DD) when the card expires. Always
            the last day of the

            expiration month (e.g. an expiration of 01/29 is `2029-01-31`).
        last_four:
          type: string
          description: >
            Last four digits of the card's PAN. Required when creating a card
            via

            the API; on responses it is omitted for cards that have no PAN on
            file

            (e.g. some file-ingested cards).
          pattern: ^[0-9]{4}$
          example: '1234'
        replacement_for:
          allOf:
            - $ref: '#/components/schemas/CardID'
          description: >
            Optional. The server-generated ID (`card_*`) of the card this new
            card

            replaces. The referenced card must exist, must be in `closed` status
            at

            the time of the write, and must not already be referenced by another

            card. The system atomically sets `replaced_by` on the referenced
            card.
        closed_at:
          type: string
          format: date-time
          description: >-
            Timestamp when the card was closed. Present only when status is
            `closed`.
          readOnly: true
      required:
        - card_product_name
        - is_virtual
        - card_type
        - expiry_date
    Metadata:
      type: object
      additionalProperties:
        type: string
      description: >-
        A set of key-value pairs that can be used to store additional
        information related to this object.
    InvalidParameterDetail:
      type: object
      properties:
        parameter:
          type: string
          description: Which parameter is invalid.
          example: transaction_type
        reason:
          type: string
          description: Why the parameter is invalid.
    CardType:
      type: string
      description: The product category the card belongs to.
      enum:
        - hsa
        - fsa
        - consumer
        - commercial
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````