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

# Archive a credential

> Archive an active Vault credential.

`POST /api/v1/cloud/vaults/{vault_id}/credentials/{credential_id}/archive`

Archives an active credential in the specified Vault. Archived credentials are excluded from credential lists by default, but can be included with `include_archived=true`.

## Path parameters

| Parameter       | Type   | Required | Description                            |
| --------------- | ------ | -------- | -------------------------------------- |
| `vault_id`      | string | Yes      | Vault ID with the `vault_` prefix      |
| `credential_id` | string | Yes      | Credential ID with the `vcred_` prefix |

## Headers

| Header          | Required | Description         |
| --------------- | -------- | ------------------- |
| `Authorization` | Yes      | `Bearer $QODER_PAT` |

## Example request

```bash theme={null}
curl -X POST "https://api.qoder.com/api/v1/cloud/vaults/vault_019e3bb940277f0db05ab74291acf6ef/credentials/vcred_019e3bb98877759e862750b495c1fce8/archive" \
  -H "Authorization: Bearer $QODER_PAT"
```

## Example response

**HTTP 200 OK**

Returns the archived credential. The response never includes `access_token`.

```json theme={null}
{
  "id": "vcred_019e3bb98877759e862750b495c1fce8",
  "type": "vault_credential",
  "vault_id": "vault_019e3bb940277f0db05ab74291acf6ef",
  "auth": {
    "type": "static_bearer",
    "mcp_server_url": "https://example.com/mcp-stream"
  },
  "display_name": null,
  "metadata": {
    "team": "docs"
  },
  "archived_at": "2026-05-18T15:45:35.387093Z",
  "created_at": "2026-05-18T15:34:35.387093Z",
  "updated_at": "2026-05-18T15:45:35.387093Z"
}
```

## Response fields

| Field          | Type   | Description                                                         |
| -------------- | ------ | ------------------------------------------------------------------- |
| `id`           | string | Credential unique identifier with the `vcred_` prefix               |
| `type`         | string | Always `"vault_credential"`                                         |
| `vault_id`     | string | Owning Vault ID                                                     |
| `auth`         | object | Sanitized authentication details; secrets are never returned        |
| `display_name` | null   | Currently always `null`                                             |
| `metadata`     | object | Custom metadata object stored with the credential; defaults to `{}` |
| `archived_at`  | string | Archive time (ISO 8601)                                             |
| `created_at`   | string | Creation time (ISO 8601)                                            |
| `updated_at`   | string | Last update time (ISO 8601)                                         |

## Errors

| HTTP | Type              | Trigger                                 |
| ---- | ----------------- | --------------------------------------- |
| 401  | `TOKEN_INVALID`   | Missing or invalid authentication token |
| 404  | `not_found_error` | Vault or credential does not exist      |
| 409  | `conflict_error`  | Credential is already archived          |

See [Errors](/cloud-agents/api/conventions/errors) for the full error envelope.

## Related

<CardGroup cols={2}>
  <Card title="Authenticate with vaults" icon="key" href="/cloud-agents/vaults">
    Store and inject secrets safely into agent sessions.
  </Card>
</CardGroup>
