Create Token
Creates a token under a node and starts its tokenization on a setup. The call is asynchronous: it stores the token in status 1 (Draft), queues a CreateTokenization transaction (type 1) and answers 201 with both ids. Poll Get Token Transaction By ID with the returned transaction_id: when it reaches 3 (Done) the token is in status 4 (NotListed) with its contract set; when it reaches 4 (Error) the token is in status 3 (Error) and can be retried with Retokenize Token.
The setup decides where the token lives and who signs: a setup is the node's deployment on one wallet and one network, so there is no wallet_id field. The setup must belong to the token's account node (the node's ancestor directly below the platform root, or the node itself when it sits there), its contracts must all be deployed, and network_id must be the setup's network. A token cannot be created on the platform root itself.
Required permission: token:create
Request
POST /v2/admin/tokens
The body is multipart/form-data when you upload images or documents, or application/json without files. The fields are the same in both.
Headers
| Name | Description |
|---|---|
Authorization | Required. Bearer <access_token> |
Content-Type | Required. multipart/form-data or application/json |
Body
| Field | Type | Required | Description |
|---|---|---|---|
node_id | string | Yes | Node the token is created under (24-character hex id). The caller's node must cover it. |
setup_id | string | Yes | Setup to tokenize on. It must belong to the node's account node and have all its contracts deployed. Its wallet signs the tokenization and every later on-chain action of the token. |
network_id | string | Yes | Network the token runs on. Must be the setup's network. |
category_id | string | Yes | Category the token is filed under. The category's tokenization rules are applied (see Errors). |
name | string | Yes | Display name. |
description | string | Yes | Description. |
token_name | string | Yes | On-chain token name. |
token_symbol | string | Yes | On-chain token symbol. |
currency_token_id | string | Yes | Currency token the value is expressed in. Its contract must already be deployed. |
total_value | string | Yes | Value of the whole asset, a decimal string greater than zero with no more decimals than the currency token has. |
salable_percentage | string | Yes | Share of the asset offered for sale, greater than "0" and at most "100", one decimal at most. |
max_supply | integer | Yes | Total number of tokens. The token price is total_value × salable_percentage / max_supply. |
images | file | No | Multipart only. Up to 10 images, PNG, JPEG or GIF, each under 2 MB. The first one becomes the default image. |
documents | file | No | Multipart only. Up to 10 PDF documents, each under 2 MB. Documents are stored privately and read back through short-lived signed links. |
oracle_id | string | No | Price oracle to attach. Used only together with oracle_code. |
oracle_code | string | No | One of the oracle's integration codes. |
Amounts and percentages follow Amounts and Percentages. Send repeated images / documents parts for several files.
Example
curl --request POST \
--url '{{baseUrl}}/v2/admin/tokens' \
--header 'Authorization: Bearer <access_token>' \
--form node_id=67d6c447f47ff3adafda700d \
--form setup_id=6a837bb62998e4fbfed7f52a \
--form network_id=6740e0a20000000000000103 \
--form category_id=667e9251ca818a2138ed4915 \
--form 'name=TKN Token Name' \
--form 'description=Token Description' \
--form token_name=tkn \
--form token_symbol=TKN \
--form currency_token_id=68fe8c129367fd414b227c7a \
--form total_value=12000 \
--form salable_percentage=80 \
--form max_supply=1000 \
--form images=@/path/to/image.png \
--form documents=@/path/to/prospectus.pdf \
--form oracle_id=677ed6e3cc111aea14a3dfc3 \
--form oracle_code=IOG
Without files, the same request as JSON:
curl --request POST \
--url '{{baseUrl}}/v2/admin/tokens' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data '{
"node_id": "67d6c447f47ff3adafda700d",
"setup_id": "6a837bb62998e4fbfed7f52a",
"network_id": "6740e0a20000000000000103",
"category_id": "667e9251ca818a2138ed4915",
"name": "TKN Token Name",
"description": "Token Description",
"token_name": "tkn",
"token_symbol": "TKN",
"currency_token_id": "68fe8c129367fd414b227c7a",
"total_value": "12000",
"salable_percentage": "80",
"max_supply": 1000
}'
Response
201 Created
{
"token_id": "67d8774e903bfcbe7eb5d93e",
"transaction_id": "67d8774f903bfcbe7eb5d941"
}
Response Fields
| Field | Type | Description |
|---|---|---|
token_id | string | Id of the new token (status 1, Draft). |
transaction_id | string | The CreateTokenization transaction. Poll it with Get Token Transaction By ID. |
Errors
| Status | Code | Description |
|---|---|---|
| 400 | 10015 | Validation failed — see details. Also returned when total_value or salable_percentage is zero or malformed, the setup does not exist, belongs to another account node or is on another network than network_id, oracle_code is not one of the oracle's codes, an upload is 2 MB or larger, or the multipart body cannot be read |
| 400 | 10016 | An id in the body is not a valid id |
| 400 | 10001 | Node not found (node domain 2) |
| 403 | 10005 | The caller's node does not cover node_id (node domain 2) |
| 400 | 10007 | The node has no account node, as for the platform root (node domain 2) |
| 400 | 10011 | The setup's contracts are not all deployed (node domain 2) |
| 404 | 10001 | Currency token not found (currency token domain 15) |
| 400 | 10004 | The currency token's contract is not deployed yet (currency token domain 15) |
| 400 | 10015 | The category requires salable_percentage to be 100 (token domain 5) |
| 400 | 10016 | The category requires max_supply to match total_value (token domain 5) |
| 400 | 10001 | Oracle not found (oracle domain 5, message oracle not found) |
| 400 | 10040 | An uploaded file's type is not allowed (images: PNG, JPEG, GIF; documents: PDF) |
See Errors for the error format and common codes.