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

# Invalidate Gift Card

> Invalidate the gift card on a mailed piece so it can no longer be redeemed, for example when a card was sent by mistake. This does the same as the **Invalidate** button on the Order Details page, and it can't be undone. `PATCH` is accepted as well as `PUT`.

Only an unredeemed card that hasn't already been invalidated can be invalidated. The order must belong to the authenticated account.

The response is the updated order item, in the same shape as List Order Items. The redemption code, claim link and rendered card image are never returned.



## OpenAPI

````yaml put /order-items/{orderItemId}/invalidate-giftcard
openapi: 3.1.0
info:
  title: thanks.io API
  description: >-
    Use the thanks.io API to send postcards, letters, notecards, windowless
    letters, and gift cards.
  contact:
    url: https://www.thanks.io
    email: support@thanks.io
  version: 1.0.0
servers:
  - url: https://api.thanks.io/api/v2
    description: The main API server for thanks.io
security:
  - bearerAuth: []
tags:
  - name: Recipients
  - name: Mailing Lists
  - name: Send Mailer
  - name: Order Estimates
  - name: Orders
  - name: Message Templates
  - name: Image Templates
  - name: Handwriting Styles
  - name: Giftcards
  - name: Dynamic Images
    description: ''
  - name: Image Builder
  - name: Sub Accounts
  - name: Webhooks
  - name: Webhook Events
externalDocs:
  description: Learn more about thanks.io
  url: https://docs.thanks.io
paths:
  /order-items/{orderItemId}/invalidate-giftcard:
    parameters:
      - name: orderItemId
        in: path
        schema:
          type: integer
        required: true
        description: >-
          ID of the order item whose gift card you want to invalidate. This is
          the `id` returned by List Order Items and carried by order item
          webhook events.
    put:
      tags:
        - Orders
      summary: Invalidate Gift Card
      description: >-
        Invalidate the gift card on a mailed piece so it can no longer be
        redeemed, for example when a card was sent by mistake. This does the
        same as the **Invalidate** button on the Order Details page, and it
        can't be undone. `PATCH` is accepted as well as `PUT`.


        Only an unredeemed card that hasn't already been invalidated can be
        invalidated. The order must belong to the authenticated account.


        The response is the updated order item, in the same shape as List Order
        Items. The redemption code, claim link and rendered card image are never
        returned.
      responses:
        '200':
          description: The gift card was invalidated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/order-item'
              example:
                data:
                  id: 2668662
                  status: Delivered
                  delivery_date: '2025-09-15'
                  scans: 0
                  failure: null
                  recipient:
                    name: Jane Doe
                    company: null
                    address: 456 Another St
                    address2: ''
                    city: Fake City
                    province: NY
                    postal_code: '55555'
                    country: US
                    email: null
                    phone: null
                    custom1: null
                    custom2: null
                    custom3: null
                    custom4: null
                    custom5: null
                    custom6: null
                    custom7: null
                    custom8: null
                    custom9: null
                    custom10: null
                  giftcard:
                    brand: amazonus
                    amount: 2500
                    redeemed_at: null
                    invalidated_at: '2025-09-20T14:02:11.000000Z'
                  created_at: '2025-09-08T16:05:12.000000Z'
        '401':
          description: >-
            The access token is missing or invalid, or the order belongs to
            another account.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: failed
                  errors:
                    type: array
                    items:
                      type: string
                    example:
                      - Unauthorized
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: >-
            The gift card can't be invalidated: it was already redeemed or
            invalidated, the item isn't on a gift card order, or the item has no
            gift card.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: failed
                  errors:
                    type: array
                    items:
                      type: string
                    example:
                      - Giftcard has already been redeemed.
              examples:
                Already Redeemed:
                  value:
                    status: failed
                    errors:
                      - Giftcard has already been redeemed.
                Already Invalidated:
                  value:
                    status: failed
                    errors:
                      - Giftcard has already been invalidated.
                Not a Gift Card Order:
                  value:
                    status: failed
                    errors:
                      - Order is not a giftcard order.
components:
  schemas:
    order-item:
      type: object
      description: >-
        A single mail piece within an order — one recipient's postcard, letter,
        notecard, magnacard or gift card.
      properties:
        id:
          type: integer
          description: >-
            ID of the order item. This is the same identifier carried by order
            item webhook events.
          example: 2668662
        status:
          type: string
          description: Current delivery status of this piece.
          enum:
            - Processing
            - Printed
            - In Transit
            - In Local Area
            - Processed for Delivery
            - Delivered
            - Re-routed
            - Returned to Sender
            - Failed
          example: In Transit
        delivery_date:
          type:
            - string
            - 'null'
          format: date
          description: >-
            Date the piece was delivered, or `null` if it has not been delivered
            yet.
          example: '2025-09-15'
        scans:
          type: integer
          description: Number of times this piece's QR code has been scanned.
          example: 0
        failure:
          type:
            - string
            - 'null'
          description: >-
            Reason the piece could not be mailed or delivered, or `null` if
            there was no failure.
          example: >-
            USPS lists address as 'no-stat' - address is unlikely to receive
            mail.
        recipient:
          type: object
          description: >-
            Recipient details as submitted with the order — the mailing address
            plus the ten custom fields.
          properties:
            name:
              type:
                - string
                - 'null'
              example: Tobias Example
            company:
              type:
                - string
                - 'null'
              example: thanks.io
            address:
              type:
                - string
                - 'null'
              example: 12345 Main Street
            address2:
              type:
                - string
                - 'null'
              example: Apartment 1
            city:
              type:
                - string
                - 'null'
              example: Any Town
            province:
              type:
                - string
                - 'null'
              description: State or Province
              example: KS
            postal_code:
              type:
                - string
                - 'null'
              example: '12345'
            country:
              type:
                - string
                - 'null'
              example: US
            email:
              type:
                - string
                - 'null'
              example: tobias@example.com
            phone:
              type:
                - string
                - 'null'
              example: '5555555555'
            custom1:
              type:
                - string
                - 'null'
              description: Custom field 1 as submitted with the order.
              example: Unique Info
            custom2:
              type:
                - string
                - 'null'
              description: Custom field 2 as submitted with the order.
              example: For example a product code or customer ID
            custom3:
              type:
                - string
                - 'null'
              description: Custom field 3 as submitted with the order.
              example: ''
            custom4:
              type:
                - string
                - 'null'
              description: Custom field 4 as submitted with the order.
              example: ''
            custom5:
              type:
                - string
                - 'null'
              description: Custom field 5 as submitted with the order.
              example: ''
            custom6:
              type:
                - string
                - 'null'
              description: Custom field 6 as submitted with the order.
              example: ''
            custom7:
              type:
                - string
                - 'null'
              description: Custom field 7 as submitted with the order.
              example: ''
            custom8:
              type:
                - string
                - 'null'
              description: Custom field 8 as submitted with the order.
              example: ''
            custom9:
              type:
                - string
                - 'null'
              description: Custom field 9 as submitted with the order.
              example: ''
            custom10:
              type:
                - string
                - 'null'
              description: Custom field 10 as submitted with the order.
              example: ''
        giftcard:
          type:
            - object
            - 'null'
          description: >-
            Present only on gift card orders. `null` when the gift card for this
            piece has not been issued yet. The redemption code, claim link and
            rendered card image are never returned.
          properties:
            brand:
              type: string
              description: Brand code of the gift card.
              example: amazonus
            amount:
              type: integer
              description: Face value of the gift card in cents.
              example: 2500
            redeemed_at:
              type:
                - string
                - 'null'
              format: date-time
              description: >-
                When the recipient redeemed the gift card, or `null` if it has
                not been redeemed.
              example: null
            invalidated_at:
              type:
                - string
                - 'null'
              format: date-time
              description: >-
                When the gift card was invalidated, or `null` if it has not
                been. An invalidated gift card can no longer be redeemed.
              example: null
        created_at:
          type: string
          format: date-time
          example: '2025-09-08T16:05:12.000000Z'
  responses:
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                example: Not Found
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication using your thanks.io API key

````