Skip to main content

Detokenize

The detokenize endpoint enables you to detokenize tokens in order to retrieve their original values.

The maximum number of tokens that can be detokenized within a single request is defined by your Tenant's "Detokenize Limit" Quota.

POST
https://api.basistheory.com/detokenize
Copy

Permissions

token:read

The token:read permission must be granted on the container of each token included in the request.

Detokenize a single token

Request

curl "https://api.basistheory.com/detokenize" \
-H "BT-API-KEY: <API_KEY>" \
-H "Content-Type: application/json" \
-X "POST" \
-d '{
"card_number": "{{ 7993dbd8-19d5-44bf-b6dc-078e8b44c6cb | json: '$.number' }}"
}'

Response

{
"card_number": "4242"
}

Detokenize a list of tokens

Request

curl "https://api.basistheory.com/detokenize" \
-H "BT-API-KEY: <API_KEY>" \
-H "Content-Type: application/json" \
-X "POST" \
-d '{
"tokens": [
"{{ 7993dbd8-19d5-44bf-b6dc-078e8b44c6cb }}",
"{{ a1883f97-2e4c-439a-bf73-dffb681de929 }}"
],
}'

Response

{
"tokens": [
{
"id": "7993dbd8-19d5-44bf-b6dc-078e8b44c6cb",
"type": "token",
"tenant_id": "77cb0024-123e-41a8-8ff8-a3d5a0fa8a08",
"data": "secret data",
"containers": ["/general/high/"],
"metadata": {
"nonSensitiveField": "Non-Sensitive Value"
},
"created_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
"created_at": "2021-03-01T08:23:14+00:00"
},
{
"id": "a1883f97-2e4c-439a-bf73-dffb681de929",
"type": "token",
"tenant_id": "77cb0024-123e-41a8-8ff8-a3d5a0fa8a08",
"data": "secret data 2",
"containers": ["/general/high/"],
"metadata": {
"nonSensitiveField": "Non-Sensitive Value 2"
},
"created_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
"created_at": "2021-03-01T08:23:14+00:00"
}
]
}