> ## Documentation Index
> Fetch the complete documentation index at: https://infisical.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Revoke a session

> Revoke an Agent Vault session with the Node.js SDK.

`client.agentVault().sessions.revoke()` revokes a session. Revoke a session when its agent finishes, even if the agent fails. The proxy stops attaching credentials to the session's requests within one [poll interval](https://infisical.com/docs/documentation/platform/agent-vault/proxies#poll-interval).

If the agent can run longer than the client's access token lasts, log in again before you revoke the session, because the SDK doesn't renew the access token on its own. Set `ttl` close to how long the agent runs, so that the session expires soon after the agent finishes even if revoking the session fails.

## Parameters

**sessionId** `string` *required*

The ID of the session.

## Returns

**session** `Omit\<AgentVaultSession, "accessBundle" | "services"\>`

The revoked session, without its access bundle and inline services (call `get` for them).

```typescript Basic theme={"dark"}
await client.agentVault().sessions.revoke("<session-id>");
```

```typescript When the agent finishes theme={"dark"}
const session = await client.agentVault().sessions.create({
  projectId: "<project-id>",
  accessBundle: "<access-bundle-name>",
  ttl: "1h"
});

try {
  await runAgent(session.token); // Your code that starts the agent with the session token
} finally {
  await client.agentVault().sessions.revoke(session.id);
}
```

```json Response theme={"dark"}
{
  "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
  "label": "nightly deploy",
  "actor": {
    "type": "machineIdentity",
    "id": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f",
    "name": "deploy-bot"
  },
  "onBehalfOf": null,
  "status": "revoked",
  "expiresAt": "2026-12-02T13:00:00.000Z",
  "revokedAt": "2026-12-02T12:18:44.000Z",
  "createdAt": "2026-12-02T12:00:00.000Z",
  "metadata": { "runId": "8812" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.