Network Tokens
Network Token operations support Merchant Context: requests that include a
BT-MERCHANT-ID header act as that tenant merchant and only see its Network Tokens. Requests without the header operate at the tenant level.Network Tokens enables merchants to convert raw card details into secure, network-issued tokens. The network token endpoints support one-time purchases, card-on-file transactions, subscriptions and other recurring or cross-border payments by issuing tokens that automatically update on card reissues and boost authorization rates—all without ever storing PANs.
Create a Network Token
Creates a Network Token.
POST
https://api.basistheory.com/network-tokensPermissions
network-token:create
Request
- cURL
- Node
- C#
- Java
- Python
# Using an existing token ID
curl -L 'https://api.basistheory.com/network-tokens' \
-H 'BT-API-KEY: <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"token_id": "c06d0789-0a38-40be-b7cc-c28a718f76f1",
"cardholder_info": {
"name": "John Doe",
"address": {
"line1": "123 Main Street",
"line2": "Apt 4B",
"line3": "Building 7",
"postal_code": "90210",
"city": "Beverly Hills",
"state_code": "CA",
"country_code": "USA"
}
}
}'
# Using an existing token ID with an expiration date override
curl -L 'https://api.basistheory.com/network-tokens' \
-H 'BT-API-KEY: <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"token_id": "c06d0789-0a38-40be-b7cc-c28a718f76f1",
"expiration_month": 10,
"expiration_year": 2025
}'
# Using an existing token intent ID
curl -L 'https://api.basistheory.com/network-tokens' \
-H 'BT-API-KEY: <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"token_intent_id": "c06d0789-0a38-40be-b7cc-c28a718f76f1",
"cardholder_info": {
"name": "John Doe",
"address": {
"line1": "123 Main Street",
"line2": "Apt 4B",
"line3": "Building 7",
"postal_code": "90210",
"city": "Beverly Hills",
"state_code": "CA",
"country_code": "USA"
}
}
}'
# Using an existing token intent ID with an expiration date override
curl -L 'https://api.basistheory.com/network-tokens' \
-H 'BT-API-KEY: <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"token_intent_id": "c06d0789-0a38-40be-b7cc-c28a718f76f1",
"expiration_month": 10,
"expiration_year": 2025
}'
# Using raw card data
curl -L 'https://api.basistheory.com/network-tokens' \
-H 'BT-API-KEY: <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"data": {
"number": "4000000000000002",
"expiration_month": 3,
"expiration_year": 2027,
"cvc": "123"
},
"cardholder_info": {
"name": "John Doe",
"address": {
"line1": "123 Main Street",
"line2": "Apt 4B",
"line3": "Building 7",
"postal_code": "90210",
"city": "Beverly Hills",
"state_code": "CA",
"country_code": "USA"
}
}
}'
// Using an existing token ID
await client.networkTokens.create({
tokenId: "c06d0789-0a38-40be-b7cc-c28a718f76f1",
cardholderInfo: {
name: "John Doe",
address: {
line1: "123 Main Street",
line2: "Apt 4B",
line3: "Building 7",
city: "Beverly Hills",
postalCode: "90210",
stateCode: "CA",
countryCode: "USA"
}
}
}
);
// Using an existing token ID with an expiration date override
await client.networkTokens.create({
tokenId: "c06d0789-0a38-40be-b7cc-c28a718f76f1",
expirationMonth: 10,
expirationYear: 2025
}
);
// Using an existing token intent ID
await client.networkTokens.create({
tokenIntentId: "c06d0789-0a38-40be-b7cc-c28a718f76f1",
cardholderInfo: {
name: "John Doe",
address: {
line1: "123 Main Street",
line2: "Apt 4B",
line3: "Building 7",
city: "Beverly Hills",
postalCode: "90210",
stateCode: "CA",
countryCode: "USA"
}
}
}
);
// Using an existing token intent ID with an expiration date override
await client.networkTokens.create({
tokenIntentId: "c06d0789-0a38-40be-b7cc-c28a718f76f1",
expirationMonth: 10,
expirationYear: 2025
}
);
// Using raw card data
await client.networkTokens.create({
data: {
number: "4000000000000002",
expirationMonth: 3,
expirationYear: 2027,
cvc: "123"
},
cardholderInfo: {
name: "John Doe",
address: {
line1: "123 Main Street",
line2: "Apt 4B",
line3: "Building 7",
city: "Beverly Hills",
postalCode: "90210",
stateCode: "CA",
countryCode: "USA"
}
}
}
);
// Using an existing token ID
await client.NetworkTokens.CreateAsync(
new CreateNetworkTokenRequest
{
TokenId = "c06d0789-0a38-40be-b7cc-c28a718f76f1",
CardholderInfo = new CardholderInfo
{
Name = "John Doe",
Address = new Address
{
Line1 = "123 Main Street",
Line2 = "Apt 4B",
Line3 = "Building 7",
PostalCode = "90210",
City = "Beverly Hills",
StateCode = "CA",
CountryCode = "USA"
}
}
});
// Using an existing token ID with an expiration date override
await client.NetworkTokens.CreateAsync(
new CreateNetworkTokenRequest
{
TokenId = "c06d0789-0a38-40be-b7cc-c28a718f76f1",
ExpirationMonth = 10,
ExpirationYear = 2025
});
// Using an existing token intent ID
await client.NetworkTokens.CreateAsync(
new CreateNetworkTokenRequest
{
TokenIntentId = "c06d0789-0a38-40be-b7cc-c28a718f76f1",
CardholderInfo = new CardholderInfo
{
Name = "John Doe",
Address = new Address
{
Line1 = "123 Main Street",
Line2 = "Apt 4B",
Line3 = "Building 7",
PostalCode = "90210",
City = "Beverly Hills",
StateCode = "CA",
CountryCode = "USA"
}
}
});
// Using an existing token intent ID with an expiration date override
await client.NetworkTokens.CreateAsync(
new CreateNetworkTokenRequest
{
TokenIntentId = "c06d0789-0a38-40be-b7cc-c28a718f76f1",
ExpirationMonth = 10,
ExpirationYear = 2025
});
// Using raw card data
await client.NetworkTokens.CreateAsync(
new CreateNetworkTokenRequest
{
Data = new Card
{
Number = "4000000000000002",
ExpirationMonth = 03,
ExpirationYear = 2027,
Cvc = "123"
},
CardholderInfo = new CardholderInfo
{
Name = "John Doe",
Address = new Address
{
Line1 = "123 Main Street",
Line2 = "Apt 4B",
Line3 = "Building 7",
PostalCode = "90210",
City = "Beverly Hills",
StateCode = "CA",
CountryCode = "USA"
}
}
});
// Using an existing token ID
NetworkToken networkToken2 = new NetworkTokensClient(ClientOptions.builder().build())
.create(CreateNetworkTokenRequest.builder()
.tokenId("c06d0789-0a38-40be-b7cc-c28a718f76f1")
.cardholderInfo(CardholderInfo.builder()
.name("John Doe")
.address(Address.builder()
.line1("123 Main Street")
.line2("Apt 4B")
.line3("Building 7")
.postalCode("90210")
.city("Beverly Hills")
.stateCode("CA")
.countryCode("USA")
.build())
.build())
.build());
// Using an existing token ID with an expiration date override
NetworkToken networkToken4 = new NetworkTokensClient(ClientOptions.builder().build())
.create(CreateNetworkTokenRequest.builder()
.tokenId("c06d0789-0a38-40be-b7cc-c28a718f76f1")
.expirationMonth(10)
.expirationYear(2025)
.build());
// Using an existing token intent ID
NetworkToken networkToken3 = new NetworkTokensClient(ClientOptions.builder().build())
.create(CreateNetworkTokenRequest.builder()
.tokenIntentId("c06d0789-0a38-40be-b7cc-c28a718f76f1")
.cardholderInfo(CardholderInfo.builder()
.name("John Doe")
.address(Address.builder()
.line1("123 Main Street")
.line2("Apt 4B")
.line3("Building 7")
.postalCode("90210")
.city("Beverly Hills")
.stateCode("CA")
.countryCode("USA")
.build())
.build())
.build());
// Using an existing token intent ID with an expiration date override
NetworkToken networkToken5 = new NetworkTokensClient(ClientOptions.builder().build())
.create(CreateNetworkTokenRequest.builder()
.tokenIntentId("c06d0789-0a38-40be-b7cc-c28a718f76f1")
.expirationMonth(10)
.expirationYear(2025)
.build());
// Using raw card data
NetworkToken networkToken1 = new NetworkTokensClient(ClientOptions.builder().build())
.create(CreateNetworkTokenRequest.builder()
.cardholderInfo(CardholderInfo.builder()
.name("John Doe")
.address(Address.builder()
.line1("123 Main Street")
.line2("Apt 4B")
.line3("Building 7")
.postalCode("90210")
.city("Beverly Hills")
.stateCode("CA")
.countryCode("USA")
.build())
.build())
.data(Card.builder()
.number("4000000000000002")
.expirationMonth(3)
.expirationYear(2027)
.cvc("123")
.build())
.build());
# Using an existing token ID
await client.network_tokens.create(
token_id="c06d0789-0a38-40be-b7cc-c28a718f76f1",
cardholder_info=CardholderInfo(
name="John Doe",
address=Address(
line1="123 Main Street",
line2="Apt 4B",
line3="Building 7",
postal_code="90210",
city="Beverly Hills",
state_code="CA",
country_code="USA"
)
)
)
# Using an existing token ID with an expiration date override
await client.network_tokens.create(
token_id="c06d0789-0a38-40be-b7cc-c28a718f76f1",
expiration_month=10,
expiration_year=2025
)
# Using an existing token intent ID
await client.network_tokens.create(
token_intent_id="c06d0789-0a38-40be-b7cc-c28a718f76f1",
cardholder_info=CardholderInfo(
name="John Doe",
address=Address(
line1="123 Main Street",
line2="Apt 4B",
line3="Building 7",
postal_code="90210",
city="Beverly Hills",
state_code="CA",
country_code="USA"
)
)
)
# Using an existing token intent ID with an expiration date override
await client.network_tokens.create(
token_intent_id="c06d0789-0a38-40be-b7cc-c28a718f76f1",
expiration_month=10,
expiration_year=2025
)
# Using raw card data
await client.network_tokens.create(
data=Card(
number="4000000000000002",
expiration_month=3,
expiration_year=2027,
cvc="123"
),
cardholder_info=CardholderInfo(
name="John Doe",
address=Address(
line1="123 Main Street",
line2="Apt 4B",
line3="Building 7",
postal_code="90210",
city="Beverly Hills",
state_code="CA",
country_code="USA"
)
)
)