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

# Network Tokenize a Card

> Create a network token (Visa, Mastercard, or Amex) from raw card data and store it as a PCI Booking token.

Submits raw card details to the card network (Visa, Mastercard, or Amex) for network tokenization. On success, the resulting network token is stored as a PCI Booking token and the token URI is returned in the `Location` header.

<Note>
  Network tokenization replaces the real card number with a network-issued token that is bound to your merchant. The network token receives automatic card-on-file updates from the issuer, reducing declines from expired or replaced cards.
</Note>

## Error Responses

| Code    | HTTP Status | Condition                                                                                         |
| ------- | ----------- | ------------------------------------------------------------------------------------------------- |
| `-1003` | `401`       | API key is missing or invalid.                                                                    |
| `-125`  | `400`       | Request body validation failed (missing required fields, invalid card number, etc.).              |
| `-150`  | `500`       | Network tokenization failed (card cannot be network-tokenized, or the network returned an error). |

## Parameter Constraints

* **Card.Number**: Valid card number (Visa, Mastercard, or Amex).
* **Card.ExpirationMonth**: Range 1-12.
* **Card.SecurityCode**: 3-4 digits (regex `^\d{3,4}$`).
* **TokenizationRequest.ConsumerLanguage**: Exactly 2 characters, ISO 639-1 language code. Defaults to `en`.
* **TokenizationRequest.CardHolder.CountryCode**: Exactly 2 uppercase letters (ISO 3166-1 alpha-2).
* **TokenizationRequest.DeviceScore**: Range 1-5, defaults to 5.
* **TokenizationRequest.AccountScore**: Range 1-5, defaults to 5.
* **TokenizationRequest.DeviceLocationLat**: Range -90 to 90.
* **TokenizationRequest.DeviceLocationLon**: Range -180 to 180.

## Parameters

### Headers

<ParamField header="Authorization" type="string" required>
  Your API key prefixed with `APIKEY`. Example: `APIKEY your-api-key`. See the [Authentication guide](/getting-started/authentication).
</ParamField>

### Query String

<ParamField query="loc" type="string">
  Token storage region. One of: `US`, `IN`, `AU`, `JP`, `CA`, `IE`, `GB`, `BR`. If omitted, uses the account default.
</ParamField>

### Request Body

<ParamField body="Card" type="object" required>
  The card details to network-tokenize.

  <Expandable title="Properties">
    <ParamField body="Card.Number" type="string" required>
      The full card number.
    </ParamField>

    <ParamField body="Card.ExpirationYear" type="integer" required>
      Four-digit expiration year (e.g. `2028`).
    </ParamField>

    <ParamField body="Card.ExpirationMonth" type="integer" required>
      Expiration month (1-12).
    </ParamField>

    <ParamField body="Card.SecurityCode" type="string">
      The card CVV (3-4 digits).
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="TokenizationRequest" type="object" required>
  Network tokenization parameters including cardholder and device information.

  <Expandable title="Properties">
    <ParamField body="TokenizationRequest.ConsumerLanguage" type="string" default="en">
      ISO 639-1 language code (exactly 2 characters).
    </ParamField>

    <ParamField body="TokenizationRequest.CardHolder" type="object">
      Cardholder details required by the card network.

      <Expandable title="Properties">
        <ParamField body="TokenizationRequest.CardHolder.FirstName" type="string" required>
          Cardholder first name.
        </ParamField>

        <ParamField body="TokenizationRequest.CardHolder.LastName" type="string" required>
          Cardholder last name.
        </ParamField>

        <ParamField body="TokenizationRequest.CardHolder.Email" type="string">
          Cardholder email address.
        </ParamField>

        <ParamField body="TokenizationRequest.CardHolder.Phone" type="string">
          Cardholder phone number.
        </ParamField>

        <ParamField body="TokenizationRequest.CardHolder.ClientIPAddress" type="string" required>
          Cardholder's IP address.
        </ParamField>

        <ParamField body="TokenizationRequest.CardHolder.CountryCode" type="string" required>
          ISO 3166-1 alpha-2 country code (e.g. `US`, `GB`).
        </ParamField>

        <ParamField body="TokenizationRequest.CardHolder.Address1" type="string">
          Billing address line 1.
        </ParamField>

        <ParamField body="TokenizationRequest.CardHolder.City" type="string">
          Billing city.
        </ParamField>

        <ParamField body="TokenizationRequest.CardHolder.StateProvince" type="string">
          Billing state or province.
        </ParamField>

        <ParamField body="TokenizationRequest.CardHolder.PostCode" type="string">
          Billing postal code.
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="TokenizationRequest.DeviceScore" type="integer" default="5">
      Device trust score (1-5). Higher values indicate higher trust.
    </ParamField>

    <ParamField body="TokenizationRequest.AccountScore" type="integer" default="5">
      Account trust score (1-5). Higher values indicate higher trust.
    </ParamField>

    <ParamField body="TokenizationRequest.DeviceLocationLat" type="number">
      Device latitude (-90 to 90).
    </ParamField>

    <ParamField body="TokenizationRequest.DeviceLocationLon" type="number">
      Device longitude (-180 to 180).
    </ParamField>

    <ParamField body="TokenizationRequest.DeviceIpAddress" type="string">
      Device IP address (if different from cardholder IP).
    </ParamField>

    <ParamField body="TokenizationRequest.CardSource" type="string">
      Source of the card data (network-specific enum).
    </ParamField>
  </Expandable>
</ParamField>

<RequestExample>
  ```javascript Node.js theme={null}
  const response = await fetch('https://service.pcibooking.net/api/networkToken?loc=IE', {
    method: 'POST',
    headers: {
      'Authorization': 'APIKEY your-api-key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      Card: {
        Number: '4111111111111111',
        ExpirationYear: 2028,
        ExpirationMonth: 12,
        SecurityCode: '123'
      },
      TokenizationRequest: {
        ConsumerLanguage: 'en',
        CardHolder: {
          FirstName: 'John',
          LastName: 'Doe',
          Email: 'john.doe@example.com',
          ClientIPAddress: '203.0.113.42',
          CountryCode: 'US',
          Address1: '123 Main St',
          City: 'New York',
          StateProvince: 'NY',
          PostCode: '10001'
        },
        DeviceScore: 5,
        AccountScore: 5
      }
    })
  });

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://service.pcibooking.net/api/networkToken',
      headers={
          'Authorization': 'APIKEY your-api-key',
          'Content-Type': 'application/json'
      },
      params={
          'loc': 'IE'
      },
      json={
          'Card': {
              'Number': '4111111111111111',
              'ExpirationYear': 2028,
              'ExpirationMonth': 12,
              'SecurityCode': '123'
          },
          'TokenizationRequest': {
              'ConsumerLanguage': 'en',
              'CardHolder': {
                  'FirstName': 'John',
                  'LastName': 'Doe',
                  'Email': 'john.doe@example.com',
                  'ClientIPAddress': '203.0.113.42',
                  'CountryCode': 'US',
                  'Address1': '123 Main St',
                  'City': 'New York',
                  'StateProvince': 'NY',
                  'PostCode': '10001'
              },
              'DeviceScore': 5,
              'AccountScore': 5
          }
      }
  )

  print(response.json())
  ```
</RequestExample>

## Response

**201** - Network token created. The `Location` header contains the PCI Booking token URI for the network-tokenized card.

<ResponseExample>
  ```json 201 theme={null}
  {
      "ResultCode": "Success",
      "Brand": "Visa",
      "TokenId": "4895370012003478",
      "TokenizedCard": {
          "Number": "489537******3478",
          "ExpirationMonth": 12,
          "ExpirationYear": 2028
      }
  }
  ```

  ```json 400 theme={null}
  {
      "code": -125,
      "message": "Bad input data",
      "moreInfo": "...",
      "errorList": null
  }
  ```

  ```json 401 theme={null}
  {
      "code": -1003,
      "message": "Not authorized to access this resource",
      "moreInfo": "Bad or missing authorization data, expected APIKEY",
      "errorList": null
  }
  ```
</ResponseExample>
