Coder Template Builder API

The TemplateBuilder API from Coder — 5 operation(s) for templatebuilder.

Operations 5

GET /api/v2/templatebuilder/bases List template builder base templates #
POST /api/v2/templatebuilder/compose Compose template from base and modules #
POST /api/v2/templatebuilder/compose/template Compose and create a template #
GET /api/v2/templatebuilder/modules List template builder modules #
POST /api/v2/templatebuilder/sessions Report a template builder session event #

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-templatebuilder-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-templatebuilder-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 Template Builder 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: TemplateBuilder
paths:
  /api/v2/templatebuilder/bases:
    get:
      tags:
      - TemplateBuilder
      summary: List template builder base templates
      operationId: list-template-builder-base-templates
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.TemplateBuilderBasesResponse'
      security:
      - CoderSessionToken: []
  /api/v2/templatebuilder/compose:
    post:
      tags:
      - TemplateBuilder
      summary: Compose template from base and modules
      operationId: compose-template-from-base-and-modules
      responses:
        '200':
          description: OK
      security:
      - CoderSessionToken: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/codersdk.TemplateBuilderComposeRequest'
        description: Compose request
        required: true
  /api/v2/templatebuilder/compose/template:
    post:
      tags:
      - TemplateBuilder
      summary: Compose and create a template
      operationId: compose-and-create-a-template
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.TemplateBuilderCreateTemplateResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.Response'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.Response'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.Response'
        '504':
          description: Gateway Timeout
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.Response'
      security:
      - CoderSessionToken: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/codersdk.TemplateBuilderCreateTemplateRequest'
        description: Create template request
        required: true
  /api/v2/templatebuilder/modules:
    get:
      tags:
      - TemplateBuilder
      summary: List template builder modules
      operationId: list-template-builder-modules
      parameters:
      - description: Base template example ID for OS-compatibility filtering
        name: base
        in: query
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/codersdk.TemplateBuilderModulesResponse'
      security:
      - CoderSessionToken: []
  /api/v2/templatebuilder/sessions:
    post:
      tags:
      - TemplateBuilder
      summary: Report a template builder session event
      operationId: report-a-template-builder-session-event
      responses:
        '204':
          description: No Content
      security:
      - CoderSessionToken: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/codersdk.TemplateBuilderSessionRequest'
        description: Session event
        required: true
components:
  schemas:
    codersdk.TemplateBuilderSessionEventType:
      type: string
      enum:
      - wizard_entry
      - compose_completion
      x-enum-varnames:
      - TemplateBuilderSessionEventWizardEntry
      - TemplateBuilderSessionEventComposeCompletion
    codersdk.TemplateBuilderBaseAgent:
      type: object
      properties:
        default:
          description: 'Default reports whether modules attach to this agent when they do not

            name one.'
          type: boolean
        display_name:
          type: string
        name:
          type: string
    codersdk.TemplateBuilderVariableType:
      type: string
      enum:
      - string
      - number
      - bool
      x-enum-varnames:
      - TemplateBuilderVariableTypeString
      - TemplateBuilderVariableTypeNumber
      - TemplateBuilderVariableTypeBool
    codersdk.TemplateBuilderModule:
      type: object
      properties:
        category:
          type: string
        compatible_os:
          type: array
          items:
            type: string
        conflicts_with:
          type: array
          items:
            type: string
        description:
          type: string
        display_name:
          type: string
        icon:
          type: string
        id:
          type: string
        variables:
          type: array
          items:
            $ref: '#/components/schemas/codersdk.TemplateBuilderModuleVariable'
        version:
          type: string
    codersdk.TemplateBuilderCreateTemplateRequest:
      type: object
      required:
      - name
      - organization_id
      properties:
        base_template_id:
          type: string
        base_variable_values:
          type: object
          additionalProperties:
            type: string
        description:
          type: string
          maxLength: 128
        display_name:
          type: string
        icon:
          type: string
        modules:
          type: array
          items:
            $ref: '#/components/schemas/codersdk.TemplateBuilderComposeModule'
        name:
          type: string
        organization_id:
          type: string
          format: uuid
        provisioner_tags:
          type: object
          additionalProperties:
            type: string
        session_id:
          description: 'SessionID is the wizard session this request belongs to, as reported to

            POST /api/v2/templatebuilder/sessions. It is optional and used only to

            attribute a build failure to the session that produced it.'
          type: string
          format: uuid
    codersdk.TemplateBuilderComposeModule:
      type: object
      properties:
        agent_name:
          description: AgentName targets a base coder_agent by name. Empty uses the base default.
          type: string
        id:
          type: string
        variables:
          type: object
          additionalProperties:
            type: string
    codersdk.TemplateBuilderBasesResponse:
      type: object
      properties:
        bases:
          type: array
          items:
            $ref: '#/components/schemas/codersdk.TemplateBuilderBase'
    codersdk.TemplateBuilderCreateTemplateResponse:
      type: object
      properties:
        template:
          $ref: '#/components/schemas/codersdk.Template'
    codersdk.CORSBehavior:
      type: string
      enum:
      - simple
      - passthru
      x-enum-varnames:
      - CORSBehaviorSimple
      - CORSBehaviorPassthru
    codersdk.TemplateAutostopRequirement:
      type: object
      properties:
        days_of_week:
          description: 'DaysOfWeek is a list of days of the week on which restarts are required.

            Restarts happen within the user''s quiet hours (in their configured

            timezone). If no days are specified, restarts are not required. Weekdays

            cannot be specified twice.


            Restarts will only happen on weekdays in this list on weeks which line up

            with Weeks.'
          type: array
          items:
            type: string
            enum:
            - monday
            - tuesday
            - wednesday
            - thursday
            - friday
            - saturday
            - sunday
        weeks:
          description: 'Weeks is the number of weeks between required restarts. Weeks are synced

            across all workspaces (and Coder deployments) using modulo math on a

            hardcoded epoch week of January 2nd, 2023 (the first Monday of 2023).

            Values of 0 or 1 indicate weekly restarts. Values of 2 indicate

            fortnightly restarts, etc.'
          type: integer
    codersdk.TransitionStats:
      type: object
      properties:
        p50:
          type: integer
          example: 123
        p95:
          type: integer
          example: 146
    codersdk.ValidationError:
      type: object
      required:
      - detail
      - field
      properties:
        detail:
          type: string
        field:
          type: string
    codersdk.WorkspaceAgentPortShareLevel:
      type: string
      enum:
      - owner
      - authenticated
      - organization
      - public
      x-enum-varnames:
      - WorkspaceAgentPortShareLevelOwner
      - WorkspaceAgentPortShareLevelAuthenticated
      - WorkspaceAgentPortShareLevelOrganization
      - WorkspaceAgentPortShareLevelPublic
    codersdk.TemplateAutostartRequirement:
      type: object
      properties:
        days_of_week:
          description: 'DaysOfWeek is a list of days of the week in which autostart is allowed

            to happen. If no days are specified, autostart is not allowed.'
          type: array
          items:
            type: string
            enum:
            - monday
            - tuesday
            - wednesday
            - thursday
            - friday
            - saturday
            - sunday
    codersdk.TemplateBuilderModuleVariable:
      type: object
      properties:
        default:
          type: array
          items:
            type: integer
        description:
          type: string
        name:
          type: string
        required:
          type: boolean
        sensitive:
          type: boolean
        type:
          $ref: '#/components/schemas/codersdk.TemplateBuilderVariableType'
    codersdk.TemplateBuilderModulesResponse:
      type: object
      properties:
        modules:
          type: array
          items:
            $ref: '#/components/schemas/codersdk.TemplateBuilderModule'
    codersdk.TemplateBuilderComposeRequest:
      type: object
      properties:
        base_template_id:
          type: string
        base_variable_values:
          type: object
          additionalProperties:
            type: string
        modules:
          type: array
          items:
            $ref: '#/components/schemas/codersdk.TemplateBuilderComposeModule'
    codersdk.TemplateBuilderBase:
      type: object
      properties:
        agents:
          type: array
          items:
            $ref: '#/components/schemas/codersdk.TemplateBuilderBaseAgent'
        description:
          type: string
        icon:
          type: string
        id:
          type: string
        name:
          type: string
        os:
          type: string
        prerequisites:
          type: string
        variables:
          type: array
          items:
            $ref: '#/components/schemas/codersdk.TemplateBuilderModuleVariable'
    codersdk.TemplateBuilderSessionRequest:
      type: object
      required:
      - event_type
      - session_id
      properties:
        base_template_id:
          type: string
        duration_seconds:
          type: number
        event_type:
          enum:
          - wizard_entry
          - compose_completion
          allOf:
          - $ref: '#/components/schemas/codersdk.TemplateBuilderSessionEventType'
        module_ids:
          type: array
          items:
            type: string
        session_id:
          type: string
          format: uuid
        success:
          type: boolean
    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.Template:
      type: object
      properties:
        active_user_count:
          description: ActiveUserCount is set to -1 when loading.
          type: integer
        active_version_id:
          type: string
          format: uuid
        activity_bump_ms:
          type: integer
        agents_allowed:
          type: boolean
        allow_user_autostart:
          description: 'AllowUserAutostart and AllowUserAutostop are Premium features. Their

            values are only used if your license is entitled to use the advanced

            template scheduling feature.'
          type: boolean
        allow_user_autostop:
          type: boolean
        allow_user_cancel_workspace_jobs:
          type: boolean
        allow_workspace_renames:
          description: 'AllowWorkspaceRenames permits users to rename workspaces built from this

            template. Renaming can be destructive for templates whose Terraform

            references the workspace name.'
          type: boolean
        autostart_requirement:
          $ref: '#/components/schemas/codersdk.TemplateAutostartRequirement'
        autostop_requirement:
          description: 'AutostopRequirement and AutostartRequirement are Premium features. Their

            values are only used if your license is entitled to use the advanced template

            scheduling feature.'
          allOf:
          - $ref: '#/components/schemas/codersdk.TemplateAutostopRequirement'
        build_time_stats:
          $ref: '#/components/schemas/codersdk.TemplateBuildTimeStats'
        cors_behavior:
          $ref: '#/components/schemas/codersdk.CORSBehavior'
        created_at:
          type: string
          format: date-time
        created_by_id:
          type: string
          format: uuid
        created_by_name:
          type: string
        default_ttl_ms:
          type: integer
        deleted:
          type: boolean
        deprecated:
          type: boolean
        deprecation_message:
          type: string
        description:
          type: string
        disable_module_cache:
          description: 'DisableModuleCache disables the use of cached Terraform modules during

            provisioning for this template. It is read-only while

            ModuleCacheDisabledByDeployment is true.'
          type: boolean
        display_name:
          type: string
        failure_ttl_ms:
          description: 'FailureTTLMillis, TimeTilDormantMillis, and TimeTilDormantAutoDeleteMillis are Premium features. Their

            values are used if your license is entitled to use the advanced

            template scheduling feature.'
          type: integer
        icon:
          type: string
        id:
          type: string
          format: uuid
        max_port_share_level:
          $ref: '#/components/schemas/codersdk.WorkspaceAgentPortShareLevel'
        module_cache_disabled_by_deployment:
          description: 'ModuleCacheDisabledByDeployment reports that the deployment disables the

            Terraform module cache for every template. Templates cannot opt back in,

            so the effective state is disabled regardless of DisableModuleCache.'
          type: boolean
        name:
          type: string
        organization_display_name:
          type: string
        organization_icon:
          type: string
        organization_id:
          type: string
          format: uuid
        organization_name:
          type: string
          format: url
        provisioner:
          type: string
          enum:
          - terraform
        require_active_version:
          description: 'RequireActiveVersion mandates that workspaces are built with the active

            template version.'
          type: boolean
        time_til_autostop_notify_ms:
          description: 'TimeTilAutostopNotifyMillis is the duration before the workspace''s

            autostop deadline at which a reminder notification is sent. 0 disables

            the notification.'
          type: integer
        time_til_dormant_autodelete_ms:
          type: integer
        time_til_dormant_ms:
          type: integer
        updated_at:
          type: string
          format: date-time
        use_classic_parameter_flow:
          type: boolean
    codersdk.TemplateBuildTimeStats:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/codersdk.TransitionStats'
  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)