> For the complete documentation index, see [llms.txt](https://docs.pagsmile.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pagsmile.com/reference/payin/tools/tokenize.md).

# Get CreditCard Token

#### Request Base URL <a href="#request-base-url" id="request-base-url"></a>

```
  Test Environment: https://security-test.pagsmile.com
  Prod Environment: https://security.pagsmile.com
```

#### EndPoints <a href="#endpoints" id="endpoints"></a>

```
  /card/tokenize
```

#### Request Header <a href="#request-header" id="request-header"></a>

| Parameter     | Required  | Description                         |
| ------------- | --------- | ----------------------------------- |
| Content-Type  | recommend | application/json                    |
| Authorization | yes       | Basic Base64(app\_id:security\_key) |

#### Request Body (JSON format) <a href="#request-body-json-format" id="request-body-json-format"></a>

| Parameter                         | Type   | Required                                 | Max Length(or Default Value) | Description                   |
| --------------------------------- | ------ | ---------------------------------------- | ---------------------------- | ----------------------------- |
| app\_id                           | string | yes                                      | 32                           | created app's id at dashboard |
| timestamp                         | string | yes                                      | 19                           | yyyy-MM-dd HH:mm:ss           |
| card.card\_no                     | string | yes                                      | 32                           |                               |
| card.issuer                       | string | yes                                      | 16                           | visa,mastercard...            |
| card.holder.name                  | string | yes                                      | 64                           |                               |
| card.holder.identification.type   | string | no                                       | 16                           |                               |
| card.holder.identification.number | string | yes. Not required for Chile, Costa Rica. | 64                           |                               |
| card.cvv                          | string | yes. Not required for Costa Rica.        | 8                            | security code                 |
| card.valid\_thru\_year            | string | yes                                      | 4                            | expire year                   |
| card.valid\_thru\_month           | string | yes                                      | 2                            | expire month                  |

#### Request Sample <a href="#request-sample" id="request-sample"></a>

```
curl --location --request POST 'https://security.pagsmile.com/card/tokenize' \
--header 'Authorization: Basic Base64(appid:security_key)' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "1629***13",
    * "timestamp": "2025-10-24 13:18:10",
    * "card": {
    *   "card_no": "545195******2434",
    *   "issuer": "",
    *   "holder": {
    *       "name": ""
        },
    *   "cvv": "",
    *   "valid_thru_year": "2030",
    *   "valid_thru_month": "08"
      } 
}'
```

#### Http Response (JSON format) <a href="#http-response-json-format" id="http-response-json-format"></a>

| Parameter | Type   | Description                 |
| --------- | ------ | --------------------------- |
| code      | string | return code                 |
| msg       | string | return msg                  |
| sub\_code | string | return sub code(only error) |
| sub\_msg  | string | return sub msg(only error)  |
| token     | string |                             |

#### Return Code (Success) <a href="#return-code-success" id="return-code-success"></a>

```
{
    "code": "10000",
    "msg": "Success",
    "token": "{token}",
}
```

#### Return Code (Fail) <a href="#return-code-fail" id="return-code-fail"></a>

```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "invalid-signature",
    "sub_msg": "invalid signature"
}
```
