Coder Secrets API

The Secrets API from Coder — 2 operation(s) for secrets.

Business capability
Configuration & Secrets Management BC-4210.60

Operations 6

GET /api/v2/users/{user}/secrets List user secrets #
POST /api/v2/users/{user}/secrets Create a new user secret #
POST /api/v2/users/{user}/secrets/batch Import user secrets from a file #
GET /api/v2/users/{user}/secrets/{name} Get a user secret by name #
DELETE /api/v2/users/{user}/secrets/{name} Delete a user secret #
PATCH /api/v2/users/{user}/secrets/{name} Update a user secret #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/coder:coder-secrets-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

coder-secrets-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  description: Coderd is the service created by running coder server. It is a thin API that connects workspaces, provisioners and users. coderd stores its state in Postgres and is the only service that communicates with Postgres.
  title: Coder Secrets API
  termsOfService: https://coder.com/legal/terms-of-service
  contact:
    name: API Support
    url: https://coder.com
    email: support@coder.com
  license:
    name: AGPL-3.0
    url: https://github.com/coder/coder/blob/main/LICENSE
  version: '2.0'
servers:
- url: /
tags:
- name: Secrets
paths:
  /api/v2/users/{user}/secrets:
    get:
      tags:
      - Secrets
      summary: List user secrets
      operationId: list-user-secrets
      parameters:
      - description: User ID, username, or me
        name: user
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/codersdk.UserSecret'
      security:
      - CoderSessionToken: []
    post:
      tags:
      - Secrets
      summary: Create a new user secret
      operationId: create-a-new-user-secret
      parameters:
      - description: User ID, username, or me
        name: user
        in: path
        required: true
        schema:
          type: string
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.UserSecret'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.Response'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.Response'
      security:
      - CoderSessionToken: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/codersdk.CreateUserSecretRequest'
        description: Create secret request
        required: true
  /api/v2/users/{user}/secrets/batch:
    post:
      tags:
      - Secrets
      summary: Import user secrets from a file
      operationId: import-user-secrets-from-a-file
      parameters:
      - description: User ID, username, or me
        name: user
        in: path
        required: true
        schema:
          type: string
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/codersdk.UserSecret'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.Response'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.Response'
        '413':
          description: Request body exceeds 8 MiB
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.Response'
      security:
      - CoderSessionToken: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/codersdk.ImportUserSecretsRequest'
        description: Import secrets request
        required: true
  /api/v2/users/{user}/secrets/{name}:
    get:
      tags:
      - Secrets
      summary: Get a user secret by name
      operationId: get-a-user-secret-by-name
      parameters:
      - description: User ID, username, or me
        name: user
        in: path
        required: true
        schema:
          type: string
      - description: Secret name
        name: name
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.UserSecret'
      security:
      - CoderSessionToken: []
    delete:
      tags:
      - Secrets
      summary: Delete a user secret
      operationId: delete-a-user-secret
      parameters:
      - description: User ID, username, or me
        name: user
        in: path
        required: true
        schema:
          type: string
      - description: Secret name
        name: name
        in: path
        required: true
        schema:
          type: string
      responses:
        '204':
          description: No Content
      security:
      - CoderSessionToken: []
    patch:
      tags:
      - Secrets
      summary: Update a user secret
      operationId: update-a-user-secret
      parameters:
      - description: User ID, username, or me
        name: user
        in: path
        required: true
        schema:
          type: string
      - description: Secret name
        name: name
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.UserSecret'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.Response'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.Response'
      security:
      - CoderSessionToken: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/codersdk.UpdateUserSecretRequest'
        description: Update secret request
        required: true
components:
  schemas:
    codersdk.SecretsFileFormat:
      type: string
      enum:
      - env
      - json
      - yaml
      x-enum-varnames:
      - SecretsFileFormatEnv
      - SecretsFileFormatJSON
      - SecretsFileFormatYAML
    codersdk.CreateUserSecretRequest:
      type: object
      properties:
        description:
          type: string
        enabled:
          type: boolean
        env_name:
          type: string
        file_path:
          type: string
        name:
          type: string
        value:
          type: string
    codersdk.UserSecret:
      type: object
      properties:
        created_at:
          type: string
          format: date-time
        description:
          type: string
        enabled:
          description: '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.'
          type: boolean
        env_name:
          type: string
        file_path:
          type: string
        id:
          type: string
          format: uuid
        name:
          type: string
        updated_at:
          type: string
          format: date-time
    codersdk.UpdateUserSecretRequest:
      type: object
      properties:
        description:
          type: string
        enabled:
          type: boolean
        env_name:
          type: string
        file_path:
          type: string
        value:
          type: string
    codersdk.ImportUserSecretsRequest:
      type: object
      required:
      - content
      - format
      properties:
        content:
          type: string
        format:
          $ref: '#/components/schemas/codersdk.SecretsFileFormat'
    codersdk.Response:
      type: object
      properties:
        detail:
          description: 'Detail is a debug message that provides further insight into why the

            action failed. This information can be technical and a regular golang

            err.Error() text.

            - "database: too many open connections"

            - "stat: too many open files"'
          type: string
        message:
          description: 'Message is an actionable message that depicts actions the request took.

            These messages should be fully formed sentences with proper punctuation.

            Examples:

            - "A user has been created."

            - "Failed to create a user."'
          type: string
        validations:
          description: 'Validations are form field-specific friendly error messages. They will be

            shown on a form field in the UI. These can also be used to add additional

            context if there is a set of errors in the primary ''Message''.'
          type: array
          items:
            $ref: '#/components/schemas/codersdk.ValidationError'
    codersdk.ValidationError:
      type: object
      required:
      - detail
      - field
      properties:
        detail:
          type: string
        field:
          type: string
  securitySchemes:
    AIGatewayKey:
      type: apiKey
      name: X-AI-Governance-Gateway-Key
      in: header
    Authorization:
      type: apiKey
      name: Authorization
      in: header
    CoderSessionToken:
      type: apiKey
      name: Coder-Session-Token
      in: header
x-provenance:
  method: harvested
  publisher: Coder
  source: https://raw.githubusercontent.com/coder/coder/main/coderd/apidoc/swagger.json
  note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
    stamped by stamp-openapi-provenance.py (roadmap#793)