Skip to main content

Credentials

The credentials endpoint returns virtual card credentials for an approved instruction. The response includes a virtual card number, expiry, and CVC that the agent uses to complete a purchase at a merchant. These are not actual PANs — they are network-generated virtual credentials.

This endpoint returns virtual card credentials that look like a card number and CVC but are not actual PCI cardholder data. These credentials should still be treated securely and requests should only be made from your backend.

Authentication

All requests require a BT-API-KEY header with your Basis Theory API key.

All errors follow the standard error response format.

Get Credentials

Retrieves virtual card credentials for an approved instruction.

POST
https://api.basistheory.com/agentic/agents/{agent_id}/instructions/{instruction_id}/credentials
Copy

Permissions

agent:instruction:credentials
Credentials can only be retrieved for instructions with approved status. Attempting to retrieve credentials for a pending, pending_verification, expired, cancelled, or failed instruction will return a 400 error.

Request

curl -X POST https://api.basistheory.com/agentic/agents/agt_fukICjsY2xzRCECiTCbKM/instructions/ins_luPDv2xm3Yb8RjFJz9oTC/credentials \
-H 'BT-API-KEY: <BT_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"merchant": {
"name": "Amazon",
"url": "https://www.amazon.com",
"country_code": "US"
},
"products": [
{
"name": "Widget",
"price": 99.99,
"quantity": 2
}
],
"shipping_address": {
"line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country_code": "US"
}
}'

Request Parameters

AttributeRequiredTypeDescription
agent_idYesstringThe ID of the agent
instruction_idYesstringThe ID of the approved instruction
merchantNoobjectThe merchant object. Falls back to the merchant stored on the instruction (if provided during instruction creation). A 400 error is returned if no merchant is available from either source.
productsNoarrayArray of product objects being purchased
amountNoobjectOverride amount for this credential request. See amount object
delivery_methodNostringHow the purchase will be delivered. One of: no-delivery, address-billing, address-on-file, address-other, pickup, electronic
shipping_addressNoobjectThe shipping address object

Merchant Object

AttributeRequiredTypeDescription
nameYesstringThe merchant name (displayed to the cardholder during passkey verification)
urlYesstringThe merchant website URL
country_codeYesstringISO 3166-1 alpha-2 country code of the merchant
category_codeNostring4-digit merchant category code (MCC)

Product Object

AttributeRequiredTypeDescription
nameYesstringThe product name
priceYesnumberThe product price
quantityYesintegerThe quantity being purchased

Shipping Address Object

AttributeRequiredTypeDescription
line1YesstringThe first line of the street address
cityYesstringThe city
stateYesstringThe state or province code
postal_codeYesstringThe postal code
country_codeYesstringISO 3166-1 alpha-2 country code

Response

Returns a credentials object if successful.

{
"card": {
"number": "4111111111111111",
"expiration_month": "12",
"expiration_year": "2026",
"cvc": "123"
},
"expires_at": "2026-02-20T00:00:00Z"
}

Credentials Object

AttributeTypeDescription
cardobjectThe virtual card credentials. See card credentials
expires_atstringISO 8601 timestamp for when the credentials expire

Card Credentials Object

AttributeTypeDescription
numberstringThe virtual card number
expiration_monthstringThe card expiration month
expiration_yearstringThe four-digit card expiration year
cvcstringThe card verification code