---
title: "Create"
method: POST
path: "/token/create"
tags: ["Token"]
---

# Create

`POST /token/create`

This method allows the calling application to create a new Token within AIR platform.

## Request body

- object
  - `resourceType` 'CAMPAIGN' | 'PROGRAMME', required — Type of Account Token to be created
  - `resourceId` integer, required — Campaign ID or Programme ID (depending on `resourceType` value)
  - `barcodeImage` true — An optional boolean flag to instruct AIR to include into returned Response an additional attribute `barcodeImage` containing base64-encoded Barcode Image of the Token. Please note currently 128C Barcode Format is supported only.
  - `tokenDates` union — [Optional] This optional request structure allows to override Campaign or Programme settings for Token Valid-From and/or Valid-To dates; newly created Token will have these dates as explicitly requested. Please note explicit date-times has to be within a referenced Campaign or Programme validity window.
    - object
      - `start` string, date-time, required — Token Valid-From date-time - If using 'useOldMysqlDateTimes' unit setting, use MySQL datetime format instead.
      - `end` string, date-time — Token Valid-To date-time - If using 'useOldMysqlDateTimes' unit setting, use MySQL datetime format instead.
    - object
      - `start` string, date-time — Token Valid-From date-time - If using 'useOldMysqlDateTimes' unit setting, use MySQL datetime format instead.
      - `end` string, date-time, required — Token Valid-To date-time - If using 'useOldMysqlDateTimes' unit setting, use MySQL datetime format instead.
  - `consumerIdentifier` union — Only one of following keys could be provided to fulfil Consumer search (by email, by mobile number, by customerId, by external system Reference). If Consumer with provided email or mobile doesn't exist, AIR will create a new Consumer using provided email or mobile. Please note for Campaigns with a strict issuance per Consumer limit this field will be mandatory.
    - object
      - `email` string, string, required — Consumer email
      - `mobile` string, string — Consumer mobile number
      - `consumerId` string, string — Id of the Consumer in EES AIR
      - `reference` string, string — External system Consumer Reference, so EES AIR could search for provided value
    - object
      - `email` string, string — Consumer email
      - `mobile` string, string, required — Consumer mobile number
      - `consumerId` string, string — Id of the Consumer in EES AIR
      - `reference` string, string — External system Consumer Reference, so EES AIR could search for provided value
    - object
      - `email` string, string — Consumer email
      - `mobile` string, string — Consumer mobile number
      - `consumerId` string, string, required — Id of the Consumer in EES AIR
      - `reference` string, string — External system Consumer Reference, so EES AIR could search for provided value
    - object
      - `email` string, string — Consumer email
      - `mobile` string, string — Consumer mobile number
      - `consumerId` string, string — Id of the Consumer in EES AIR
      - `reference` string, string, required — External system Consumer Reference, so EES AIR could search for provided value
  - `value` object
    - `amount` integer — This property is applicable to Stored Value Accounts, to provide initial Account Balance for a created Token, Please note Account Balance should be denominated to a smallest currency unit (for British Pound it should be in pence)
  - `overrides` TokenOverrideEntity — [Optional] Overrides for reward or continuityQualification of the Token. Both the Unit and Campaign must have overrides enabled to use this.
    - `reward` object — Reward overrides for the Token.
      - `discountAmount` integer — The amount that should be discounted.
      - `creditAmount` integer — The number of points to credit a Points Account with.
      - `finalAmount` integer — The final amount to override with.
      - `percentageAmount` number — A percentage amount to be discounted. This must be an integer unless `allowDecimal` is enabled in the Unit.
      - `discountValue` integer — The discount value to override with.
    - `continuityQualification` object — Continuity qualification overrides for the Token.
      - `totalTransactionUnits` integer — The number of units that are needed in the transaction to qualify for the reward.
      - `totalTransactionSpend` integer — The transaction spend amount needed to qualify for the reward.
      - `totalTransactionCount` integer — The number of Account Transactions needed to qualify for the reward.
  - `location` string, string — [Optional] Outlet incoming identifier to override where this Transaction has happened, if not provided AIR will use location arisen from used API Key
  - `details` TransactionDetailsEntity — JSON Object without a fixed structure (EES AIR Meta-Data)
  - `delivery` DeliveryRequestEntity — Optional section (key and value), if defined AIR will try to deliver EMAIL or SMS delivery notification to requested end-Client.
    - `type` 'EMAIL' | 'SMS', required — Requested Delivery Method
    - `scheduled` string, date-time — The date and time of delivery for the token code in the format YYYY-MM-DD HH:MM:SS
    - `template` object
      - `templateId` integer — Id of the template, from AIR, to be used to deliver the message. This parameter is mandatory if the templateId is not defined on the campaign.
      - `content` object — Optional (additional) Template Variables & Values (key-values)
  - `mobileWallet` boolean — An optional boolean flag to instruct the API to include a link to Mobile Wallet in the Response. (Please note this feature requires App Manager service enabled for a Client).
  - `tokenCode` string — Used for the token, if campaign is configured to allow it
  - `accountDetails` object
    - `utm_source` string, string — Identifies which site sent the traffic
    - `utm_medium` string, string — Identifies what type of link was used
    - `utm_campaign` string, string — Identifies a specific product promotion or strategic campaign
    - `utm_term` string, string — Identifies search terms
    - `utm_content` string, string — Identifies what specifically was clicked to bring the user to the site

## Response `201`

EES AIR successfully processed this request

- object
  - `accountId` integer, required — Account ID (EES Reference)
  - `accountTypeId` integer, required — Account Type ID (EES Internal Type Reference)
  - `accountType` 'Endpoints applicable to COUPON Account Type' | 'Endpoints applicable to STORED_VALUE Account Type', required — Account Type
  - `accountSubType` 'ECOUPON' | 'CONTINUITY' | 'PAPER' | 'VOUCHER' | 'DEBIT' | 'PLASTIC', required — Account Sub-type
  - `token` string, string, required — Generated Token
  - `tokenId` integer, required — Token ID (EES Reference)
  - `consumerId` integer — Consumer ID (EES Reference)
  - `issuerId` integer, required — Issuer ID
  - `barcodeImage` string, string — An base64-encoded Barcode Image of the generated Token. Please note currently 128C Barcode Type is supported only.
  - `accountStatus` 'ACTIVE' | 'BLOCKED' | 'CANCELLED' | 'DELETED' | 'EXPIRED' | 'INACTIVE' | 'INVALIDATED' | 'LOCKED' | 'STOLEN' | 'USED', required — Account status
  - `tokenStatus` 'INACTIVE' | 'ACTIVE' | 'REDEEMED' | 'CANCELLED' | 'EXPIRED' | 'INVALIDATED', required — Token status
  - `balances` AccountBalancesEntity, required — The object of balances. Some balances only apply to certain types of accounts. See notes below on balances.
    - `available` integer — The available balance. This is applicable for all account types, except POINTS and CONTINUITY, which uses its own balance keys. For ECOUPON account type this property will be returned and will be equal to zero.
    - `refundable` integer — The refundable balance. This is applicable for all account types except POINTS and CONTINUITY, but is not used during account creation. For an Account Entity, the amount displayed here is the total refundable balance available. Please note for ECOUPON account type this property will be returned and equal to zero.
    - `totalSpend` integer — The total spend balance. Applicable only to CONTINUITY type Accounts. If totalSpend is not provided on creation, this will be set to 0.
    - `transactionCount` integer — The transaction counter. Applicable only to CONTINUITY type Accounts. If transactionCount is not provided on creation, this will be set to 0.
    - `current` integer — The current balance. Applicable only to accounts of type POINTS and STAMP. If not provided on creation, this will be set to 0.
    - `usable` integer — The usable balance. Applicable only to accounts of type POINTS. If not provided on creation, this will be set to 0.
    - `locked` integer — The locked balance. Applicable only to accounts of type POINTS. If not provided on creation, this will be set to 0.
    - `lifetime` integer — The lifetime balance. Applicable only to accounts of type POINTS and STAMP. If not provided on creation, this will be set to 0.
  - `serialNumber` string, string — Token Serial Number. Please note this optional attribute is available for Stored Value Account only. This attribute will not show up in the Response unless appropriate Programme setting is turned on
  - `tokenDates` object, required
    - `start` string, date-time, required — Token Valid-From date-time - If using 'useOldMysqlDateTimes' unit setting, use MySQL datetime format instead.
    - `end` string, date-time, required — Token Valid-To date-time - If using 'useOldMysqlDateTimes' unit setting, use MySQL datetime format instead.
  - `resourceType` 'CAMPAIGN' | 'PROGRAMME', required — Resource Type
  - `resourceId` integer, required — Programme Id, Campaign Id
  - `pin` string, string — This JSON property would return randomly generated by the AIR PIN, if a referenced Resource (Campaign or Programme) is configured to support PINs. Because of security reasons AIR would return this PIN value only as part of Token Create Response
  - `overrides` TokenOverrideEntity — [Optional] Overrides for reward or continuityQualification of the Token. Both the Unit and Campaign must have overrides enabled to use this.
    - `reward` object — Reward overrides for the Token.
      - `discountAmount` integer — The amount that should be discounted.
      - `creditAmount` integer — The number of points to credit a Points Account with.
      - `finalAmount` integer — The final amount to override with.
      - `percentageAmount` number — A percentage amount to be discounted. This must be an integer unless `allowDecimal` is enabled in the Unit.
      - `discountValue` integer — The discount value to override with.
    - `continuityQualification` object — Continuity qualification overrides for the Token.
      - `totalTransactionUnits` integer — The number of units that are needed in the transaction to qualify for the reward.
      - `totalTransactionSpend` integer — The transaction spend amount needed to qualify for the reward.
      - `totalTransactionCount` integer — The number of Account Transactions needed to qualify for the reward.
  - `accountTransactionId` string, string, nullable, required — ID of the Account Transaction created as result of this API endpoint call (if applicable, as not all AIR operations would generate Account Transaction)
  - `mobileWalletUrl` string, string, required — Mobile Wallet URL, this attribute will be returned only if
  - `delivery` object
    - `type` 'EMAIL' | 'SMS', string, required — Delivery Type
    - `status` 'QUEUED' | 'SENT', required — Delivery Status

## Other responses

- `400` — EES AIR refuse to process that particular Request as there is something wrong with the Request (e.g. Request Payload is unprocessable, Mandatory Request Parameter value is not provided, etc.)
- `401` — EES AIR refuse to process that particular Request due to Authentication error(s). This could be caused by missing one or more of mandatory AUTH headers, invalid Hash calculation, invalid or inactive API Key used, etc.
- `403` — EES AIR refuse to process that particular Request due to Authorisation error(s). Please note nothing is wrong with Authentication nor hash Calculation, it is simply due to lack of permission to perform that particular action (e.g. Issuance Partner attempts to Redeem a Token or Redemption Partner attempts to Issue a Token, etc.)
- `404` — EES AIR refuse to process that particular Request as requested Resource could not be found or referenced Resource is not active.
- `415` — EES AIR refuse to process that particular Request as requested `Mime-Type` is not supported (Currently only `application/json` is supported
- `429` — Too Many Requests
- `500` — EES AIR is not able to process that particular Request due to Unexpected Server Error.

---

[API](https://skmtc.net/eagleeye/apis/wallet-api.md) · [All operations](https://skmtc.net/eagleeye/apis/wallet-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/eagleeye/wallet-api/versions/90a122bb14cc/schema)
