Tokenization
Multiple
Overview
The Multiple Tokenization API is used to tokenize multiple sensitive data values in a single request.
Each item in the request contains its own transaction ID, template name, and data value. OneDB processes each item individually and returns a response for each transaction.
This API is useful when an application needs to tokenize multiple values at once instead of calling the single tokenization API repeatedly.
Endpoint
POST https://<onedb-hostname>:8443/api/v1/tokenize?multiple
Request Headers
Authorization: Bearer {{ONEDB_BEARER}}
Content-Type: application/json
Request Body
[
{
"trxId": 20,
"templateName": "App_With_Masking",
"data": "shean hateway"
},
{
"trxId": 21,
"templateName": "App_Without_Masking",
"data": "127.0.0.1"
},
{
"trxId": 22,
"templateName": "App_With_Masking",
"data": "1111-2222-3333-4444"
}
]
| Field | Type | Required | Description |
|---|---|---|---|
trxId |
Number | Yes | Unique transaction ID provided by the client application for tracking and audit reference. |
templateName |
String | Yes | Name of the tokenization template configured in OneDB. |
data |
String | Yes | Sensitive data value that will be tokenized. |
Successful Response
[
{
"trxId": 20,
"success": true,
"token": "BmGNl WY4T8t7"
},
{
"trxId": 21,
"success": true,
"token": "769.1.0.5"
},
{
"trxId": 22,
"success": true,
"token": "8564-6135-2544-7410"
}
]
Successful Response Fields
| Field | Type | Description |
|---|---|---|
trxId |
Number | Transaction ID returned from the request item. |
success |
Boolean | Indicates whether the tokenization request for the item was successful. |
token |
String | Generated token value that represents the original sensitive data. |
Partial Failed Response
If one or more items fail, OneDB still returns a response for each item. Failed items contain success: false and an error message, while successful items contain the generated token.
[
{
"trxId": 20,
"success": false,
"message": "Invalid template name!"
},
{
"trxId": 21,
"success": true,
"token": "769.1.0.5"
},
{
"trxId": 22,
"success": true,
"token": "8564-6135-2544-7410"
}
]
Failed Response Fields
| Field | Type | Description |
|---|---|---|
trxId |
Number | Transaction ID returned from the request item. |
success |
Boolean | Indicates whether the tokenization request for the item was successful. The value is false when the item fails. |
message |
String | Error message describing why the item failed. |
Example Request Using cURL
curl -X POST "https://<onedb-hostname>:8443/api/v1/tokenize?multiple" \
-H "Authorization: Bearer {{ONEDB_BEARER}}" \
-H "Content-Type: application/json" \
-d '[
{
"trxId": 20,
"templateName": "App_With_Masking",
"data": "shean hateway"
},
{
"trxId": 21,
"templateName": "App_Without_Masking",
"data": "127.0.0.1"
},
{
"trxId": 22,
"templateName": "App_With_Masking",
"data": "1111-2222-3333-4444"
}
]'
Notes
- This API requires a valid Bearer token.
- The request body must be a JSON array.
- Each item in the array is processed independently.
- The
trxIdshould be unique for each item to support tracking, troubleshooting, and audit reference. - The
templateNamemust match an existing tokenization template configured in OneDB. - If one item fails, other valid items can still be processed successfully.
- Applications should check the
successvalue for each item in the response. - Failed items return a
messagefield instead of atokenfield. - The generated token should be stored securely and used instead of the original sensitive value whenever possible.