Retrieves the original, unencrypted value of a tokenized field in an identity record. This operation requires proper authentication and should be restricted to authorized personnel only.
Path Parameters
The unique identifier of the identity
The name of the tokenized field to retrieve
Response
The name of the field that was detokenized
The original, unencrypted value of the field
Detokenize Email
Detokenize Phone Number
Detokenize Street
curl -X GET https://YOUR_BLNK_INSTANCE_URL/identities/idt_1234567890/detokenize/email_address \
-H "X-Blnk-Key: YOUR_API_KEY"
200 - OK
400 - Bad Request (Missing ID)
400 - Bad Request (Missing Field)
400 - Bad Request (Not Tokenized)
400 - Bad Request (Identity Not Found)
{
"field" : "email_address" ,
"value" : "john.doe@example.com"
}
Security Considerations
Critical Security Notice : This endpoint retrieves sensitive PII in plain text. Implement strict access controls and audit logging for all detokenization operations.
Access Control Best Practices
Role-Based Access : Restrict this endpoint to specific roles (e.g., compliance officers, customer support with supervision)
Audit Logging : Log every detokenization request with:
User ID and role
Timestamp
Identity ID
Field name
IP address
Request context
Rate Limiting : Implement rate limits to prevent bulk detokenization
Multi-Factor Authentication : Require MFA for users with detokenization access
Time-Limited Access : Implement temporary access grants that expire
Justification Required : Require users to provide a reason for detokenization
Compliance Requirements
When using this endpoint, ensure compliance with:
GDPR : Document legitimate reasons for accessing personal data
PCI DSS : Implement strong access controls and audit trails
HIPAA : Maintain detailed access logs for PHI
SOC 2 : Demonstrate appropriate security controls
How Detokenization Works
Decryption Process
Retrieve Identity : Fetch the identity record from the database
Verify Tokenization : Check if the field is marked as tokenized in meta_data.tokenized_fields
Extract Token : Get the tokenized value from the specified field
Decrypt : Use AES-256-GCM to decrypt the token
Return Original : Return the original plain text value
Blnk automatically detects the token format:
Format-Preserving Tokens : Start with FPT: prefix
Standard Tokens : Base64-encoded encrypted values
The detokenization process handles both formats automatically.
Use Cases
Customer Support
// Support agent needs to verify customer email
GET /identities/idt_ 1234567890 /detokenize/email_address
// Response
{
"field" : "email_address" ,
"value" : "john.doe@example.com"
}
Fraud Investigation
// Fraud team investigating suspicious activity
GET /identities/idt_suspicious 123 /detokenize/phone_number
// Response
{
"field" : "phone_number" ,
"value" : "+1234567890"
}
Compliance Audit
// Compliance officer verifying customer information
GET /identities/idt_audit 456 /detokenize/street
// Response
{
"field" : "street" ,
"value" : "123 Main Street, Apt 4B"
}
Error Handling
Field Not Tokenized
If the requested field is not tokenized, the error message includes the current tokenization state:
{
"error" : "field email_address is not tokenized. Metadata: { \" tokenized_fields \" :{ \" PhoneNumber \" :true, \" Street \" :true}}"
}
This helps you understand which fields are actually tokenized.
Field Name Variations
The endpoint accepts both snake_case and PascalCase field names:
email_address or EmailAddress
phone_number or PhoneNumber
first_name or FirstName
If the field is not found with the provided name, both variations are checked automatically.
Decryption Speed : Detokenization is fast (typically <10ms)
Database Queries : Each request requires one database query to fetch the identity
Rate Limiting : Consider implementing rate limits to prevent abuse
Caching : Do not cache detokenized values - always retrieve on-demand
Monitoring and Alerts
Set up monitoring for:
High Volume : Alert on unusual spikes in detokenization requests
Failed Attempts : Track repeated failures (may indicate attacks)
Unauthorized Access : Alert on access from unexpected IP addresses or users
After-Hours Access : Flag detokenization outside business hours
Implementation Example
// Example with audit logging
async function detokenizeField ( identityId , fieldName , userId , reason ) {
// Log the detokenization request
await auditLog . create ({
action: 'DETOKENIZE_FIELD' ,
userId: userId ,
identityId: identityId ,
fieldName: fieldName ,
reason: reason ,
timestamp: new Date (),
ipAddress: request . ip
});
// Make the API request
const response = await fetch (
`https://YOUR_BLNK_INSTANCE_URL/identities/ ${ identityId } /detokenize/ ${ fieldName } ` ,
{
headers: {
'X-Blnk-Key' : 'YOUR_API_KEY'
}
}
);
const data = await response . json ();
// Alert security team for sensitive operations
if ( fieldName === 'email_address' || fieldName === 'phone_number' ) {
await securityAlert . send ({
message: `User ${ userId } detokenized ${ fieldName } for identity ${ identityId } ` ,
severity: 'INFO'
});
}
return data ;
}