Bulk provision tokens
curl --request POST \
--url https://api.spirii.com/emsp/v1/tokens/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tokens": [
{
"uid": "<string>",
"contract_id": "<string>",
"issuer": "<string>",
"idempotency_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"country_code": "<string>",
"party_id": "<string>",
"visual_number": "<string>",
"language": "<string>",
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z",
"metadata": {},
"emsp_group_ids": [
"<string>"
],
"group_id": "<string>",
"auto_activate": false
}
]
}
'import requests
url = "https://api.spirii.com/emsp/v1/tokens/bulk"
payload = { "tokens": [
{
"uid": "<string>",
"contract_id": "<string>",
"issuer": "<string>",
"idempotency_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"country_code": "<string>",
"party_id": "<string>",
"visual_number": "<string>",
"language": "<string>",
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z",
"metadata": {},
"emsp_group_ids": ["<string>"],
"group_id": "<string>",
"auto_activate": False
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tokens: [
{
uid: '<string>',
contract_id: '<string>',
issuer: '<string>',
idempotency_key: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
country_code: '<string>',
party_id: '<string>',
visual_number: '<string>',
language: '<string>',
valid_from: '2023-11-07T05:31:56Z',
valid_until: '2023-11-07T05:31:56Z',
metadata: {},
emsp_group_ids: ['<string>'],
group_id: '<string>',
auto_activate: false
}
]
})
};
fetch('https://api.spirii.com/emsp/v1/tokens/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.spirii.com/emsp/v1/tokens/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'tokens' => [
[
'uid' => '<string>',
'contract_id' => '<string>',
'issuer' => '<string>',
'idempotency_key' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'country_code' => '<string>',
'party_id' => '<string>',
'visual_number' => '<string>',
'language' => '<string>',
'valid_from' => '2023-11-07T05:31:56Z',
'valid_until' => '2023-11-07T05:31:56Z',
'metadata' => [
],
'emsp_group_ids' => [
'<string>'
],
'group_id' => '<string>',
'auto_activate' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.spirii.com/emsp/v1/tokens/bulk"
payload := strings.NewReader("{\n \"tokens\": [\n {\n \"uid\": \"<string>\",\n \"contract_id\": \"<string>\",\n \"issuer\": \"<string>\",\n \"idempotency_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"country_code\": \"<string>\",\n \"party_id\": \"<string>\",\n \"visual_number\": \"<string>\",\n \"language\": \"<string>\",\n \"valid_from\": \"2023-11-07T05:31:56Z\",\n \"valid_until\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"emsp_group_ids\": [\n \"<string>\"\n ],\n \"group_id\": \"<string>\",\n \"auto_activate\": false\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.spirii.com/emsp/v1/tokens/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tokens\": [\n {\n \"uid\": \"<string>\",\n \"contract_id\": \"<string>\",\n \"issuer\": \"<string>\",\n \"idempotency_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"country_code\": \"<string>\",\n \"party_id\": \"<string>\",\n \"visual_number\": \"<string>\",\n \"language\": \"<string>\",\n \"valid_from\": \"2023-11-07T05:31:56Z\",\n \"valid_until\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"emsp_group_ids\": [\n \"<string>\"\n ],\n \"group_id\": \"<string>\",\n \"auto_activate\": false\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spirii.com/emsp/v1/tokens/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tokens\": [\n {\n \"uid\": \"<string>\",\n \"contract_id\": \"<string>\",\n \"issuer\": \"<string>\",\n \"idempotency_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"country_code\": \"<string>\",\n \"party_id\": \"<string>\",\n \"visual_number\": \"<string>\",\n \"language\": \"<string>\",\n \"valid_from\": \"2023-11-07T05:31:56Z\",\n \"valid_until\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"emsp_group_ids\": [\n \"<string>\"\n ],\n \"group_id\": \"<string>\",\n \"auto_activate\": false\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"operation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"submitted_count": 500
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"message": "<string>"
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"message": "<string>"
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}Bulk provision tokens
Accepts up to 1000 tokens for provisioning in the background. The batch is validated as a whole before it is accepted: one invalid item rejects the batch with 422, and each entry in errors names the item by index (body.tokens[<index>].<field>). uid uniqueness and metadata validation run per item during processing rather than on this call. This operation does not use the Idempotency-Key header; instead each item carries its own idempotency_key.
Requires the emsp:tokens:write scope.
POST
/
emsp
/
v1
/
tokens
/
bulk
Bulk provision tokens
curl --request POST \
--url https://api.spirii.com/emsp/v1/tokens/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tokens": [
{
"uid": "<string>",
"contract_id": "<string>",
"issuer": "<string>",
"idempotency_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"country_code": "<string>",
"party_id": "<string>",
"visual_number": "<string>",
"language": "<string>",
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z",
"metadata": {},
"emsp_group_ids": [
"<string>"
],
"group_id": "<string>",
"auto_activate": false
}
]
}
'import requests
url = "https://api.spirii.com/emsp/v1/tokens/bulk"
payload = { "tokens": [
{
"uid": "<string>",
"contract_id": "<string>",
"issuer": "<string>",
"idempotency_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"country_code": "<string>",
"party_id": "<string>",
"visual_number": "<string>",
"language": "<string>",
"valid_from": "2023-11-07T05:31:56Z",
"valid_until": "2023-11-07T05:31:56Z",
"metadata": {},
"emsp_group_ids": ["<string>"],
"group_id": "<string>",
"auto_activate": False
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tokens: [
{
uid: '<string>',
contract_id: '<string>',
issuer: '<string>',
idempotency_key: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
country_code: '<string>',
party_id: '<string>',
visual_number: '<string>',
language: '<string>',
valid_from: '2023-11-07T05:31:56Z',
valid_until: '2023-11-07T05:31:56Z',
metadata: {},
emsp_group_ids: ['<string>'],
group_id: '<string>',
auto_activate: false
}
]
})
};
fetch('https://api.spirii.com/emsp/v1/tokens/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.spirii.com/emsp/v1/tokens/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'tokens' => [
[
'uid' => '<string>',
'contract_id' => '<string>',
'issuer' => '<string>',
'idempotency_key' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'country_code' => '<string>',
'party_id' => '<string>',
'visual_number' => '<string>',
'language' => '<string>',
'valid_from' => '2023-11-07T05:31:56Z',
'valid_until' => '2023-11-07T05:31:56Z',
'metadata' => [
],
'emsp_group_ids' => [
'<string>'
],
'group_id' => '<string>',
'auto_activate' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.spirii.com/emsp/v1/tokens/bulk"
payload := strings.NewReader("{\n \"tokens\": [\n {\n \"uid\": \"<string>\",\n \"contract_id\": \"<string>\",\n \"issuer\": \"<string>\",\n \"idempotency_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"country_code\": \"<string>\",\n \"party_id\": \"<string>\",\n \"visual_number\": \"<string>\",\n \"language\": \"<string>\",\n \"valid_from\": \"2023-11-07T05:31:56Z\",\n \"valid_until\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"emsp_group_ids\": [\n \"<string>\"\n ],\n \"group_id\": \"<string>\",\n \"auto_activate\": false\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.spirii.com/emsp/v1/tokens/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tokens\": [\n {\n \"uid\": \"<string>\",\n \"contract_id\": \"<string>\",\n \"issuer\": \"<string>\",\n \"idempotency_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"country_code\": \"<string>\",\n \"party_id\": \"<string>\",\n \"visual_number\": \"<string>\",\n \"language\": \"<string>\",\n \"valid_from\": \"2023-11-07T05:31:56Z\",\n \"valid_until\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"emsp_group_ids\": [\n \"<string>\"\n ],\n \"group_id\": \"<string>\",\n \"auto_activate\": false\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spirii.com/emsp/v1/tokens/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tokens\": [\n {\n \"uid\": \"<string>\",\n \"contract_id\": \"<string>\",\n \"issuer\": \"<string>\",\n \"idempotency_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"country_code\": \"<string>\",\n \"party_id\": \"<string>\",\n \"visual_number\": \"<string>\",\n \"language\": \"<string>\",\n \"valid_from\": \"2023-11-07T05:31:56Z\",\n \"valid_until\": \"2023-11-07T05:31:56Z\",\n \"metadata\": {},\n \"emsp_group_ids\": [\n \"<string>\"\n ],\n \"group_id\": \"<string>\",\n \"auto_activate\": false\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"operation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"submitted_count": 500
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"message": "<string>"
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"message": "<string>"
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Body
application/json
Required array length:
1 - 1000 elementsShow child attributes
Show child attributes
Was this page helpful?