> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atlaspay.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Network Tokens

Improve authorization rates and reduce interchange costs with network-level tokenization.

## What are Network Tokens?

Network Tokens are dynamic card substitutes provisioned by card networks (Visa, Mastercard, Amex). They replace static card numbers with secure tokens, providing significant benefits:

| Benefit               | Impact                                    |
| --------------------- | ----------------------------------------- |
| **Higher Auth Rates** | +5-10% improvement                        |
| **Lower Interchange** | -3-5 basis points                         |
| **Auto Card Updates** | Cards updated automatically when reissued |
| **Less Fraud**        | -40% reduction                            |

## How It Works

1. Card is tokenized with Atlas
2. Atlas provisions a network token from Visa/Mastercard
3. Payments use the network token + cryptogram
4. Higher approval rates and lower costs

## Create Network Token

```bash theme={null}
curl -X POST https://api.atlas.co/functions/v1/network-tokens \
  -H "Authorization: Bearer cs_client_secret_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "sess_abc123",
    "token_id": "tok_card_xyz",
    "request_cryptogram": true
  }'
```

**Parameters:**

| Parameter            | Type    | Required | Description                                      |
| -------------------- | ------- | -------- | ------------------------------------------------ |
| `session_id`         | string  | Yes      | Payment session ID                               |
| `token_id`           | string  | Yes      | Card token from tokenization                     |
| `request_cryptogram` | boolean | No       | Generate cryptogram immediately (default: false) |

**Response:**

```json theme={null}
{
  "networkTokenId": "nt_abc123...",
  "network": "visa",
  "status": "active",
  "tokenExpiryMonth": "12",
  "tokenExpiryYear": "2028",
  "cryptogram": "AgAAAAAABk4...",
  "cryptogramType": "TAVV"
}
```

## Generate Cryptogram

Cryptograms are single-use and required for each transaction:

```bash theme={null}
curl -X POST https://api.atlas.co/functions/v1/network-tokens/nt_abc123/cryptogram \
  -H "Authorization: Bearer cs_client_secret_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "sess_abc123"
  }'
```

**Response:**

```json theme={null}
{
  "cryptogram": "AgAAAAAABk4...",
  "cryptogramType": "TAVV",
  "expiresAt": "2025-01-21T12:10:00Z"
}
```

> **Note:** Cryptograms expire after 10 minutes.

## Get Network Token

```bash theme={null}
curl "https://api.atlas.co/functions/v1/network-tokens/nt_abc123?session_id=sess_abc123" \
  -H "Authorization: Bearer cs_client_secret_xxx"
```

## Delete Network Token

Suspend a network token when a customer removes their saved card:

```bash theme={null}
curl -X DELETE "https://api.atlas.co/functions/v1/network-tokens/nt_abc123?session_id=sess_abc123" \
  -H "Authorization: Bearer cs_client_secret_xxx"
```

## SDK Integration

```javascript theme={null}
// Create network token
const networkToken = await Atlas.createNetworkToken({
  sessionId: session.id,
  tokenId: cardToken.id,
  requestCryptogram: true
});

// Use for payment
await Atlas.confirmPayment({
  sessionId: session.id,
  networkTokenId: networkToken.networkTokenId,
  cryptogram: networkToken.cryptogram
});

// Generate new cryptogram for subsequent payment
const { cryptogram } = await Atlas.getCryptogram(networkToken.networkTokenId);
```

## Token Lifecycle

| Event         | Description                             |
| ------------- | --------------------------------------- |
| **Created**   | Network token provisioned and active    |
| **Updated**   | Card details changed (new expiry, etc.) |
| **Suspended** | Temporarily deactivated                 |
| **Deleted**   | Permanently removed                     |

## Automatic Updates

Network tokens automatically update when:

* Card is reissued with new expiry
* Card number changes (rare)
* Account status changes

You receive a webhook when tokens are updated:

```json theme={null}
{
  "type": "network_token.updated",
  "data": {
    "networkTokenId": "nt_abc123",
    "previousExpiry": "12/2025",
    "newExpiry": "12/2028"
  }
}
```

## Supported Networks

* Visa (VTS)
* Mastercard (MDES)
* American Express
* Discover (coming soon)
