# Generate Network Token Cryptogram

This endpoint returns an on-demand **network token cryptogram** for a vaulted card and, by default, the card's current network token (DPAN). A card's network token alone cannot authorize a payment. Card schemes require a single-use cryptogram per transaction, and only WHITELABEL can request it because WHITELABEL holds the Token Requestor ID. Use this endpoint when you want to take a WHITELABEL network token and authorize the transaction on your own PSP.

You identify the card with its `vaulted_token`, the same identifier you use in [Create Payment](/reference/payments/create-payment). WHITELABEL resolves the card's current network token internally and absorbs token rotation, so you always receive a consistent, current `(DPAN, cryptogram, ECI)` set.

<Warning>
**The DPAN requires PCI certification: the cryptogram does not**

The full network token (DPAN) is PAN-equivalent data, so the default response, which includes it, is only available to PCI-certified merchants. The cryptogram itself is not PAN-equivalent: it is single-use, short-lived, and bound to a specific DPAN, so it cannot authorize anything on its own.

If your organization is not PCI-certified, send `include_network_token: false` to receive the cryptogram only. See [Cryptogram-only mode](#cryptogram-only-mode) below. To enable the product, contact your Key Account Manager (KAM).
</Warning>

<Warning>
**Always submit a consistent pair.** A cryptogram is bound to a specific network token. Submit the `network_token.number` (DPAN) returned in the **same response** together with its `cryptogram` and `eci`. Never pair a returned cryptogram with a previously stored DPAN. After a token rotation, a stored DPAN will no longer match. In [cryptogram-only mode](#cryptogram-only-mode) the same rule applies through the proxy: forward immediately after requesting the cryptogram, so the DPAN the proxy resolves is the one the cryptogram was generated for.
</Warning>

## How it works

1. Request a cryptogram right before you authorize. Every call generates a **fresh, single-use** cryptogram from the scheme: there is no idempotency, and duplicate calls return new cryptograms (no money moves).
2. Submit `network_token.number` (DPAN), `cryptogram`, and `eci` to your PSP as a network-token transaction.
3. If the authorization is declined and you retry, request a **new** cryptogram first. A used or stale cryptogram cannot be replayed.

## Cryptogram-only mode

Send `include_network_token: false` and the response omits `network_token.number` (the DPAN) and `network_token.token_data` entirely. The `network_token` object keeps its non-PAN-equivalent metadata (`network`, `status`, `par`, `network_token_id`), and the response carries `cryptogram` and `eci` as usual. Because no PAN-equivalent data is returned, this mode does not require PCI certification.

Pair it with the [Forward Proxy](/docs/security-and-compliance/pci-proxy/forward-proxy) to run a network-token transaction end-to-end without PAN-equivalent data ever entering your systems:

1. Request the cryptogram with `include_network_token: false`.
2. Build the forward request with the `{{vaulted_token.<TOKEN>.network_token_number}}` expression (and the `network_token_expiration_*` expressions) where the destination expects the DPAN. Include the `cryptogram` value directly in the body, since cryptograms are generated per transaction and the proxy does not resolve them as expressions.
3. Send it through the proxy **immediately**: the proxy resolves the card's current DPAN at forward time, and the cryptogram is bound to a specific DPAN. Requesting the cryptogram right before the forward keeps the pair consistent. A delay spanning a token rotation would make them mismatch.

The complete gate matrix:

| Your organization | `include_network_token` | Result |
| --- | --- | --- |
| PCI-certified | `true` / omitted | Full response (network token + cryptogram) |
| PCI-certified | `false` | Cryptogram-only response |
| Not PCI-certified | `false` | Cryptogram-only response |
| Not PCI-certified | `true` / omitted | `403 NETWORK_TOKEN_RETURN_NOT_ALLOWED` |

The last row is an explicit error by design: an integrator expecting `network_token` in the response gets a clear rejection, never a silently degraded response shape.

## Requirements

To use this endpoint your organization must:

- Have the **product enabled** for your organization.
- Be **onboarded for network tokens** for the card's brand and the requested `country`.
- Be a **PCI-certified merchant** to receive the network token (DPAN) in the response. [Cryptogram-only mode](#cryptogram-only-mode) (`include_network_token: false`) does not require PCI certification.

The card referenced by `vaulted_token` must be an **enrolled card** of your organization that already has an **active network token**.

Supported networks: **Visa** and **Mastercard**.

<Note>
**When you don't need this endpoint.** Recurring merchant-initiated transactions (MIT) authorize with the network token and the stored `network_transaction_id` and do **not** require a cryptogram. This endpoint is for customer-initiated transactions that need a fresh cryptogram.
</Note>

## Cryptogram lifetime

The cryptogram is single-use. Request it immediately before you authorize, and do not cache it.

## Errors

Errors return a `code` and a `messages` array. The exact `messages` value per `code`:

| HTTP | `code` | `messages` |
| --- | --- | --- |
| 404 | `PAYMENT_METHOD_NOT_FOUND` | "Payment method not found." |
| 400 | `INSTRUMENT_NOT_TOKENIZABLE` | "Payment method is not a card." |
| 400 | `PAYMENT_METHOD_NOT_ENROLLED` | "Payment method is not enrolled." |
| 400 | `NETWORK_TOKEN_NOT_FOUND` | "Payment method has no network token." |
| 400 | `TOKEN_NOT_ACTIVE` | "Network token is not active." |
| 400 | `NETWORK_NOT_SUPPORTED` | "Network token brand is not supported." |
| 400 | `COUNTRY_NOT_SUPPORTED` | "Country is not supported for this organization." |
| 400 | `INVALID_REQUEST` | The specific invalid field, for example "The field 'vaulted_token' must be a valid uuid v4." |
| 403 | `PCI_MERCHANT_REQUIRED` | "This endpoint is only available to PCI-certified merchants." |
| 403 | `NETWORK_TOKEN_RETURN_NOT_ALLOWED` | "Returning the network token requires PCI certification. Send include_network_token: false to receive the cryptogram only, or contact your Key Account Manager (KAM)." |
| 403 | `PRODUCT_NOT_ENABLED` | "The Network Token Cryptogram API is enabled per organization. Contact your Key Account Manager (KAM) to activate it." |
| 502 | `PROVIDER_ERROR` | "The network token cryptogram service is temporarily unavailable, please retry." |

A `vaulted_token` that doesn't exist and one that belongs to another organization both return the same `PAYMENT_METHOD_NOT_FOUND`, so there is no existence leak.

**POST** `/network-tokens/cryptograms`

Base URL: `https://api-sandbox.whitelabel.com/v1`

Generates a fresh, single-use network token cryptogram for a vaulted card, so it can be authorized on an external PSP. By default the response also includes the card's current network token (DPAN), which requires PCI certification; with `include_network_token: false` the response is cryptogram-only and does not.

## Authorization

- public-api-key (apiKey in header)
- private-secret-key (apiKey in header)

## Body

Content type: `application/json`

- `vaulted_token` (string<uuid>, required)
  The vaulted token of the card, the same identifier used as `payment_method.vaulted_token` in [Create Payment](https://docs.whitelabel.com/reference/create-payment). The card must be an enrolled card of your organization with an active network token.
- `country` (string, required)
  ISO 3166-1 alpha-2 country code where the token will be used. Resolves the network token onboarding (organization + brand + country), with the same semantics as `country` in Create Payment.
- `amount` (object)
  Optional. Forwarded to the scheme; recommended, as some scheme flows bind the amount.
  - `currency` (string)
    ISO 4217 currency code.
  - `value` (number)
    Amount value in the given currency.
- `include_network_token` (boolean)
  Optional. Whether the response includes the PAN-equivalent parts of the network token: `network_token.number` (the DPAN) and `network_token.token_data`. Defaults to `true`, which requires your organization to be a PCI-certified merchant. Send `false` for a cryptogram-only response with no PAN-equivalent data (the `network_token` object keeps `network`, `status`, `par` and `network_token_id`) — available without PCI certification, designed to pair with the [Forward Proxy](https://docs.whitelabel.com/docs/security-and-compliance/pci-proxy/forward-proxy), which resolves the DPAN at forward time via the `network_token_number` expression. A non-PCI organization that sends `true` or omits the field receives `403 NETWORK_TOKEN_RETURN_NOT_ALLOWED`.

Example:

```json
{
  "vaulted_token": "00000000-0000-0000-0000-000000000000",
  "country": "string",
  "amount": {
    "currency": "string",
    "value": 0
  },
  "include_network_token": true
}
```

## Responses

### 201

Cryptogram generated.

- `vaulted_token` (string)
  Echo of the request's vaulted token.
- `network_token` (object)
  The card's current network token. Same shape returned by the PCI network-token retrieval. **When the request sets `include_network_token: false`, the `number` (DPAN) and `token_data` fields are omitted entirely** — the object keeps `network`, `status`, `par` and `network_token_id`.
  - `network` (string)
    Card network.
  - `number` (string)
    The current DPAN (device/network PAN). **Always submit this value with the returned `cryptogram`** — never a previously stored DPAN.
  - `status` (string,null)
    Network token status.
  - `par` (string,null)
    Payment Account Reference.
  - `network_token_id` (string,null)
    Network token identifier.
  - `token_data` (object)
    - `iin` (string)
    - `lfd` (string)
      Last four digits of the DPAN.
    - `expiration_month` (integer)
    - `expiration_year` (integer)
- `cryptogram` (string)
  A fresh, single-use cryptogram from the scheme, generated on every call. Submit it together with `network_token.number` (DPAN) and `eci` to your PSP.
- `eci` (string,null)
  Electronic Commerce Indicator. May be `null` for some Mastercard DSRP formats.
- `created_at` (string<date-time>)
  Issuance timestamp (UTC).

Example:

```json
{
  "vaulted_token": "string",
  "network_token": {
    "network": "string",
    "number": "string",
    "status": null,
    "par": null,
    "network_token_id": null,
    "token_data": {
      "iin": "string",
      "lfd": "string",
      "expiration_month": 0,
      "expiration_year": 0
    }
  },
  "cryptogram": "string",
  "eci": null,
  "created_at": "1970-01-01T00:00:00.000Z"
}
```

### 400

Bad request — `INVALID_REQUEST`, `INSTRUMENT_NOT_TOKENIZABLE`, `PAYMENT_METHOD_NOT_ENROLLED`, `NETWORK_TOKEN_NOT_FOUND`, `TOKEN_NOT_ACTIVE`, `NETWORK_NOT_SUPPORTED`, or `COUNTRY_NOT_SUPPORTED`.

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "string",
  "messages": [
    "string"
  ]
}
```

### 403

Forbidden — `NETWORK_TOKEN_RETURN_NOT_ALLOWED` (organization is not PCI-certified and the request did not set `include_network_token: false`), `PCI_MERCHANT_REQUIRED` (organization is not a PCI-certified merchant), or `PRODUCT_NOT_ENABLED` (product flag is off for the organization).

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "string",
  "messages": [
    "string"
  ]
}
```

### 404

Not found — `PAYMENT_METHOD_NOT_FOUND`. The `vaulted_token` does not exist or does not belong to your organization (identical response, no existence leak).

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "string",
  "messages": [
    "string"
  ]
}
```

### 502

Provider error — `PROVIDER_ERROR`. The card scheme (Visa VTS / Mastercard MDES) could not be reached or returned an error.

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "string",
  "messages": [
    "string"
  ]
}
```