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

# Delete Card Definition

> 
<Info>

<Badge color="gray">Documentation in progress</Badge>

This documentation is in progress. The parameters, fields, request and response bodies, and other data may be subject to change. If you need more information or you want to share feedback, contact [Voucherify support](https://www.voucherify.io/contact-support) or your Technical Account Manager.

</Info>

Deletes a card definition by setting `status` to `DELETED`. Returns the deleted card definition. Returns `400` (`resource_in_use`) when a program, reward, earning rule, tier structure, or benefit still references the card definition.



## OpenAPI

````yaml /openapi/loyalties-v2.json delete /v2/loyalties/card-definitions/{cardDefinitionId}
openapi: 3.1.0
info:
  title: Voucherify API - Loyalty v2
  version: v2018-08-01
  description: >-
    Voucherify promotion engine REST API. Please see
    https://docs.voucherify.io/docs for more details.
  contact:
    name: Voucherify Team
    url: https://www.voucherify.io/contact-support
    email: support@voucherify.io
  termsOfService: https://www.voucherify.io/legal/subscription-agreement
  license:
    name: MIT
    url: https://github.com/voucherifyio/voucherify-js-sdk/blob/main/LICENSE
servers:
  - url: https://{cluster}.voucherify.io
    description: Base URL
    variables:
      cluster:
        default: api
        enum:
          - api
          - us1.api
          - as1.api
          - download
          - us1.download
          - as1.download
security: []
paths:
  /v2/loyalties/card-definitions/{cardDefinitionId}:
    parameters:
      - name: cardDefinitionId
        in: path
        required: true
        description: 'Unique card definition ID. Pattern: `^lcdef_[a-f0-9]+$`.'
        schema:
          type: string
          pattern: ^lcdef_[a-f0-9]+$
    delete:
      tags:
        - Card Definitions
      summary: Delete Card Definition
      description: >-

        <Info>


        <Badge color="gray">Documentation in progress</Badge>


        This documentation is in progress. The parameters, fields, request and
        response bodies, and other data may be subject to change. If you need
        more information or you want to share feedback, contact [Voucherify
        support](https://www.voucherify.io/contact-support) or your Technical
        Account Manager.


        </Info>


        Deletes a card definition by setting `status` to `DELETED`. Returns the
        deleted card definition. Returns `400` (`resource_in_use`) when a
        program, reward, earning rule, tier structure, or benefit still
        references the card definition.
      operationId: deleteCardDefinition
      responses:
        '200':
          description: The deleted card definition.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/V2LoyaltiesCardDefinitionsDeleteResponseBody
        '400':
          description: Validation error - the request body or query parameters are invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Conflict - invalid state transition
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Internal server error:
                  value:
                    code: 500
                    key: api_error
                    message: >-
                      Something went wrong. Don't worry, your campaigns are
                      still safe and the Voucherify Team has been notified.
                      Check out our Help Center and forums for help, or head
                      back to home.
      security:
        - X-App-Id: []
          X-App-Token: []
        - bearerAuth: []
components:
  schemas:
    V2LoyaltiesCardDefinitionsDeleteResponseBody:
      title: V2 Loyalties Card Definitions Delete Response Body
      type: object
      description: >-
        Response body schema for **DELETE**
        `/v2/loyalties/card-definitions/{cardDefinitionId}`.
      allOf:
        - $ref: '#/components/schemas/CardDefinition'
    ErrorResponse:
      type: object
      description: Standard error response returned by all Loyalty v2 endpoints.
      properties:
        code:
          type: integer
          description: HTTP status code of the error.
        key:
          type: string
          description: Machine-readable error key.
        message:
          type: string
          description: Human-readable error message.
        details:
          type: string
          description: Additional details about the error.
        request_id:
          type: string
          description: Unique identifier of the request that produced the error.
        resource_id:
          type: string
          description: Unique identifier of the resource that produced the error.
        resource_type:
          type: string
          description: Type of the resource that produced the error.
    CardDefinition:
      type: object
      description: A card definition.
      properties:
        id:
          type: string
          pattern: ^lcdef_[a-f0-9]+$
          description: Unique card definition ID.
        name:
          type: string
          description: Card definition name.
        type:
          type: string
          enum:
            - INDIVIDUAL
          description: Card definition type.
        status:
          type: string
          enum:
            - DRAFT
            - ACTIVE
            - DELETED
          description: Current card definition status.
        code_config:
          $ref: '#/components/schemas/LoyaltyV2ActivityCardDefinitionCodeConfig'
        points_expiration:
          $ref: '#/components/schemas/CardDefinitionPointsExpiration'
        pending_points:
          $ref: '#/components/schemas/CardDefinitionPendingPoints'
        earning_limits:
          $ref: '#/components/schemas/CardDefinitionEarningLimits'
        spending_limits:
          $ref: '#/components/schemas/CardDefinitionSpendingLimits'
        refunds:
          $ref: '#/components/schemas/CardDefinitionRefunds'
        balance_settings:
          $ref: '#/components/schemas/LoyaltyV2ActivityCardDefinitionBalanceSettings'
        pay_with_points:
          $ref: '#/components/schemas/LoyaltyV2ActivityCardDefinitionPayWithPoints'
        metadata:
          type: object
          description: Arbitrary key-value metadata. Empty object when not set.
        created_at:
          type: string
          format: date-time
          description: Creation timestamp (ISO 8601).
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            Last update timestamp (ISO 8601). `null` when the card definition
            has never been updated.
        object:
          type: string
          const: card_definition
          description: Object type marker. Always `card_definition`.
      required:
        - id
        - name
        - type
        - status
        - code_config
        - points_expiration
        - pending_points
        - earning_limits
        - spending_limits
        - refunds
        - balance_settings
        - pay_with_points
        - metadata
        - created_at
        - updated_at
        - object
    LoyaltyV2ActivityCardDefinitionCodeConfig:
      type: object
      description: >-
        Card code generation configuration. Always present with server-side
        defaults applied.
      properties:
        pattern:
          type: string
          description: >-
            Code pattern where each `#` is replaced with a random character from
            the charset.
        length:
          type: integer
          description: Number of `#` placeholders in the pattern.
        charset:
          type: string
          description: Characters used for code generation.
        prefix:
          type: string
          description: >-
            Fixed prefix prepended to every generated code. Empty string when
            not set.
        postfix:
          type: string
          description: >-
            Fixed postfix appended to every generated code. Empty string when
            not set.
      required:
        - pattern
        - length
        - charset
        - prefix
        - postfix
    CardDefinitionPointsExpiration:
      type: object
      description: Points expiration policy. Always present; defaults to `NO_EXPIRATION`.
      properties:
        type:
          type: string
          enum:
            - NO_EXPIRATION
            - ROLLING_EXPIRATION
            - CALENDAR_EXPIRATION
            - SLIDING_EXPIRATION
          description: Points expiration type.
        rolling_expiration:
          $ref: '#/components/schemas/CardDefinitionPointsExpirationRollingExpiration'
          description: >-
            Rolling expiration configuration. Only present when `type` is
            `ROLLING_EXPIRATION`.
        calendar_expiration:
          $ref: >-
            #/components/schemas/CardDefinitionPointsExpirationCalendarExpiration
          description: >-
            Calendar expiration configuration. Only present when `type` is
            `CALENDAR_EXPIRATION`.
        sliding_expiration:
          $ref: '#/components/schemas/CardDefinitionPointsExpirationSlidingExpiration'
          description: >-
            Sliding expiration configuration. Only present when `type` is
            `SLIDING_EXPIRATION`.
      required:
        - type
    CardDefinitionPendingPoints:
      type: object
      description: >-
        Pending points activation policy. Always present; defaults to
        `IMMEDIATE`.
      properties:
        type:
          type: string
          enum:
            - IMMEDIATE
            - PERIOD_BASED
            - FIXED_DATES
            - EVENT_BASED
          description: Pending points activation type.
        period_based:
          $ref: '#/components/schemas/CardDefinitionPendingPointsPeriodBased'
          description: Period-based activation. Only present when `type` is `PERIOD_BASED`.
        fixed_dates:
          $ref: '#/components/schemas/CardDefinitionPendingPointsFixedDates'
          description: Fixed-dates activation. Only present when `type` is `FIXED_DATES`.
        event_based:
          $ref: '#/components/schemas/CardDefinitionPendingPointsEventBased'
          description: Event-based activation. Only present when `type` is `EVENT_BASED`.
      required:
        - type
    CardDefinitionEarningLimits:
      type: object
      description: >-
        Points earning limits. Always present; defaults to `NO_LIMIT` for both
        scopes.
      properties:
        global:
          $ref: '#/components/schemas/CardDefinitionEarningLimitsGlobal'
        transactions:
          $ref: '#/components/schemas/CardDefinitionEarningLimitsTransactions'
    CardDefinitionSpendingLimits:
      type: object
      description: >-
        Points spending limits. Always present; defaults to `NO_LIMIT` for both
        scopes.
      properties:
        global:
          $ref: '#/components/schemas/CardDefinitionSpendingLimitsGlobal'
        transactions:
          $ref: '#/components/schemas/CardDefinitionSpendingLimitsTransactions'
    CardDefinitionRefunds:
      type: object
      description: >-
        Refund handling configuration. Always present; defaults to `NONE` for
        both scopes.
      properties:
        spent_points:
          $ref: '#/components/schemas/CardDefinitionRefundsSpentPoints'
        earned_points:
          $ref: '#/components/schemas/CardDefinitionRefundsEarnedPoints'
      required:
        - spent_points
        - earned_points
    LoyaltyV2ActivityCardDefinitionBalanceSettings:
      type: object
      description: >-
        Card balance settings. Always present; defaults to `allow_negative:
        false`.
      properties:
        allow_negative:
          type: boolean
          description: Whether the card balance is allowed to go below zero.
      required:
        - allow_negative
    LoyaltyV2ActivityCardDefinitionPayWithPoints:
      type: object
      description: >-
        Pay-with-points configuration. Always present; defaults to
        `NO_PAYMENTS`.
      properties:
        type:
          type: string
          enum:
            - NO_PAYMENTS
            - EXCHANGE_RATIO
          description: Pay-with-points type.
        exchange_ratio:
          type: object
          description: Exchange ratio. Only present when `type` is `EXCHANGE_RATIO`.
          properties:
            formula:
              type: string
              description: Exchange ratio formula (always returned as a string).
          required:
            - formula
      required:
        - type
    CardDefinitionPointsExpirationRollingExpiration:
      type: object
      description: Rolling expiration configuration.
      properties:
        period:
          $ref: '#/components/schemas/LoyaltyV2ActivityCardDefinitionPeriod'
          description: Rolling expiration period. Unit is one of `DAY`, `MONTH`, `YEAR`.
        rounding:
          oneOf:
            - $ref: >-
                #/components/schemas/LoyaltyV2ActivityCardDefinitionPointsExpirationRollingExpirationRounding
            - type: 'null'
          description: >-
            Rounding applied to the calculated expiration date. `null` when not
            configured.
      required:
        - period
    CardDefinitionPointsExpirationCalendarExpiration:
      type: object
      description: Calendar expiration configuration.
      properties:
        expiration_dates:
          type: array
          items:
            $ref: '#/components/schemas/LoyaltyV2ActivityCardDefinitionCalendarDate'
          description: Calendar dates on which points expire.
      required:
        - expiration_dates
    CardDefinitionPointsExpirationSlidingExpiration:
      description: Sliding expiration configuration.
      allOf:
        - $ref: '#/components/schemas/CardDefinitionSlidingExpirationActivityBase'
        - type: object
          properties:
            custom_activity_types:
              type: array
              items:
                type: string
              description: >-
                Custom event schema IDs that reset the expiration window. Empty
                array when `custom_activity` is false.
            period:
              $ref: '#/components/schemas/LoyaltyV2ActivityCardDefinitionPeriod'
              description: >-
                Sliding expiration period. Unit is one of `DAY`, `MONTH`,
                `YEAR`.
          required:
            - custom_activity_types
            - period
    CardDefinitionPendingPointsPeriodBased:
      type: object
      description: Period-based pending points activation.
      properties:
        period:
          $ref: '#/components/schemas/LoyaltyV2ActivityCardDefinitionPeriod'
          description: Pending period. Unit is one of `DAY`, `MONTH`, `YEAR`.
      required:
        - period
    CardDefinitionPendingPointsFixedDates:
      type: object
      description: Fixed-dates pending points activation.
      properties:
        dates:
          type: array
          items:
            $ref: '#/components/schemas/LoyaltyV2ActivityCardDefinitionCalendarDate'
          description: Calendar dates on which pending points activate.
      required:
        - dates
    CardDefinitionPendingPointsEventBased:
      type: object
      description: Event-based pending points activation.
      properties:
        event_types:
          type: array
          items:
            type: string
          description: Custom event schema IDs that activate pending points.
        cancel_period:
          $ref: '#/components/schemas/LoyaltyV2ActivityCardDefinitionPeriod'
          description: >-
            Period after which non-activated pending points are cancelled. Unit
            is one of `DAY`, `MONTH`, `YEAR`.
      required:
        - event_types
        - cancel_period
    CardDefinitionEarningLimitsGlobal:
      type: object
      description: Global (per card) earning limits.
      properties:
        type:
          type: string
          enum:
            - NO_LIMIT
            - LIMITED
          description: Whether global earning limits apply.
        limits:
          type: array
          items:
            $ref: '#/components/schemas/CardDefinitionEarningLimitsGlobalLimit'
          description: Limit definitions. Empty array when `type` is `NO_LIMIT`.
      required:
        - type
        - limits
    CardDefinitionEarningLimitsTransactions:
      type: object
      description: Per-transaction earning limits.
      properties:
        type:
          type: string
          enum:
            - NO_LIMIT
            - LIMITED
          description: Whether per-transaction earning limits apply.
        limits:
          type: array
          items:
            $ref: >-
              #/components/schemas/LoyaltyV2ActivityCardDefinitionEarningLimitsTransactionsLimit
          description: Limit definitions. Empty array when `type` is `NO_LIMIT`.
      required:
        - type
        - limits
    CardDefinitionSpendingLimitsGlobal:
      type: object
      description: Global (per card) spending limits.
      properties:
        type:
          type: string
          enum:
            - NO_LIMIT
            - LIMITED
          description: Whether global spending limits apply.
        limits:
          type: array
          items:
            $ref: '#/components/schemas/CardDefinitionSpendingLimitsGlobalLimit'
          description: Limit definitions. Empty array when `type` is `NO_LIMIT`.
      required:
        - type
        - limits
    CardDefinitionSpendingLimitsTransactions:
      type: object
      description: Per-transaction spending limits.
      properties:
        type:
          type: string
          enum:
            - NO_LIMIT
            - LIMITED
          description: Whether per-transaction spending limits apply.
        limits:
          type: array
          items:
            $ref: >-
              #/components/schemas/LoyaltyV2ActivityCardDefinitionSpendingLimitsTransactionsLimit
          description: Limit definitions. Empty array when `type` is `NO_LIMIT`.
      required:
        - type
        - limits
    CardDefinitionRefundsSpentPoints:
      type: object
      description: How points spent on a refunded order are handled.
      properties:
        type:
          type: string
          enum:
            - NONE
            - REFUNDABLE
          description: Whether spent points are refundable.
        methods:
          type: array
          items:
            $ref: >-
              #/components/schemas/LoyaltyV2ActivityCardDefinitionRefundsSpentPointsMethod
          description: Refund methods. Empty array when `type` is `NONE`.
      required:
        - type
        - methods
    CardDefinitionRefundsEarnedPoints:
      type: object
      description: How points earned on a refunded order are handled.
      properties:
        type:
          type: string
          enum:
            - NONE
            - REFUNDABLE
          description: Whether earned points are revocable on refund.
        methods:
          type: array
          items:
            $ref: >-
              #/components/schemas/LoyaltyV2ActivityCardDefinitionRefundsEarnedPointsMethod
          description: Revoke methods. Empty array when `type` is `NONE`.
      required:
        - type
        - methods
    LoyaltyV2ActivityCardDefinitionPeriod:
      type: object
      description: A period expressed as a value and unit.
      properties:
        value:
          type: integer
          description: Period length.
        unit:
          type: string
          enum:
            - DAY
            - MONTH
            - YEAR
          description: Period unit.
      required:
        - value
        - unit
    LoyaltyV2ActivityCardDefinitionPointsExpirationRollingExpirationRounding:
      type: object
      description: Rounding of the rolling expiration date.
      properties:
        type:
          type: string
          enum:
            - END_OF_MONTH
            - END_OF_QUARTER
            - END_OF_HALF_YEAR
            - END_OF_YEAR
            - END_OF_PARTICULAR_MONTH
          description: Rounding type.
        value:
          type: integer
          minimum: 1
          maximum: 12
          description: >-
            Month number (1-12). Only present when `type` is
            `END_OF_PARTICULAR_MONTH`.
      required:
        - type
    LoyaltyV2ActivityCardDefinitionCalendarDate:
      type: object
      description: A calendar date (day + month).
      properties:
        day:
          type: integer
          minimum: 1
          maximum: 31
          description: Day of the month.
        month:
          type: integer
          minimum: 1
          maximum: 12
          description: Month number (1-12).
      required:
        - day
        - month
    CardDefinitionSlidingExpirationActivityBase:
      type: object
      properties:
        earning_activity:
          type: boolean
          description: Whether earning points resets the expiration window.
        spending_activity:
          type: boolean
          description: Whether spending points resets the expiration window.
        custom_activity:
          type: boolean
          description: Whether the configured custom events reset the expiration window.
    CardDefinitionEarningLimitsGlobalLimit:
      description: 'A global earning limit: `BALANCE_BASED` or `TIME_BASED`.'
      oneOf:
        - type: object
          description: Balance-based limit.
          properties:
            type:
              type: string
              const: BALANCE_BASED
              description: Limit type.
            max:
              type: integer
              description: Maximum card balance in points.
          required:
            - type
            - max
        - type: object
          description: Time-based limit.
          properties:
            type:
              type: string
              const: TIME_BASED
              description: Limit type.
            period:
              $ref: >-
                #/components/schemas/LoyaltyV2ActivityCardDefinitionLimitTimeBasedPeriod
            points:
              $ref: >-
                #/components/schemas/LoyaltyV2ActivityCardDefinitionLimitTimeBasedPoints
          required:
            - type
      discriminator:
        propertyName: type
    LoyaltyV2ActivityCardDefinitionEarningLimitsTransactionsLimit:
      description: 'A per-transaction earning limit: `POINTS` or `SPENDING`.'
      oneOf:
        - type: object
          description: Points limit.
          properties:
            type:
              type: string
              const: POINTS
              description: Limit type.
            max:
              type: integer
              description: Maximum points earned per transaction.
          required:
            - type
            - max
        - type: object
          description: Spending threshold.
          properties:
            type:
              type: string
              const: SPENDING
              description: Limit type.
            min_amount:
              type: integer
              description: Minimum transaction amount required to earn points.
          required:
            - type
            - min_amount
      discriminator:
        propertyName: type
    CardDefinitionSpendingLimitsGlobalLimit:
      description: 'A global spending limit: `SPENDING_BASED` or `TIME_BASED`.'
      oneOf:
        - type: object
          description: Spending-based limit.
          properties:
            type:
              type: string
              const: SPENDING_BASED
              description: Limit type.
            max:
              type: integer
              description: Maximum total points spent.
          required:
            - type
            - max
        - type: object
          description: Time-based limit.
          properties:
            type:
              type: string
              const: TIME_BASED
              description: Limit type.
            period:
              $ref: >-
                #/components/schemas/LoyaltyV2ActivityCardDefinitionLimitTimeBasedPeriod
            points:
              $ref: >-
                #/components/schemas/LoyaltyV2ActivityCardDefinitionLimitTimeBasedPoints
          required:
            - type
      discriminator:
        propertyName: type
    LoyaltyV2ActivityCardDefinitionSpendingLimitsTransactionsLimit:
      type: object
      description: >-
        A per-transaction spending limit. Currently only the `POINTS` type
        exists.
      properties:
        type:
          type: string
          const: POINTS
          description: Limit type.
        max:
          type: integer
          description: Maximum points spent per transaction.
      required:
        - type
        - max
    LoyaltyV2ActivityCardDefinitionRefundsSpentPointsMethod:
      type: object
      description: A spent points refund method.
      properties:
        type:
          type: string
          const: RETURN_POINTS
          description: Refund method type.
        mode:
          type: string
          enum:
            - REFUND_ALL
            - REFUND_ITEM
            - REFUND_AMOUNT
          description: Refund mode.
      required:
        - type
        - mode
    LoyaltyV2ActivityCardDefinitionRefundsEarnedPointsMethod:
      description: >-
        An earned points revoke method: `REVOKE_FROM_PENDING` or
        `REVOKE_FROM_BALANCE`.
      oneOf:
        - type: object
          description: Revoke earned points from pending points.
          properties:
            type:
              type: string
              const: REVOKE_FROM_PENDING
              description: Revoke method type.
          required:
            - type
        - type: object
          description: Revoke earned points from the card balance.
          properties:
            type:
              type: string
              const: REVOKE_FROM_BALANCE
              description: Revoke method type.
            mode:
              type: string
              enum:
                - REVOKE_TO_ZERO
                - REVOKE_BELOW_ZERO
              description: Revoke mode.
          required:
            - type
            - mode
      discriminator:
        propertyName: type
    LoyaltyV2ActivityCardDefinitionLimitTimeBasedPeriod:
      type: object
      description: Time-based limit period.
      properties:
        type:
          type: string
          enum:
            - CURRENT_PERIOD
          description: Period type.
        current_period:
          type: object
          description: >-
            Current-period configuration. Present when `type` is
            `CURRENT_PERIOD`.
          properties:
            unit:
              type: string
              enum:
                - DAY
                - WEEK
                - MONTH
                - QUARTER
                - YEAR
              description: Calendar period unit.
          required:
            - unit
      required:
        - type
    LoyaltyV2ActivityCardDefinitionLimitTimeBasedPoints:
      type: object
      description: Points cap for a time-based limit.
      properties:
        max:
          type: integer
          description: Maximum points within the period.
      required:
        - max
  securitySchemes:
    X-App-Id:
      type: apiKey
      name: X-App-Id
      in: header
    X-App-Token:
      type: apiKey
      name: X-App-Token
      in: header
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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