Coder Secrets API

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

OpenAPI Specification

coder-secrets-api-openapi.yml Raw ↑
openapi: 3.0.3
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 Agents 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: https://{coderHost}/api/v2
  description: Coder instance
  variables:
    coderHost:
      default: coder.example.com
      description: Your Coder deployment hostname
security:
- CoderSessionToken: []
tags:
- name: Secrets
paths:
  /api/v2/users/{user}/secrets:
    get:
      operationId: list-user-secrets
      summary: List user secrets
      tags:
      - Secrets
      security:
      - CoderSessionToken: []
      parameters:
      - name: user
        in: path
        required: true
        description: User ID, username, or me
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/codersdk.UserSecret'
    post:
      operationId: create-a-new-user-secret
      summary: Create a new user secret
      tags:
      - Secrets
      security:
      - CoderSessionToken: []
      parameters:
      - name: user
        in: path
        required: true
        description: User ID, username, or me
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/codersdk.CreateUserSecretRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.UserSecret'
  /api/v2/users/{user}/secrets/{name}:
    get:
      operationId: get-a-user-secret-by-name
      summary: Get a user secret by name
      tags:
      - Secrets
      security:
      - CoderSessionToken: []
      parameters:
      - name: user
        in: path
        required: true
        description: User ID, username, or me
        schema:
          type: string
      - name: name
        in: path
        required: true
        description: Secret name
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.UserSecret'
    delete:
      operationId: delete-a-user-secret
      summary: Delete a user secret
      tags:
      - Secrets
      security:
      - CoderSessionToken: []
      parameters:
      - name: user
        in: path
        required: true
        description: User ID, username, or me
        schema:
          type: string
      - name: name
        in: path
        required: true
        description: Secret name
        schema:
          type: string
      responses:
        '204':
          description: No Content
    patch:
      operationId: update-a-user-secret
      summary: Update a user secret
      tags:
      - Secrets
      security:
      - CoderSessionToken: []
      parameters:
      - name: user
        in: path
        required: true
        description: User ID, username, or me
        schema:
          type: string
      - name: name
        in: path
        required: true
        description: Secret name
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/codersdk.UpdateUserSecretRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.UserSecret'
components:
  schemas:
    codersdk.UpdateUserSecretRequest:
      type: object
      properties:
        description:
          type: string
        env_name:
          type: string
        file_path:
          type: string
        value:
          type: string
    codersdk.UserSecret:
      type: object
      properties:
        created_at:
          type: string
          format: date-time
        description:
          type: string
        env_name:
          type: string
        file_path:
          type: string
        id:
          type: string
          format: uuid
        name:
          type: string
        updated_at:
          type: string
          format: date-time
    codersdk.CreateUserSecretRequest:
      type: object
      properties:
        description:
          type: string
        env_name:
          type: string
        file_path:
          type: string
        name:
          type: string
        value:
          type: string
  securitySchemes:
    CoderSessionToken:
      type: apiKey
      in: header
      name: Coder-Session-Token
externalDocs: {}