POST
/ vars/ v1/ agents/ {agentId}/ keysRelated guide: Register an agent.
Authentication: the method you chose, X-Pay-Token or two-way TLS; see X-Pay-Token / mTLS. X-Pay uses the signed apiKey query.
Parameters
Request body
Required JSON body, with the fields below.
keyNamestringrequiredHuman-readable / stable key name. Visa CLI sends the RFC 7638 thumbprint (JKT).
algorithmstringrequiredFor Ed25519 keys, send lowercase ed25519. For any other value, check the current VARS schema, which needs authorized access.
Responses
| HTTP | Meaning | Schema |
|---|---|---|
201 | Key created inactive; activation follows. | KeyResponse |
403 | Agent is deactivated. | ErrorResponse |
404 | Agent not found. | ErrorResponse |
422 | Invalid key fields. | ValidationError |
The token covers this URL's exact query and the exact request body, so each request needs a new one. Replace the YOUR_ values with your own.
base='https://sandbox.api.visa.com/vars/v1'
curl --request POST \
"$base/agents/YOUR_AGENT_ID/keys?apiKey=YOUR_API_KEY" \
--header 'Accept: application/json' \
--header 'x-pay-token: TOKEN_FOR_THIS_EXACT_REQUEST' \
--header 'Content-Type: application/json' \
--data-binary @agent-key-create.json{
"keyName": "YOUR_PUBLIC_JWK_THUMBPRINT",
"algorithm": "ed25519",
"publicKey": "BASE64_ENCODED_SPKI_PEM_PUBLIC_KEY",
"expirationDate": "2027-11-05T00:00:00Z"
}