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

# Get a delegation

> Fetch an Agent Vault delegation with the Python SDK.

`client.agent_vault.delegations.get()` gets which users a machine identity can create sessions on behalf of. If the machine identity has no delegation, `get` raises an `APIError` whose `status_code` is `404`. To catch the error, import the class with `from infisical_sdk import APIError`.

The client must log in as a user or machine identity with the **Admin** role in the [Agent Vault project](https://infisical.com/docs/documentation/platform/agent-vault/access-control#product-membership). A machine identity without the role can still get its own delegation.

## Parameters

**project\_id** `str` *required*

The ID of the [Agent Vault project](https://infisical.com/docs/documentation/platform/agent-vault/projects.md#find-the-project-id) to get the delegation from.

**machine\_identity\_id** `str` *required*

The ID of the machine identity.

## Returns

**delegation** `AgentVaultDelegation`

The delegation, including `missingAccessBundles`.

`missingAccessBundles` lists the access bundles that the delegation's users can use and the machine identity can't. A session on behalf of a user can use only an access bundle that both the user and the machine identity can use, so the machine identity can't create sessions with those access bundles. If a machine identity without the **Admin** role gets its own delegation, `missingAccessBundles` is empty.

```python Basic theme={"dark"}
delegation = client.agent_vault.delegations.get(
    project_id="<project-id>",
    machine_identity_id="<machine-identity-id>",
)
```

```python No delegation theme={"dark"}
from infisical_sdk import APIError

try:
    delegation = client.agent_vault.delegations.get(
        project_id="<project-id>",
        machine_identity_id="<machine-identity-id>",
    )
except APIError as error:
    if error.status_code != 404:
        raise
    delegation = None
```

```json Response theme={"dark"}
{
  "machineIdentity": {
    "id": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f",
    "name": "deploy-bot"
  },
  "scope": "selected",
  "users": [
    {
      "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
      "username": "jsmith@example.com",
      "email": "jsmith@example.com",
      "firstName": "Jo",
      "lastName": "Smith",
      "addedAt": "2026-11-20T10:00:00.000Z",
      "missingAccessBundles": [
        { "id": "7b8c9d0e-1f2a-4b3c-8d4e-5f6a7b8c9d0e", "name": "billing" }
      ]
    }
  ],
  "groups": [],
  "missingAccessBundles": [
    { "id": "7b8c9d0e-1f2a-4b3c-8d4e-5f6a7b8c9d0e", "name": "billing" }
  ],
  "createdAt": "2026-11-20T10:00:00.000Z",
  "updatedAt": "2026-11-20T10:00:00.000Z"
}
```


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