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

# Create a Card

> Creates a new digital gift card and loads the initial funds. A unique `clientReference` must be provided to prevent duplicate card creation. If the same clientReference is submitted a 409 Conflict error is returned.




## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/chron/openapi.documented.yml post /v1/cards
openapi: 3.0.3
info:
  title: Digital Gift Card Issuing API
  version: 1.0.0
  description: |
    API for issuing and managing digital gift cards.
servers:
  - url: https://api.chron.com
security:
  - bearerAuth: []
paths:
  /v1/cards:
    post:
      summary: Create a Card
      description: >
        Creates a new digital gift card and loads the initial funds. A unique
        `clientReference` must be provided to prevent duplicate card creation.
        If the same clientReference is submitted a 409 Conflict error is
        returned.
      operationId: createCard
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCardRequest'
      responses:
        '200':
          description: Card created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Card'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            Duplicate clientReference. A card with the given clientReference
            already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Chron from '@chron/sdk';

            const client = new Chron({
              apiKey: 'My API Key',
            });

            const card = await client.cards.create({
              clientReference: 'clientReference',
              design: 'design',
              expiryDate: '2019-12-27T18:11:19.117Z',
              initialBalance: 0,
              metadata: { foo: 'bar' },
            });

            console.log(card.cardId);
components:
  schemas:
    CreateCardRequest:
      type: object
      properties:
        clientReference:
          type: string
          description: >-
            A unique identifier provided by the client to prevent duplicate card
            creation.
        initialBalance:
          type: number
          description: The starting balance (e.g., up to AUD 500 or AUD 1000).
        expiryDate:
          type: string
          format: date-time
          description: The expiry date/time for the card.
        design:
          type: string
          description: The design or template chosen for the card.
        metadata:
          type: object
          additionalProperties: true
          description: Updateable custom data for the card.
      required:
        - clientReference
        - initialBalance
        - expiryDate
        - design
        - metadata
    Card:
      type: object
      properties:
        cardId:
          type: string
          format: uuid
          description: Unique identifier for the card.
        clientReference:
          type: string
          description: Unique identifier provided by the client to prevent duplication.
        status:
          type: string
          description: Current status of the card.
          enum:
            - WAITING_ACTIVATION
            - ACTIVE
            - CANCELLED
            - BLOCKED
            - REISSUED
            - EXPIRED
        initialBalance:
          type: number
          description: The starting balance on the card.
        currentBalance:
          type: number
          description: The current available balance.
        expiryDate:
          type: string
          format: date-time
          description: The date and time when the card expires.
        design:
          type: string
          description: The design or template selected for the card.
        metadata:
          type: object
          additionalProperties: true
          description: Updateable custom data associated with the card.
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the card was created.
        updatedAt:
          type: string
          format: date-time
          description: Timestamp when the card was last updated.
        activatedAt:
          type: string
          format: date-time
          description: Timestamp when the card was activated (if applicable).
        cancelledAt:
          type: string
          format: date-time
          description: Timestamp when the card was cancelled (null if not cancelled).
        cancellationAmount:
          type: number
          description: >-
            The amount that was unloaded from the card at cancellation (null if
            not cancelled).
        cancellationAction:
          type: string
          description: Action that led to the card's cancellation.
          enum:
            - EXPIRY
            - CANCELLATION
            - REISSUE
        transactions:
          type: array
          description: A list of transactions associated with the card.
          items:
            $ref: '#/components/schemas/Transaction'
      required:
        - cardId
        - clientReference
        - status
        - initialBalance
        - expiryDate
        - design
        - metadata
        - createdAt
        - updatedAt
    ErrorResponse:
      type: object
      properties:
        errorCode:
          type: string
          description: A machine-readable error code.
        message:
          type: string
          description: A human-readable error message.
        details:
          type: object
          additionalProperties: true
          description: Additional details about the error.
      required:
        - errorCode
        - message
    Transaction:
      type: object
      properties:
        transactionId:
          type: string
          description: Unique identifier for the transaction.
        amount:
          type: number
          description: The amount for the transaction.
        type:
          type: string
          description: Type of transaction.
          enum:
            - LOAD
            - UNLOAD
            - PURCHASE
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the transaction was recorded.
      required:
        - transactionId
        - amount
        - type
        - createdAt
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````