---
page_title: Generate Network Token
product: API Reference
page_source: https://juspay.io/in/docs/api-reference/docs/tokenization-apis/generate-network-token
openapi: https://juspay.io/in/docs/api/swagger?document=https%3A%2F%2Fjuspay.io%2Fin%2Fdocs%2Fapi-reference%2Fdocs%2Ftokenization-apis%2Fgenerate-network-token
llms_txt: https://juspay.io/in/docs/llms.txt
product_llms_txt: https://juspay.io/in/docs/api-reference/llms.txt
---

## API Version: default


# Generate Network Token



Use this API to pass the card details and tokenize with respective card network. Juspay will tokenize the card and expose an identifier to be used for future transactions## Endpoints:
- Sandbox: https://sandbox.juspay.in/generateToken

- Production: https://api.juspay.in/generateToken

## Request Type: 
POST

## Content-Type: 
application/json

## Authorization:

#### Basic Auth:
Consists of two parts.

* Username: API Key obtained from Juspay dashboard
* Password: Empty string

Example:-Basic MUQ2QUxxxxxxxxxxxxU5QTIxQzNFNTQwNkFDMEZCOg==
- Value: MUQ2QUZEQzhFQTY0OUU5QTIxQzNFNTQwNkFDMEZCOg==
- Tags: Base64 Encoded Username:Password
## Headers:

#### content-type:
application/x-www-form-urlencoded
- Tags: String

#### x-routing-id:
We recommend passing the customer_id as the x-routing-id. If the customer is checking out as a guest, you can pass an alternative ID that helps track the payment session lifecycle. For example, this could be an Order ID or Cart ID.

> **Warning**
> This ID is associated with the customer. It plays a key role in ensuring consistency and maintaining connections across different systems. If you fail to pass the same x-routing-id for the same customer in all related API calls, it could lead to issues with API functionality. Therefore, it’s crucial that you use the same x-routing-id for all requests tied to the same customer.


- Value: customer_1122
- Tags: String, Required
## Sample Code Snippets:
### Code Snippets:

#### Request Code Snippet:

```request
curl --location 'https://sandbox.juspay.in/generateToken' \
--header 'Content-Type: application/json' \
--header 'x-routing-id: customer_1122'\
--header 'Authorization: Basic MDRFRDU3Mzc1Q0Q0NzMxQTMzN0QzQjJEQzlENTBCOg==' \
--data '{
    "service" : "NETWORK_TOKEN",
    "cardData": "xxxxxxx",
    "orderData" : {
        "consentId" : "xxxxxxx",
        "customerId" : "xxxxxxx"
    },
    "audit": {
        "authRefNo" : "test12324"
    },
    "shouldSendToken": true
}'

```

### Sample Request and Response:

#### Encrypted Response:
```json
{
    "errorCode": null,
    "errorMessage": null,
    "payload": "gfusjgfsdvhsfaiuficuiuwgciusbcgiwgfiusfhjbcwgyudshjfhconasjkfihsjdbvhsdjbjhsbvhbsvdbvjbdsfvnbbaskvbbaskvbbaskvbbsakgbksdvjkbsdkvbbsdbkbjsadvbkjsadvbkjwbjasbgbvnsdvksbvksjbvbsvdlbvkjsdbvk",
    "status": "SUCCESS"
}

```

#### Decrypted Response:
```plaintext
{"digitalCardArt": null, "networkResponse": null, "token": "4610151775531093", "cardFingerprint": "26h6yyrxm2gcfb2aqucm1jwmhz", "tokenIsin": "461015177", "enrolledPan": null, "tokenExpiryYear": "2030", "vaultProvider": "NETWORK_TOKEN", "cardBrand": "VISA", "tokenExpiryMonth": "09", "par": "V0010014623309223257681705497", "customerId": "cth_8Rs2s6fSpE9DZJXVg", "correlationId": "bdeeaa173b534c1a81ffd77ba0a3a15e", "tokenLastFour": "1093", "tokenStatus": "ACTIVE", "provisionedTokenId": null, "cardReference": "token_46ad7c5aa6e4442985a9a9f7ff8845fa"}
```

## Body Parameters:
### Basic Parameters:

#### cardData:
- Description: Actual Card to be tokenized in an encrypted format. Generate and use an RSA key to generate EncryptedCardData
- Value:
  - **CardNumber**:
    - Description: 15/16 digit card number
    - Tags: String, Mandatory
  - **ExpYear**:
    - Description: Year in YY format
    - Tags: String, Mandatory
  - **ExpMonth**:
    - Description: Month in MM format
    - Tags: String, Mandatory
  - **NameOnCard**:
    - Tags: String, Optional
  - **CardSecurityCode**:
    - Description: Card CVV, 3 digits or 4 digits basis the card brand.
    - Tags: String, Optional
- Tags: String, Required

#### orderData:
- Value:
  - **ConsentId**:
    - Description: unique identifier passed merchant which signifies that user consent is taken. It could be the transaction_id at zohopay's end
    - Tags: String, Mandatory
  - **CustomerId**:
    - Description: Customerid of the merchant
    - Tags: String, Mandatory
- Tags: JSON, Required

#### audit:
- Description: Mandatory for AMEX Cards
- Value: Audit information is mandatory for AMEX 
- Tags: JSON, Conditional

#### service:
- Description: Specifies the token type

Default: `NETWORK_TOKEN`
- Tags: String, Required

#### submerchantId:
- Description: Sub Merchant ID on which the Token will be generated
- Tags: String

#### shouldSendToken:
- Description: Boolean indicating whether raw token is needed by merchant or not
- Tags: Boolean

#### keyId:
- Description: keyId to be used for encrypting and decrypting payloads
- Tags: String
## API Responses:
### 200:

#### status:
- Description: Status of the response
- Tags: String, Required

#### payload:
- Description: payload with the token details
- Value:
  - **CardFingerprint**:
    - Tags: String
  - **TokenStatus**:
    - Tags: String
  - **CardReference**:
    - Tags: String
  - **CorrelationId**:
    - Tags: String
  - **Par**:
    - Tags: String
  - **CustomerId**:
    - Tags: String
  - **TokenExpiryMonth**:
    - Tags: String
  - **TokenLastFour**:
    - Tags: String
  - **TokenExpiryYear**:
    - Tags: String
  - **TokenIsin**:
    - Tags: String
- Tags: JSON

#### errorCode:
- Description: errorCode incase tokenisation fails
- Tags: String

#### errorMessage:
- Description: errorMessage incase tokenisation fails
- Tags: String


---

## See Also

- [Card encryption - Standalone Tokenization APIs](https://juspay.io/in/docs/api-reference/docs/tokenization-apis/card-encryption-standalone-tokenization-apis)
- [Fetch Token and Cryptogram API](https://juspay.io/in/docs/api-reference/docs/tokenization-apis/fetch-token-and-cryptogram-api)
