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

# Get card

> Retrieve the newest unarchived card instance for your API key's account.

## GET `/cards`

Retrieve the newest unarchived card instance for your API key's account.

Send `Authorization: Bearer YOUR_API_KEY` and `X-Device-ID: YOUR_DEVICE_ID`. See [authentication](https://tapcoupon.mintlify.site/authentication.md).

`cardId` and `timestamp` are required query parameters. Send an ISO 8601 timestamp; the current handler checks that it is present.

`cardType` can be `blankCard`, `couponCard`, `loyaltyCard`, `statusCard`, or `pointsCard`. A blank card needs a template before use. `lifetime` is in **hours** from `createdAt`; `0` means unlimited.

`isLocationBound` restricts redemption to the issuing location. `location` contains the current location details when available. Points and status cards include their current `program`. Status `points` represent progress within the current tier and may decrease as awards leave the rolling window.

### Example request

```bash theme={null}
curl "https://tapcoupon.at/api/v1/cards?cardId=9866191586296&timestamp=2026-10-02T12:00:00Z" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Device-ID: YOUR_DEVICE_ID"
```

### Example response fields

```json theme={null}
{
  "cardId": "9866191586296",
  "cardType": "loyaltyCard",
  "activated": true,
  "lifetime": 0,
  "scansNeeded": 5,
  "currentScans": 1,
  "rewardMessage": "You earned a free coffee!",
  "amountRenews": 1,
  "unlimitedRenews": false
}
```


## OpenAPI

````yaml api-reference/openapi.json GET /cards
openapi: 3.1.0
info:
  title: TapCoupon POS and partner API
  version: 1.0.0
  description: >-
    API-key POS operations, customer card views, and partner payment sessions.
    Verified against the tap_coupon backend on 2026-10-02. Dashboard /clients
    and administrative routes use separate authentication and are outside this
    reference.
servers:
  - url: https://tapcoupon.at/api/v1
security: []
paths:
  /cards:
    get:
      tags:
        - Cards
      summary: Get card
      description: Retrieve the newest unarchived card instance for your API key's account.
      operationId: cards_get
      parameters:
        - name: cardId
          in: query
          required: true
          description: Printed or digital card identifier.
          schema:
            type: string
        - name: timestamp
          in: query
          required: true
          description: Request timestamp.
          schema:
            type: string
            format: date-time
        - name: X-Device-ID
          in: header
          required: true
          description: Stable device identifier. API key binds to this value on first use.
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Card'
              example:
                cardId: '9866191586296'
                cardType: loyaltyCard
                activated: true
                lifetime: 0
                scansNeeded: 5
                currentScans: 1
                rewardMessage: You earned a free coffee!
                amountRenews: 1
                unlimitedRenews: false
        '400':
          description: Invalid request, card type, balance, points, or location.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            Missing or invalid API key, device id, employee token, or
            credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            Device binding mismatch, archived location, employee location
            restriction, or account restriction.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            Rate limit exceeded. The response body is determined by the
            rate-limit middleware.
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    Card:
      oneOf:
        - $ref: '#/components/schemas/BlankCard'
        - $ref: '#/components/schemas/CouponCard'
        - $ref: '#/components/schemas/LoyaltyCard'
        - $ref: '#/components/schemas/StatusCard'
        - $ref: '#/components/schemas/PointsCard'
      discriminator:
        propertyName: cardType
        mapping:
          blankCard: '#/components/schemas/BlankCard'
          couponCard: '#/components/schemas/CouponCard'
          loyaltyCard: '#/components/schemas/LoyaltyCard'
          statusCard: '#/components/schemas/StatusCard'
          pointsCard: '#/components/schemas/PointsCard'
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error.
        errorCode:
          type: string
          description: >-
            Handler errors include a machine-readable code; middleware errors
            may omit it.
      required:
        - error
    BlankCard:
      allOf:
        - $ref: '#/components/schemas/BaseCard'
        - type: object
          properties:
            cardType:
              type: string
              enum:
                - blankCard
          required:
            - cardType
    CouponCard:
      allOf:
        - $ref: '#/components/schemas/BaseCard'
        - type: object
          properties:
            cardType:
              type: string
              enum:
                - couponCard
            amountLeft:
              type: integer
              description: Remaining balance in cents.
          required:
            - cardType
    LoyaltyCard:
      allOf:
        - $ref: '#/components/schemas/BaseCard'
        - type: object
          properties:
            cardType:
              type: string
              enum:
                - loyaltyCard
            scansNeeded:
              type: integer
            currentScans:
              type: integer
            rewardMessage:
              type: string
            amountRenews:
              type: integer
            originalAmountRenews:
              type: integer
            unlimitedRenews:
              type: boolean
          required:
            - cardType
    StatusCard:
      allOf:
        - $ref: '#/components/schemas/BaseCard'
        - type: object
          properties:
            cardType:
              type: string
              enum:
                - statusCard
            _:
              type: string
              description: MongoDB object id.
              pattern: ^[a-fA-F0-9]{24}$
            program:
              $ref: '#/components/schemas/StatusProgram'
            level:
              type: string
              description: MongoDB object id.
              pattern: ^[a-fA-F0-9]{24}$
            points:
              type: integer
              description: Progress within the current tier; not the lifetime total.
          required:
            - cardType
    PointsCard:
      allOf:
        - $ref: '#/components/schemas/BaseCard'
        - type: object
          properties:
            cardType:
              type: string
              enum:
                - pointsCard
            _:
              type: string
              description: MongoDB object id.
              pattern: ^[a-fA-F0-9]{24}$
            program:
              $ref: '#/components/schemas/PointsProgram'
            points:
              type: integer
              description: Spendable reward balance.
          required:
            - cardType
    BaseCard:
      type: object
      properties:
        id:
          type: string
          description: MongoDB object id.
          pattern: ^[a-fA-F0-9]{24}$
        cardId:
          type: string
          description: Reusable printed or digital card identifier.
        serialNumber:
          type: integer
        pocketId:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        activatedAt:
          type: string
          format: date-time
        canceledAt:
          type: string
          format: date-time
        activated:
          type: boolean
        lifetime:
          type: integer
          description: Lifetime in hours, measured from createdAt; 0 means unlimited.
          minimum: 0
        description:
          type: string
        amount:
          type: integer
          description: Original coupon value in cents, or template amount for other types.
        location:
          $ref: '#/components/schemas/Location'
        createdByEmployeeId:
          type: string
          description: MongoDB object id.
          pattern: ^[a-fA-F0-9]{24}$
        archived:
          type: boolean
        testCard:
          type: boolean
        isLocationBound:
          type: boolean
          description: When true, use is restricted to the issuing location.
        customerEmail:
          type: string
        templateId:
          type: string
          description: MongoDB object id.
          pattern: ^[a-fA-F0-9]{24}$
        logs:
          type: array
          items:
            type: object
            properties:
              createdAt:
                type: string
                format: date-time
              cardId:
                type: string
              path:
                type: string
              method:
                type: string
              statusCode:
                type: integer
              employeeUsername:
                type: string
    StatusProgram:
      type: object
      properties:
        id:
          type: string
          description: MongoDB object id.
          pattern: ^[a-fA-F0-9]{24}$
        pocketId:
          type: string
        name:
          type: string
        description:
          type: string
        durationDays:
          type: integer
          description: Rolling points window in days.
          minimum: 1
          maximum: 36500
        levels:
          type: array
          items:
            $ref: '#/components/schemas/StatusLevel'
        archived:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    PointsProgram:
      type: object
      properties:
        id:
          type: string
          description: MongoDB object id.
          pattern: ^[a-fA-F0-9]{24}$
        pocketId:
          type: string
        name:
          type: string
        description:
          type: string
        rewardIds:
          type: array
          items:
            type: string
            description: MongoDB object id.
            pattern: ^[a-fA-F0-9]{24}$
        archived:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Location:
      type: object
      properties:
        id:
          type: string
          description: MongoDB object id.
          pattern: ^[a-fA-F0-9]{24}$
        pocketId:
          type: string
        name:
          type: string
        archived:
          type: boolean
      required:
        - id
        - name
    StatusLevel:
      type: object
      properties:
        id:
          type: string
          description: MongoDB object id.
          pattern: ^[a-fA-F0-9]{24}$
        name:
          type: string
        description:
          type: string
        points:
          type: integer
          description: Cost to advance from this level to the next.
          minimum: 0
        color:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Location API key. Also requires X-Device-ID.

````

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