> For the complete documentation index, see [llms.txt](https://docs.cardspro.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cardspro.com/api/cards/card-pin-management.md).

# Card PIN Management

Set/Update a PIN for a card

#### Set PIN <a href="#set-pin" id="set-pin"></a>

Sets a PIN for a card (first-time setup).

**Endpoint:** `POST /{san}/set-pin`

**Path Parameters:**

* `san` - Secure Account Number (card identifier)

**Content-Type:** `application/json`

**Request Body:**

```json
{
  "pin": "1234"
}
```

**Request Parameters:**

| Field | Type   | Required | Constraints      | Description  |
| ----- | ------ | -------- | ---------------- | ------------ |
| `pin` | String | Yes      | Exactly 4 digits | New PIN code |

**Response:**

```json
{
  "success": true,
  "message": "PIN set successfully"
}
```

***

#### Update PIN <a href="#update-pin" id="update-pin"></a>

Updates an existing card PIN.

**Endpoint:** `POST /{san}/update-pin`

**Path Parameters:**

* `san` - Secure Account Number (card identifier)

**Content-Type:** `application/json`

**Request Body:**

```json
{
  "oldPin": "1234",
  "pin": "5678"
}
```

**Request Parameters:**

| Field    | Type   | Required                     | Constraints      | Description      |
| -------- | ------ | ---------------------------- | ---------------- | ---------------- |
| `oldPin` | String | Yes (for some products only) | Exactly 4 digits | Current PIN code |
| `pin`    | String | Yes                          | Exactly 4 digits | New PIN code     |

**Response:**

```json
{
  "success": true,
  "message": "PIN updated successfully"
}
```

***

**Response Parameters:**

<table><thead><tr><th width="174.5556640625">Field</th><th width="164.8887939453125">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td>Boolean</td><td>Indicates if the operation was successful</td></tr><tr><td><code>message</code></td><td>String</td><td>Descriptive message about the operation result</td></tr></tbody></table>
