Skip to main content
Use the Direct Vault API to store card and network token data in the Payrails Vault and read it back in clear text, directly from your backend. The Vault Proxy forwards sensitive values to a third party and never returns them to you. The Direct Vault API returns them to you. Two operations do the work. One stores values and gives you aliases. The other takes aliases and gives the values back. Both accept a list, so batching is the normal case. Because the responses contain cardholder data, Payrails enables the capability per merchant, after confirming your PCI AOC. This guide assumes you know what a record, a field and an alias are in the Payrails Vault. If you don’t, start with Records, Aliases and Instruments.

Before you call the API

The Direct Vault API differs from the rest of the Payrails API in two ways. Check both before you send your first request.
Use the Vault host and a Vault access token
  • Different host. POST /records/tokenize and POST /records/detokenize live on the Payrails Vault host, not on the Payrails API host. The Payrails API host doesn’t serve these paths.
  • Different token. These endpoints don’t accept your Payrails access token. They accept a Vault access token, a JWT that you request from POST /token/auth on the Payrails API host.
A request with the wrong host or the wrong token fails.
To get access:
  1. Ask your Payrails account manager to enable the capability on your workspace. Enablement follows a confirmed PCI AOC and a compliance review.
  2. Configure mTLS. The Direct Vault API uses the same client certificates as the Payrails API, so you obtain and rotate no second certificate. See mTLS configuration.

Get a Vault access token

Exchange your Payrails access token once for a Vault access token, then reuse that token until it expires. Call Request a Vault access token on the Payrails API host. The request body is empty. Your Payrails access token goes in the Authorization header and must carry the vault scopes vaultaccesstokens:create:tokenize, vaultaccesstokens:create:detokenize, or both.
expires_in is the lifetime in seconds. Store the token and reuse it for that long instead of requesting a new one per call. Request a new one when it expires, or when a call returns 401. The Vault access token grants only what your Payrails token permitted, and only the Vault host accepts it. If your credentials allow tokenization but not detokenization, a call to /records/detokenize returns 403.

Tokenize records

Tokenize records stores one or more records and returns an alias for every field it stored. Send it to the Vault host with the Vault access token. A record has a type and a fields object keyed by field type: Each field is an object with a value, not a bare string.
The response has one entry per requested record, in the order of the request. It uses the same representation as the record retrieval endpoints.
Keep the id and the alias values. They are how you address the data later, and neither is sensitive.
The vault stores securityCode and cryptogram as volatile fields. They expire according to your vault configuration, which a request can’t override. Under PCI DSS 3.3.1, you must delete the security code yourself once authorization completes. See Records, Aliases and Instruments.

Detokenize records and aliases

Detokenize records and aliases reveals stored data in clear text. Send it to the Vault host with the Vault access token. Each item carries exactly one key, and one request mixes all three:
Match results by their keys, not by position. Unlike tokenization, detokenized items can come back in a different order than you sent them. Every result, including a failed one, echoes the key you addressed it by.
A field can carry a limit on how many times it allows a reveal, and every reveal counts against that limit. Within one request, the vault reveals a record addressed by several items once, so asking twice in the same batch costs no more than asking once. Across separate requests, each one counts.

Batch limits

Both operations accept at most 50 items per request. The API refuses a request over the limit with 413 before it stores or reveals anything. The API applies nothing partially, so split the batch and send it again. Retrying the same oversized request doesn’t help. The body size limit is a second, independent check and also returns 413.

Errors

A batch isn’t a transaction. One item failing doesn’t fail the others. The call returns 200, successful entries carry their data, and failed entries carry an error object instead. For tokenization, the vault stores the records that succeeded.
Don’t read a 200 as “everything worked.” Walk the array and check each entry for error. The API reference lists the per-item codes for each operation: Tokenize records and Detokenize records and aliases. Some conditions fail the whole call. The body then carries an errors array and no records or items: Every error carries an id. Quote it when you contact support. It identifies the exact failure in the Payrails logs. The shape is the standard Payrails error object.

Examples

The examples assume VAULT_TOKEN holds a Vault access token from POST /token/auth, and VAULT_HOST holds your Payrails Vault host, which Payrails issues after confirming your PCI AOC. They don’t use the Payrails API host.
Store one card, then read it back by its record id.
Last modified on October 2, 2026