---
title: "Get workspace build secrets"
method: GET
path: "/api/v2/workspacebuilds/{workspacebuild}/secrets"
tags: ["Builds"]
---

# Get workspace build secrets

`GET /api/v2/workspacebuilds/{workspacebuild}/secrets`

## Request

- Base URL: `/` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/v2/workspacebuilds/{workspacebuild}/secrets`
- Auth: API key in header `Coder-Session-Token`

Lists the metadata of the secrets linked to a workspace build,
including secrets whose values a later build cleared. Values
are never returned. env_replaces and file_replaces name the
workspace owner's user secrets that each live secret displaces,
and are omitted when the caller cannot read those user secrets.

## Path parameters

- `workspacebuild` string, uuid, required

## Response `200`

OK

- CodersdkWorkspaceSecret[]
  - `cleared_at` string, date-time: ClearedAt is set once a later build superseded the secret and its value was dropped. Cleared secrets are not delivered and replace nothing.
  - `created_at` string, date-time
  - `description` string
  - `enabled` boolean: Enabled controls whether the secret is injected into workspaces. Disabled secrets remain visible and editable, but are not added to the agent manifest, so they are not exposed as environment variables or written to secret files.
  - `env_name` string
  - `env_replaces` string, uuid: EnvReplaces is the ID of the workspace owner's user secret that this secret displaces on env_name.
  - `ephemeral` boolean: Ephemeral secrets are delivered to their build only and not copied to the next one.
  - `file_path` string
  - `file_replaces` string, uuid: FileReplaces is the ID of the workspace owner's user secret that this secret displaces on file_path.
  - `id` string, uuid
  - `name` string
  - `updated_at` string, date-time
  - `workspace_build_id` string, uuid

## Changes

- **2026-10-15** `9d2a3a18c70d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/coder/apis/coder-api/changes/api/v2/workspacebuilds/:workspacebuild/secrets/get.md)

---

[API](https://skmtc.dev/coder/apis/coder-api.md) - [All operations](https://skmtc.dev/coder/apis/coder-api/llms.txt) - [OpenAPI document](https://skmtc.dev/coder/apis/coder-api/revisions/4669d93796ab?raw)
