---
title: "aid_cards_cardid_token_post"
method: POST
path: "/accounts/{aid}/wallets/cards/{card_id}/tokens"
tags: ["cards"]
---

# aid_cards_cardid_token_post

`POST /accounts/{aid}/wallets/cards/{card_id}/tokens`

## Request

- Base URL: `https://api.dintero.com/v1`
- URL: `https://api.dintero.com/v1/accounts/{aid}/wallets/cards/{card_id}/tokens`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/dintero/apis/account-management-api/docs/accounts/:aid/wallets/cards/:card_id/tokens/post.ts> (a function with typed inputs; its response is checked against the schema)

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

## Path parameters

- `aid` string, ^[PT]{1}\d{8}$, required
- `card_id` string, required

## Request body

- object: Specify how token should be generated
  - `metadata` object: A key-value JSON object to store any additional information. The dintero_* namespace for keys is reserved
  - `ref_id` string, required: 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.
  - `format` object: specify the format for the token, default format is an UUID prefixed with `DINCARD`
    - `length` integer: The length of the token (exclusive length of the prefix)
    - `prefix` string: Prefix the token, the length of the prefix will affect the total length of the token
    - `symbols` boolean: Allow characters like `@#$%` in the created token
    - `numbers` boolean: Allow characters like `123456` in the created token
    - `characters` boolean: Allow characters like `acbABC` in the created token
    - `barcode` boolean: Include token as base64 encoded barcode image
  - `expires_after_transaction` boolean: The token can only be used to create one transaction, card lookup by token will be available until token expires by date
  - `expires_in` integer, required: 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.
  - `token` object
    - `value` string
    - `barcode_128` string: Code 128 barcode representation of the token value. A base64 encoded image in format `data:[<mime type>][;charset=<charset>][;base64],<encoded data>`

## Response `200`

Token created

- Token: Specify how token should be generated
  - `id` string, uuid: An UUID that uniquely identifies the resource
  - `created_at` string, date-time: The date-time when the resource was created
  - `created_by` string: The ID of the user/client that created the resource
  - `metadata` object: A key-value JSON object to store any additional information. The dintero_* namespace for keys is reserved
  - `ref_id` string, required: 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.
  - `format` object: specify the format for the token, default format is an UUID prefixed with `DINCARD`
    - `length` integer: The length of the token (exclusive length of the prefix)
    - `prefix` string: Prefix the token, the length of the prefix will affect the total length of the token
    - `symbols` boolean: Allow characters like `@#$%` in the created token
    - `numbers` boolean: Allow characters like `123456` in the created token
    - `characters` boolean: Allow characters like `acbABC` in the created token
    - `barcode` boolean: Include token as base64 encoded barcode image
  - `expires_after_transaction` boolean: The token can only be used to create one transaction, card lookup by token will be available until token expires by date
  - `expires_in` integer, required: 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.
  - `token` object
    - `value` string
    - `barcode_128` string: Code 128 barcode representation of the token value. A base64 encoded image in format `data:[<mime type>][;charset=<charset>][;base64],<encoded data>`

## Other responses

- `400`: Bad / Invalid request
- `401`: Access forbidden, invalid JWT token was used
- `403`: Forbidden
- `404`: Resource was not found
- `500`: Unexpected Error

---

[API](https://skmtc.dev/dintero/apis/account-management-api.md) - [All operations](https://skmtc.dev/dintero/apis/account-management-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dintero/apis/account-management-api/revisions/9b83a4199008?raw)
