---
title: "Update Key"
description: "Update key data. Visa CLI uses this operation to extend expirationDate."
url: https://app.visacli.sh/docs/reference/vars/update-key
updated: 2026-11-09
---

# Update Key

> Update key data. Visa CLI uses this operation to extend expirationDate.

Canonical: https://app.visacli.sh/docs/reference/vars/update-key. Updated: 2026-11-09. Full index: /llms.txt.

```text
PUT /vars/v1/agents/{agentId}/keys/{keyId}
```

Related guide: [Register an agent](/docs/register-an-agent.md).

**Authentication:** the method you chose, X-Pay-Token or two-way TLS; see [X-Pay-Token / mTLS](/docs/reference/authentication.md). X-Pay uses the signed apiKey query.

## Parameters

| Parameter | Location | Required | Type / meaning |
| --- | --- | --- | --- |
| `agentId` | path | Yes | `string`<br>The agent's ID, returned as id. |
| `keyId` | path | Yes | `string`<br>The key's ID, returned as id. |

## Request body

Required JSON body. Every field is optional, so send only what changes.

| Field | Type | Presence | Description / constraints |
| --- | --- | --- | --- |
| `expirationDate` | `string · date-time` | Optional | The field Visa CLI updates today; use an explicit UTC instant. |
| `keyName` | `string` | Optional | The key's name. Visa CLI doesn't send it, so confirm it against the authorized schema. |
| `algorithm` | `string` | Optional | The key's algorithm. The current allowed values aren't public. |
| `publicKey` | `string` | Optional | The public key, as base64 SPKI PEM if your authorized schema accepts it. |

```json title="agent-key-update.json — illustrative payload"
{
  "expirationDate": "2027-11-05T00:00:00Z"
}
```

## Responses

| HTTP | Meaning | Schema |
| --- | --- | --- |
| `200` | Key updated. | [`KeyResponse`](/docs/reference/schemas.md#vars-schema-KeyResponse) |
| `403` | Agent / key deactivated. | [`ErrorResponse`](/docs/reference/schemas.md#vars-schema-ErrorResponse) |
| `404` | Agent / key not found. | [`ErrorResponse`](/docs/reference/schemas.md#vars-schema-ErrorResponse) |
| `409` | Duplicate keyName. | [`ErrorResponse`](/docs/reference/schemas.md#vars-schema-ErrorResponse) |

> [!NOTE] Integration detail
> The schema lists keyName, algorithm and publicKey as additional changeable fields. Visa CLI only updates expirationDate. Read back the exact key and expiry.

```bash title="X-Pay-Token request template"
base='https://sandbox.api.visa.com/vars/v1'
curl --request PUT \
  "$base/agents/YOUR_AGENT_ID/keys/YOUR_KEY_ID?apiKey=YOUR_API_KEY" \
  --header 'Accept: application/json' \
  --header 'x-pay-token: TOKEN_FOR_THIS_EXACT_REQUEST' \
  --header 'Content-Type: application/json' \
  --data-binary @agent-key-update.json
```

The token covers this URL's exact query and the exact request body, so each request needs a new one. Replace the `YOUR_` values with your own.

Sources: [Current TAP API reference / endpoint catalog](https://developer.visa.com/api-reference/trusted-agent-protocol).
