# Generate Network Token

**POST** `/dpm/tsp/v1/tokenization/token`

Base URL: `https://api.pre.globalgetnet.com`

__Generate Network Token__<br><br>This endpoint requests a network token for a card directly from the card brand's Token Service Provider (TSP). A network token replaces the PAN with a brand-issued token you can use in place of the raw card number.<br><br>**Usage Scenarios:**<br>- Obtaining a network token to use instead of the raw card number in a payment.<br>- Preparing a card for a network-tokenized transaction that also requires a cryptogram.<br><br>**Notes:**<br>- Call [Generate Cryptogram](#tag/network-token/post/dpm/tsp/v1/tokenization/crypt) with the returned `network_token_id` to obtain the cryptogram required for the payment.<br>- The network token is issued by the card brand, not by Getnet's vault.

## Authorization

- PROD (oauth2)
- PRE (oauth2)
- SBX (oauth2)

## Body

Content type: `application/json`

- `customer_id` (string)
  Buyer identifier. Application-defined information that consumes the Digital Platform API.
- `email` (string)
  Buyer's email address.
- `card_brand` (string, required)
  Card brand of the PAN to tokenize with the card brand's Token Service Provider (TSP).
- `card_pan_source` (string, required)
  Source of the card data sent for tokenization.
- `card_pan` (string, required)
  Card Number (PAN) to tokenize with the card brand's Token Service Provider (TSP).
- `security_code` (string, required)
  Security code. CVV or CVC.
- `expiration_month` (string, required)
  Two-digit card expiration month.
- `expiration_year` (string, required)
  Four-digit card expiration year.

Example:

```json
{
  "customer_id": "088442880012",
  "email": "user@email.com",
  "card_brand": "visa",
  "card_pan_source": "ON_FILE",
  "card_pan": "5204731600014784",
  "security_code": "681",
  "expiration_month": "12",
  "expiration_year": "2030"
}
```

## Responses

### 200

Network token generated successfully.

- `x_trace_id` (string<uuid>, required)
  Trace identifier for the request. Use it when contacting Getnet support about this request.
- `network_token_id` (string, required)
  Identifier of the network token issued by the card brand's Token Service Provider (TSP). Send it to Generate Cryptogram, and use it in the payment request's `card.number` field in place of the raw PAN.
- `token_status` (string, required)
  Status of the network token.

Example:

```json
{
  "x_trace_id": "0459e608-4445-4028-8667-e6e5b6d942df",
  "network_token_id": "d3ec0f0ff65a4ef4b65194cbf64d263f",
  "token_status": "ACTIVE"
}
```

### 400

Invalid request.

- `message` (string)
  Detailed error message.
- `name` (string)
  Name of the module or service that returned the error.
- `status_code` (integer<int32>)
  HTTP status code of the error.
- `details` (object[])
  Network tokenization error details.
  - `status` (string)
    Error situation.
  - `error_code` (string)
    Error code.
  - `description` (string)
    Short description of the error.
  - `description_detail` (string)
    Specific reason the network token or cryptogram request failed, naming the invalid field or the token service provider's denial reason.

Example:

```json
{
  "message": "Unprocessable Entity",
  "name": "GatewayParametersServiceError",
  "status_code": 422,
  "details": [
    {
      "status": "DENIED",
      "error_code": "TOKENIZATION-422",
      "description": "Unprocessable Entity",
      "description_detail": "The card is not enrolled for network tokenization with this card brand's token service provider."
    }
  ]
}
```

### 401

Invalid Authentication.

- `message` (string)
  Detailed error message.
- `name` (string)
  Name of the module or service that returned the error.
- `status_code` (integer<int32>)
  HTTP status code of the error.
- `details` (object[])
  Network tokenization error details.
  - `status` (string)
    Error situation.
  - `error_code` (string)
    Error code.
  - `description` (string)
    Short description of the error.
  - `description_detail` (string)
    Specific reason the network token or cryptogram request failed, naming the invalid field or the token service provider's denial reason.

Example:

```json
{
  "message": "Unprocessable Entity",
  "name": "GatewayParametersServiceError",
  "status_code": 422,
  "details": [
    {
      "status": "DENIED",
      "error_code": "TOKENIZATION-422",
      "description": "Unprocessable Entity",
      "description_detail": "The card is not enrolled for network tokenization with this card brand's token service provider."
    }
  ]
}
```

### 422

Unprocessable Entity

- `message` (string)
  Detailed error message.
- `name` (string)
  Name of the module or service that returned the error.
- `status_code` (integer<int32>)
  HTTP status code of the error.
- `details` (object[])
  Network tokenization error details.
  - `status` (string)
    Error situation.
  - `error_code` (string)
    Error code.
  - `description` (string)
    Short description of the error.
  - `description_detail` (string)
    Specific reason the network token or cryptogram request failed, naming the invalid field or the token service provider's denial reason.

Example:

```json
{
  "message": "Unprocessable Entity",
  "name": "GatewayParametersServiceError",
  "status_code": 422,
  "details": [
    {
      "status": "DENIED",
      "error_code": "TOKENIZATION-422",
      "description": "Unprocessable Entity",
      "description_detail": "The card is not enrolled for network tokenization with this card brand's token service provider."
    }
  ]
}
```

### 500

Internal server or service error.

- `message` (string)
  Detailed error message.
- `name` (string)
  Name of the module or service that returned the error.
- `status_code` (integer<int32>)
  HTTP status code of the error.
- `details` (object[])
  Network tokenization error details.
  - `status` (string)
    Error situation.
  - `error_code` (string)
    Error code.
  - `description` (string)
    Short description of the error.
  - `description_detail` (string)
    Specific reason the network token or cryptogram request failed, naming the invalid field or the token service provider's denial reason.

Example:

```json
{
  "message": "Unprocessable Entity",
  "name": "GatewayParametersServiceError",
  "status_code": 422,
  "details": [
    {
      "status": "DENIED",
      "error_code": "TOKENIZATION-422",
      "description": "Unprocessable Entity",
      "description_detail": "The card is not enrolled for network tokenization with this card brand's token service provider."
    }
  ]
}
```