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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.dintero.com/feedback

```json
{
  "path": "/api-reference/cards/create-a-token-for-the-card",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Create a token for the card

> Create a temporary `token` (also referred as Card Code)
for the card, an temporary alias that must be used when
when creating a drawdown transaction

The token can be stored in a barcode to allow use of virtuell card
in purchase in POS or webstore

scopes:
- admin:wallets
- write:wallets




## OpenAPI

````yaml /mintlify-docs/openapi/spec-wallets.yaml post /accounts/{aid}/wallets/cards/{card_id}/tokens
openapi: 3.0.0
info:
  title: Wallet / Cards API
  description: >
    API for managing virtual cards, digital gift cards and transactions


    # Changelog


    All notable changes to the API.


    ## 2026-06-06


    > **new**: Add support for batch create cards that can be activated.
    Intended

    > for use case where physical cards will be issued from the Wallet cards.
    The

    > cards created will all have status `created` and needs to be activated
    before

    > use

    >

    > - [POST
    /v1/accounts/{aid}/wallets/cards/batch](#tag/cards/operation/aid_cards_batch_post)

    > - [POST
    /v1/accounts/{aid}/wallets/cards/{card_id}/activate](#tag/cards/operation/aid_cards_cardid_activate_post)


    ## 2025-02-06


    > **new**: Add optional query parameter `includes` and extend card details
    with pin and token format

    > - [GET
    /v1/accounts/{aid}/wallets/cards/{card_id}](#tag/cards/operation/aid_cards_cardid_get)


    ## 2025-01-30


    > **new**: Add endpoint for rotating or generating pin for card

    > - [POST
    /v1/accounts/{aid}/wallets/cards/{card_id}/rotate-pin](#tag/cards/operation/aid_cards_cardid_rotate_pin_post)


    ## 2024-12-16


    > **new**: Add `amount_reserved` on card balance, add `status` to card
    properties

    >

    > - [GET
    /v1/accounts/{aid}/wallets/cards](#tag/cards/operation/aid_cards_get)

    > - [GET
    /v1/accounts/{aid}/wallets/cards/{card_id}](#tag/cards/operation/aid_cards_cardid_get)


    ## 2024-12-11


    > **new**: Add `amount_available` query param filter on getting cards

    >

    > - [GET
    /v1/accounts/{aid}/wallets/cards](#tag/cards/operation/aid_cards_get)


    ## 2024-12-05


    > **new**: Add `amount_funds`, `amount_drawdown`, `amount_pending` on card
    balance

    > 

    >

    > - [GET
    /v1/accounts/{aid}/wallets/cards](#tag/cards/operation/aid_cards_get)

    > - [GET
    /v1/accounts/{aid}/wallets/cards/{card_id}](#tag/cards/operation/aid_cards_cardid_get)


    ## 2024-11-28


    > **update**: Revert adding deletion properties to cards

    >

    > **new**: Add `originated_by` to card and transaction properties

    >

    > - [GET
    /v1/accounts/{aid}/wallets/cards](#tag/cards/operation/aid_cards_get)

    > - [GET
    /v1/accounts/{aid}/wallets/cards/{card_id}](#tag/cards/operation/aid_cards_cardid_get)

    > - [GET
    /v1/accounts/{aid}/wallets/cards/{card_id}/transactions](#tag/cards/operation/aid_cards_cardid_transactions_tid_get)

    > - [POST
    /v1/accounts/{aid}/wallets/transactions](#tag/transactions/operation/aid_cards_transactions_post)

    > - [POST
    /v1/accounts/{aid}/wallets/transactions/{transaction_id}/capture](#tag/transactions/operation/aid_cards_cardid_transactions_capture_post)

    > - [POST
    /v1/accounts/{aid}/wallets/transactions/{transaction_id}/void](#tag/transactions/operation/aid_cards_cardid_transactions_void_post)


    ## 2024-11-27


    > **new**: Add endpoint for deleting a card

    > 

    > **new**: `include_deleted` query parameter for including deleted cards

    >

    > - [DELETE
    /v1/accounts/{aid}/wallets/cards/{card_id}](#tag/cards/operation/aid_cards_cardid_delete)

    > - [GET
    /v1/accounts/{aid}/wallets/cards](#tag/cards/operation/aid_cards_get)


    ## 2024-11-13


    > **new**: Add endpoint for getting cards on account

    >

    > **new**: Add support for defining type of card

    >

    > - [GET
    /v1/accounts/{aid}/wallets/cards](#tag/cards/operation/aid_cards_get)

    > - [POST
    /v1/accounts/{aid}/wallets/cards](#tag/cards/operation/aid_cards_post)


    ## 2024-11-01


    > **update**: Adjust minimum length of PIN when creating a new card from 6
    to 4.

    >

    > - [POST
    /v1/accounts/{aid}/wallets/cards](#tag/cards/operation/aid_cards_post)


    ## 2024-06-10


    > **new**: Allow more currencies: `SEK`, `DKK`, `EUR`, and `USD`.

    >

    > - [POST
    /v1/accounts/{aid}/wallets/cards](#tag/cards/operation/aid_cards_post)

    > - [POST
    /v1/accounts/{aid}/wallets/transactions](#tag/transactions/operation/aid_cards_transactions_post)

    > - [GET
    /v1/accounts/{aid}/wallets/cards/{card_id}](#tag/cards/operation/aid_cards_cardid_get)

    > - [GET
    /v1/accounts/{aid}/wallets/customers/{customer_id}/cards/{card_id}](#tag/customers/operation/aid_customers_cid_card_cid_get)


    ## 2024-02-01


    > **new**: Add option to create card with `pin` and support for

    > including pin when getting card info and when creating new

    > transaction

    >

    > - [POST
    /v1/accounts/{aid}/wallets/cards](#tag/cards/operation/aid_cards_post)

    > - [POST /v1/accounts/{aid}/wallets/info](#operation/aid_cards_token_post)

    > - [POST
    /v1/accounts/{aid}/wallets/transactions](#operation/aid_cards_transactions_post)


    ## 2023-07-07


    > **new**: Add optional `name` field to `Card`.

    >

    > - [POST
    /v1/accounts/{aid}/wallets/cards](#tag/cards/operation/aid_cards_post)

    > - [GET
    /v1/accounts/{aid}/wallets/cards/{card_id}](#tag/cards/operation/aid_cards_cardid_get)

    > - [GET
    /v1/accounts/{aid}/wallets/customers/{customer_id}/cards](#tag/customers/operation/aid_customers_cid_cards_get)

    > - [GET
    /v1/accounts/{aid}/wallets/customers/{customer_id}/cards/{card_id}](#tag/customers/operation/aid_customers_cid_card_cid_get)


    ## 2023-06-12


    > **new**: Get details on customer card using `customer_id` and `card_id`.

    >

    > - [GET
    /v1/accounts/{aid}/wallets/customers/{customer_id}/cards/{card_id}](#tag/customers/operation/aid_customers_cid_card_cid_get)


    ## 2023-06-01


    > **new** Support creating card with `active_from` to control when

    > the created card is activated and allows `drawdown` transactions to be

    > created

    >

    > - [POST
    /v1/accounts/{aid}/wallets/cards](#tag/cards/operation/aid_cards_post)


    > **new** Support creating fund transaction using `type` property.

    >

    > - [POST
    /v1/accounts/{aid}/wallets/transactions](#tag/transactions/operation/aid_cards_transactions_post)


    > **new** Support creating transaction using `card_id`.

    >

    > - [POST
    /v1/accounts/{aid}/wallets/transactions](#tag/transactions/operation/aid_cards_transactions_post)


    > **new**: Support listing cards by customer_id, allow customer with

    > access to `user:wallets` scope to list their cards with balance

    >

    > - [GET
    /v1/accounts/{aid}/wallets/customers/{cid}/cards](#tag/customers/operation/aid_customers_cid_cards_get)
  contact:
    name: API Integration Support
    email: integration@dintero.com
  version: 1.0.0
  license:
    name: UNLICENSED
    url: https://dintero.com
servers:
  - url: https://api.dintero.com/v1
security:
  - JWT: []
paths:
  /accounts/{aid}/wallets/cards/{card_id}/tokens:
    post:
      tags:
        - cards
      summary: Create a token for the card
      description: |
        Create a temporary `token` (also referred as Card Code)
        for the card, an temporary alias that must be used when
        when creating a drawdown transaction

        The token can be stored in a barcode to allow use of virtuell card
        in purchase in POS or webstore

        scopes:
        - admin:wallets
        - write:wallets
      operationId: aid_cards_cardid_token_post
      parameters:
        - $ref: '#/components/parameters/accountId'
        - $ref: '#/components/parameters/cardId'
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/Metadata'
                - $ref: '#/components/schemas/BaseOperation'
                - $ref: '#/components/schemas/TokenGenerator'
        description: token details
        required: true
      responses:
        '200':
          description: Token created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Token'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/AccessForbidden'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - JWT: []
components:
  parameters:
    accountId:
      name: aid
      description: |
        An id that uniquely identifies the account.
      in: path
      required: true
      schema:
        type: string
        format: ^[PT]{1}\d{8}$
        minLength: 9
        maxLength: 9
    cardId:
      name: card_id
      description: |
        The card id you have defined for the card.
        (must not have trailing or leading spaces)
      in: path
      required: true
      schema:
        type: string
        maxLength: 255
  schemas:
    Metadata:
      type: object
      properties:
        metadata:
          type: object
          description: |
            A key-value JSON object to store any additional
            information. The dintero_* namespace for keys
            is reserved
          example:
            order_id: xk39592f
    BaseOperation:
      type: object
      required:
        - ref_id
      properties:
        ref_id:
          type: string
          description: |
            Unique ref ID provided by the client to support safely retrying
            requests without accidentally performing the same operation twice

            All card transaction must have a unique ref ID, but it is not
            required that the ref ID is globally unique.
    TokenGenerator:
      type: object
      description: Specify how token should be generated
      required:
        - expires_in
      properties:
        format:
          allOf:
            - $ref: '#/components/schemas/Format'
            - description: |
                specify the format for the token, default format
                is an UUID prefixed with `DINCARD`
        expires_after_transaction:
          type: boolean
          description: |
            The token can only be used to create one transaction, card lookup by
            token will be available until token expires by date
          default: true
        expires_in:
          description: |
            The lifetime in seconds for the card token.  For
            example, the value "3600" denotes that the token will
            expire in one hour from the time the response was generated.
          minimum: 1
          type: integer
        token:
          type: object
          readOnly: true
          properties:
            value:
              type: string
              example: DINCARD:6ccfec5d-3a53-47de-910a-97d6dda22e5f
              maxLength: 48
            barcode_128:
              type: string
              description: >
                Code 128 barcode representation of the token value. A base64
                encoded

                image in format `data:[<mime
                type>][;charset=<charset>][;base64],<encoded data>`
              example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA...
    Token:
      type: object
      allOf:
        - $ref: '#/components/schemas/ImmutableEntity'
        - $ref: '#/components/schemas/Metadata'
        - $ref: '#/components/schemas/BaseOperation'
        - $ref: '#/components/schemas/TokenGenerator'
    Format:
      description: Specify the format to generate
      type: object
      properties:
        length:
          description: |
            The length of the token (exclusive length of the prefix)
          type: integer
          default: 36
          minimum: 6
        prefix:
          type: string
          description: |
            Prefix the token, the length of the prefix will affect
            the total length of the token
          example: 'DINCARD:'
          maxLength: 12
        symbols:
          type: boolean
          description: Allow characters like `@#$%` in the created token
          default: true
        numbers:
          type: boolean
          description: Allow characters like `123456` in the created token
          default: true
        characters:
          type: boolean
          description: Allow characters like `acbABC` in the created token
        barcode:
          default: false
          description: |
            Include token as base64 encoded barcode image
          type: boolean
    ImmutableEntity:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: |
            An UUID that uniquely identifies the resource
          readOnly: true
        created_at:
          type: string
          format: date-time
          description: |
            The date-time when the resource was created
          readOnly: true
        created_by:
          type: string
          example: 1c92f7e1-2897-4d46-bdcc-c127a914fb4e
          description: |
            The ID of the user/client that created the resource
          readOnly: true
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            code:
              type: string
              description: The code used to identify the error/warning
            errors:
              type: array
              description: The nested error(s) encountered during validation
              items:
                type: object
            message:
              type: string
              description: The human readable description of the error/warning
  responses:
    BadRequest:
      description: Bad / Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    AccessForbidden:
      description: Access forbidden, invalid JWT token was used
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: Unexpected Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    JWT:
      type: http
      description: >
        Bearer authentication (token authentication) should be used for
        accessing the API.


        Use [Get
        Token](https://docs.dintero.com/api.html#operation/aid_auths_oauth_token_post)
        to get an access token for client credentials.

        Pass the token in the request header:

            Authorization: Bearer {access_token}

        where the **access_token** is JSON Web Tokens (JWT).
      scheme: bearer
      bearerFormat: JWT

````