Post 1st tokens part
To request the tokens for the 1st temporally separated part for a number of digits of a preset alphabet, all of these values MUST be sent as data attributes together with the data type: tokens in the JSON request body. The data relationships payment data value in the JSON request body MUST contain the type: transaction, a valid transaction id according to the schema XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX and a valid payment intent ident according to the schema pi_XXXXXXXXXXXXXXXXXXXXXXXX. Furthermore, it is RECOMMENDED to send a meta seed in the JSON request body, which will later be taken into account when hashing the files of the production line.
The data attributes available value in the JSON response body shows the number of tokens that can be generated by the production line in general, just before the production starts. The data attributes size in the JSON request body determines the number of tokens to produce for the 1st part and MUST be smaller as the number of available, possibly limited tokens in special. This number can be determined as described in the previous step and may be subject to further, non-technical restrictions. Any larger requested size is scaled down by the remote service to the reachable size and there are no further parts in this case.
The identifier of the new tokens object is returned from the remote service in the JSON response body as data id together with other attribute–value pairs. The remote service immediately starts producing the tokens.
Request endpoint
POST SERVER:PORT/api/tokens
Response status
201
Request headers
Accept:application/vnd.api+json
Content-Type:application/vnd.api+json
Session-Key:SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS
Response headers
Transfer-Encoding:chunked
Connection:keep-alive
Accept:application/vnd.api+json
Cache-Control:no-cache
Date:Tue, 19 Mar 2024 12:53:00 GMT
Content-Type:application/vnd.api+json
Server:nginx/1.25.4
Request body
{
"meta": {
"seed": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
},
"data": {
"attributes": {
"size": "8788",
"digits": "3",
"alphabet": "LOWER_LATIN"
},
"type": "tokens",
"relationships": {
"payment": {
"data": {
"id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"ident": "pi_XXXXXXXXXXXXXXXXXXXXXXXX",
"type": "transaction"
}
}
}
}
}
Response body
{
"meta": {
"seed": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
},
"links": {
"self": "/api/tokens",
"info": "/api/tokens/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
},
"data": {
"attributes": {
"available": "17576",
"status": "requested",
"analysis": "none",
"size": "8788",
"reachable": "17576",
"alphabet": "LOWER_LATIN",
"timestamps": {
"requested": "2024-03-19T12:52:59.952Z"
},
"digits": "3"
},
"id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"type": "tokens",
"relationships": {
"payment": {
"data": {
"id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"ident": "pi_XXXXXXXXXXXXXXXXXXXXXXXX",
"type": "transaction"
}
}
}
}
}
HTTPie example
$ http post SERVER:PORT/api/tokens Accept:application/vnd.api+json Content-Type:application/vnd.api+json Session-Key:SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS << JSON
{
"meta": {
"seed": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
},
"data": {
"attributes": {
"size": "8788",
"digits": "3",
"alphabet": "LOWER_LATIN"
},
"type": "tokens",
"relationships": {
"payment": {
"data": {
"id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"ident": "pi_XXXXXXXXXXXXXXXXXXXXXXXX",
"type": "transaction"
}
}
}
}
}
JSON