---
title: "Add Key"
description: "Register an additional public signing key. A newly created key still needs activation."
url: https://app.visacli.sh/docs/reference/vars/add-key
updated: 2026-11-09
---

# Add Key

> Register an additional public signing key. A newly created key still needs activation.

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

```text
POST /vars/v1/agents/{agentId}/keys
```

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. |

## Request body

Required JSON body, with the fields below.

| Field | Type | Presence | Description / constraints |
| --- | --- | --- | --- |
| `keyName` | `string` | Required | Human-readable / stable key name. Visa CLI sends the RFC 7638 thumbprint (JKT). |
| `algorithm` | `string` | Required | For Ed25519 keys, send lowercase ed25519. For any other value, check the current VARS schema, which needs authorized access. |
| `publicKey` | `string` | Required | Base64 of the complete UTF-8 SPKI PEM public key, including PEM markers and line breaks. This is a public signing key. |
| `expirationDate` | `string · date-time` | Optional | UTC expiry. Visa CLI requests now + 365 days. Always send it. |
| `address` | `string` | Optional | Base58 of the raw 32-byte Ed25519 public key, up to 512 characters. It's per-key data from VARS 26.08, and Visa CLI sends it. |

```json title="agent-key-create.json — illustrative payload"
{
  "keyName": "YOUR_PUBLIC_JWK_THUMBPRINT",
  "algorithm": "ed25519",
  "publicKey": "BASE64_ENCODED_SPKI_PEM_PUBLIC_KEY",
  "expirationDate": "2027-11-05T00:00:00Z"
}
```

## Responses

| HTTP | Meaning | Schema |
| --- | --- | --- |
| `201` | Key created inactive; activation follows. | [`KeyResponse`](/docs/reference/schemas.md#vars-schema-KeyResponse) |
| `403` | Agent is deactivated. | [`ErrorResponse`](/docs/reference/schemas.md#vars-schema-ErrorResponse) |
| `404` | Agent not found. | [`ErrorResponse`](/docs/reference/schemas.md#vars-schema-ErrorResponse) |
| `422` | Invalid key fields. | [`ValidationError`](/docs/reference/schemas.md#vars-schema-ValidationError) |

> [!NOTE] Integration detail
> For Ed25519 keys, use lowercase ed25519 and base64 SPKI PEM. Visa CLI also sends address: base58 of the raw public key. Algorithm strings from Visa's sample registry are a separate contract.

```bash title="X-Pay-Token request template"
base='https://sandbox.api.visa.com/vars/v1'
curl --request POST \
  "$base/agents/YOUR_AGENT_ID/keys?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-create.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).
