Coder Workspaces API
The Workspaces API from Coder — 20 operation(s) for workspaces.
The Workspaces API from Coder — 20 operation(s) for workspaces.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
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.curl "https://apis.io/api/v1/apis/coder-workspaces-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
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: 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 Agents Workspaces 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: Workspaces
paths:
/api/experimental/watch-all-workspacebuilds:
get:
operationId: watch-all-workspace-builds
summary: Watch all workspace builds
tags:
- Workspaces
security:
- CoderSessionToken: []
responses:
'101':
description: Switching Protocols
/api/v2/organizations/{organization}/members/{user}/workspaces:
post:
operationId: create-user-workspace-by-organization
summary: Create user workspace by organization
tags:
- Workspaces
security:
- CoderSessionToken: []
description: 'Create a new workspace using a template. The request must
specify either the Template ID or the Template Version ID,
not both. If the Template ID is specified, the active version
of the template will be used.'
parameters:
- name: organization
in: path
required: true
description: Organization ID
schema:
type: string
- name: user
in: path
required: true
description: Username, UUID, or me
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.CreateWorkspaceRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.Workspace'
/api/v2/organizations/{organization}/members/{user}/workspaces/available-users:
get:
operationId: get-users-available-for-workspace-creation
summary: Get users available for workspace creation
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: organization
in: path
required: true
description: Organization ID
schema:
type: string
- name: user
in: path
required: true
description: User ID, name, or me
schema:
type: string
- name: q
in: query
required: false
description: Search query
schema:
type: string
- name: limit
in: query
required: false
description: Limit results
schema:
type: integer
- name: offset
in: query
required: false
description: Offset for pagination
schema:
type: integer
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/codersdk.MinimalUser'
/api/v2/users/{user}/workspace/{workspacename}:
get:
operationId: get-workspace-metadata-by-user-and-workspace-name
summary: Get workspace metadata by user and workspace name
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: user
in: path
required: true
description: User ID, name, or me
schema:
type: string
- name: workspacename
in: path
required: true
description: Workspace name
schema:
type: string
- name: include_deleted
in: query
required: false
description: Return data instead of HTTP 404 if the workspace is deleted
schema:
type: boolean
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.Workspace'
/api/v2/users/{user}/workspaces:
post:
operationId: create-user-workspace
summary: Create user workspace
tags:
- Workspaces
security:
- CoderSessionToken: []
description: 'Create a new workspace using a template. The request must
specify either the Template ID or the Template Version ID,
not both. If the Template ID is specified, the active version
of the template will be used.'
parameters:
- name: user
in: path
required: true
description: Username, UUID, or me
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.CreateWorkspaceRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.Workspace'
/api/v2/workspaces:
get:
operationId: list-workspaces
summary: List workspaces
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: q
in: query
required: false
description: 'Search query in the format `key:value`. Available keys are: owner, template, name, status, has-agent, dormant, last_used_after, last_used_before, has-ai-task, has_external_agent, healthy.'
schema:
type: string
- name: limit
in: query
required: false
description: Page limit
schema:
type: integer
- name: offset
in: query
required: false
description: Page offset
schema:
type: integer
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.WorkspacesResponse'
/api/v2/workspaces/{workspace}:
get:
operationId: get-workspace-metadata-by-id
summary: Get workspace metadata by ID
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
- name: include_deleted
in: query
required: false
description: Return data instead of HTTP 404 if the workspace is deleted
schema:
type: boolean
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.Workspace'
patch:
operationId: update-workspace-metadata-by-id
summary: Update workspace metadata by ID
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.UpdateWorkspaceRequest'
responses:
'204':
description: No Content
/api/v2/workspaces/{workspace}/acl:
get:
operationId: get-workspace-acls
summary: Get workspace ACLs
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.WorkspaceACL'
delete:
operationId: completely-clears-the-workspaces-user-and-group-acls
summary: Completely clears the workspace's user and group ACLs.
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
responses:
'204':
description: No Content
patch:
operationId: update-workspace-acl
summary: Update workspace ACL
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.UpdateWorkspaceACL'
responses:
'204':
description: No Content
/api/v2/workspaces/{workspace}/agent-connection-watch:
get:
operationId: workspace-agent-connection-watch
summary: Workspace Agent Connection Watch
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
responses:
'101':
description: Switching Protocols
content:
application/json:
schema:
$ref: '#/components/schemas/workspacesdk.ConnectionWatchEvent'
/api/v2/workspaces/{workspace}/autostart:
put:
operationId: update-workspace-autostart-schedule-by-id
summary: Update workspace autostart schedule by ID
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.UpdateWorkspaceAutostartRequest'
responses:
'204':
description: No Content
/api/v2/workspaces/{workspace}/autoupdates:
put:
operationId: update-workspace-automatic-updates-by-id
summary: Update workspace automatic updates by ID
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.UpdateWorkspaceAutomaticUpdatesRequest'
responses:
'204':
description: No Content
/api/v2/workspaces/{workspace}/dormant:
put:
operationId: update-workspace-dormancy-status-by-id
summary: Update workspace dormancy status by id.
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.UpdateWorkspaceDormancy'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.Workspace'
/api/v2/workspaces/{workspace}/extend:
put:
operationId: extend-workspace-deadline-by-id
summary: Extend workspace deadline by ID
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.PutExtendWorkspaceRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.Response'
/api/v2/workspaces/{workspace}/favorite:
put:
operationId: favorite-workspace-by-id
summary: Favorite workspace by ID.
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
responses:
'204':
description: No Content
delete:
operationId: unfavorite-workspace-by-id
summary: Unfavorite workspace by ID.
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
responses:
'204':
description: No Content
/api/v2/workspaces/{workspace}/resolve-autostart:
get:
operationId: resolve-workspace-autostart-by-id
summary: Resolve workspace autostart by id.
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.ResolveAutostartResponse'
/api/v2/workspaces/{workspace}/timings:
get:
operationId: get-workspace-timings-by-id
summary: Get workspace timings by ID
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.WorkspaceBuildTimings'
/api/v2/workspaces/{workspace}/ttl:
put:
operationId: update-workspace-ttl-by-id
summary: Update workspace TTL by ID
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.UpdateWorkspaceTTLRequest'
responses:
'204':
description: No Content
/api/v2/workspaces/{workspace}/usage:
post:
operationId: post-workspace-usage-by-id
summary: Post Workspace Usage by ID
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.PostWorkspaceUsageRequest'
responses:
'204':
description: No Content
/api/v2/workspaces/{workspace}/watch:
get:
operationId: watch-workspace-by-id
summary: Watch workspace by ID
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
responses:
'200':
description: OK
content:
text/event-stream:
schema:
$ref: '#/components/schemas/codersdk.Response'
/api/v2/workspaces/{workspace}/watch-ws:
get:
operationId: watch-workspace-by-id-via-websockets
summary: Watch workspace by ID via WebSockets
tags:
- Workspaces
security:
- CoderSessionToken: []
parameters:
- name: workspace
in: path
required: true
description: Workspace ID
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.ServerSentEvent'
components:
schemas:
workspacesdk.BuildUpdate:
type: object
properties:
job_status:
$ref: '#/components/schemas/codersdk.ProvisionerJobStatus'
transition:
$ref: '#/components/schemas/codersdk.WorkspaceTransition'
codersdk.ServerSentEventType:
type: string
enum:
- ping
- data
- error
codersdk.WorkspaceUser:
type: object
properties:
avatar_url:
type: string
format: uri
id:
type: string
format: uuid
name:
type: string
role:
enum:
- admin
- use
allOf:
- $ref: '#/components/schemas/codersdk.WorkspaceRole'
username:
type: string
required:
- id
- username
codersdk.AgentConnectionTiming:
type: object
properties:
ended_at:
type: string
format: date-time
stage:
$ref: '#/components/schemas/codersdk.TimingStage'
started_at:
type: string
format: date-time
workspace_agent_id:
type: string
workspace_agent_name:
type: string
codersdk.ProvisionerJob:
type: object
properties:
available_workers:
type: array
items:
type: string
format: uuid
canceled_at:
type: string
format: date-time
completed_at:
type: string
format: date-time
created_at:
type: string
format: date-time
error:
type: string
error_code:
enum:
- REQUIRED_TEMPLATE_VARIABLES
- INSUFFICIENT_QUOTA
allOf:
- $ref: '#/components/schemas/codersdk.JobErrorCode'
file_id:
type: string
format: uuid
id:
type: string
format: uuid
initiator_id:
type: string
format: uuid
input:
$ref: '#/components/schemas/codersdk.ProvisionerJobInput'
logs_overflowed:
type: boolean
metadata:
$ref: '#/components/schemas/codersdk.ProvisionerJobMetadata'
organization_id:
type: string
format: uuid
queue_position:
type: integer
queue_size:
type: integer
started_at:
type: string
format: date-time
status:
enum:
- pending
- running
- succeeded
- canceling
- canceled
- failed
allOf:
- $ref: '#/components/schemas/codersdk.ProvisionerJobStatus'
tags:
type: object
additionalProperties:
type: string
type:
$ref: '#/components/schemas/codersdk.ProvisionerJobType'
worker_id:
type: string
format: uuid
worker_name:
type: string
codersdk.AgentSubsystem:
type: string
enum:
- envbox
- envbuilder
- exectrace
codersdk.WorkspaceAppStatus:
type: object
properties:
agent_id:
type: string
format: uuid
app_id:
type: string
format: uuid
created_at:
type: string
format: date-time
icon:
type: string
description: 'Deprecated: This field is unused and will be removed in a future version.
Icon is an external URL to an icon that will be rendered in the UI.'
id:
type: string
format: uuid
message:
type: string
needs_user_attention:
type: boolean
description: 'Deprecated: This field is unused and will be removed in a future version.
NeedsUserAttention specifies whether the status needs user attention.'
state:
$ref: '#/components/schemas/codersdk.WorkspaceAppStatusState'
uri:
type: string
description: 'URI is the URI of the resource that the status is for.
e.g. https://github.com/org/repo/pull/123
e.g. file:///path/to/file'
workspace_id:
type: string
format: uuid
codersdk.ProvisionerJobMetadata:
type: object
properties:
template_display_name:
type: string
template_icon:
type: string
template_id:
type: string
format: uuid
template_name:
type: string
template_version_name:
type: string
workspace_build_transition:
$ref: '#/components/schemas/codersdk.WorkspaceTransition'
workspace_id:
type: string
format: uuid
workspace_name:
type: string
codersdk.UpdateWorkspaceDormancy:
type: object
properties:
dormant:
type: boolean
workspacesdk.AgentUpdate:
type: object
properties:
id:
type: string
format: uuid
lifecycle:
$ref: '#/components/schemas/codersdk.WorkspaceAgentLifecycle'
codersdk.ServerSentEvent:
type: object
properties:
data: {}
type:
$ref: '#/components/schemas/codersdk.ServerSentEventType'
codersdk.WorkspaceAgentHealth:
type: object
properties:
healthy:
type: boolean
description: Healthy is true if the agent is healthy.
example: false
reason:
type: string
description: Reason is a human-readable explanation of the agent's health. It is empty if Healthy is true.
example: agent has lost connection
codersdk.WorkspaceTransition:
type: string
enum:
- start
- stop
- delete
codersdk.WorkspaceAgentScriptStatus:
type: string
enum:
- ok
- exit_failure
- timed_out
- pipes_left_open
codersdk.WorkspaceResource:
type: object
properties:
agents:
type: array
items:
$ref: '#/components/schemas/codersdk.WorkspaceAgent'
created_at:
type: string
format: date-time
daily_cost:
type: integer
hide:
type: boolean
icon:
type: string
id:
type: string
format: uuid
job_id:
type: string
format: uuid
metadata:
type: array
items:
$ref: '#/components/schemas/codersdk.WorkspaceResourceMetadata'
name:
type: string
type:
type: string
workspace_transition:
enum:
- start
- stop
- delete
allOf:
- $ref: '#/components/schemas/codersdk.WorkspaceTransition'
codersdk.WorkspaceAgentStartupScriptBehavior:
type: string
enum:
- blocking
- non-blocking
codersdk.TimingStage:
type: string
enum:
- init
- plan
- graph
- apply
- start
- stop
- cron
- connect
codersdk.Healthcheck:
type: object
properties:
interval:
type: integer
description: Interval specifies the seconds between each health check.
threshold:
type: integer
description: Threshold specifies the number of consecutive failed health checks before returning "unhealthy".
url:
type: string
description: URL specifies the endpoint to check for the app health.
codersdk.WorkspaceAgentStatus:
type: string
enum:
- connecting
- connected
- disconnected
- timeout
codersdk.UpdateWorkspaceACL:
type: object
properties:
group_roles:
type: object
description: 'GroupRoles is a mapping from valid group UUIDs to the workspace role they
should be granted. To remove a group from the workspace, use "" as the role
(available as a constant named codersdk.WorkspaceRoleDeleted)'
additionalProperties:
$ref: '#/components/schemas/codersdk.WorkspaceRole'
user_roles:
type: object
description: 'UserRoles is a mapping from valid user UUIDs to the workspace role they
should be granted. To remove a user from the workspace, use "" as the role
(available as a constant named codersdk.WorkspaceRoleDeleted)'
additionalProperties:
$ref: '#/components/schemas/codersdk.WorkspaceRole'
codersdk.UpdateWorkspaceTTLRequest:
type: object
properties:
ttl_ms:
type: integer
codersdk.MinimalUser:
type: object
properties:
avatar_url:
type: string
format: uri
id:
type: string
format: uuid
name:
type: string
username:
type: string
required:
- id
- username
codersdk.JobErrorCode:
type: string
enum:
- REQUIRED_TEMPLATE_VARIABLES
- INSUFFICIENT_QUOTA
workspacesdk.WatchError:
type: object
properties:
code:
$ref: '#/components/schemas/workspacesdk.WatchErrorCode'
details:
type: string
message:
type: string
retryable:
type: boolean
codersdk.UpdateWorkspaceAutomaticUpdatesRequest:
type: object
properties:
automatic_updates:
$ref: '#/components/schemas/codersdk.AutomaticUpdates'
codersdk.GroupSource:
type: string
enum:
- user
- oidc
codersdk.Response:
type: object
properties:
detail:
type: string
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"'
message:
type: string
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."'
validations:
type: array
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''.'
items:
$ref: '#/components/schemas/codersdk.ValidationError'
codersdk.WorkspaceBuildParameter:
type: object
properties:
name:
type: string
value:
type: string
codersdk.WorkspaceGroup:
type: object
properties:
avatar_url:
type: string
format: uri
display_name:
type: string
id:
type: string
format: uuid
members:
type: array
items:
$ref: '#/components/schemas/codersdk.ReducedUser'
name:
type: string
organization_display_name:
type: string
organization_id:
type: string
format: uuid
organization_name:
type: string
quota_allowance:
type: integer
role:
enum:
- admin
- use
allOf:
- $ref: '#/components/schemas/codersdk.WorkspaceRole'
source:
$ref: '#/components/schemas/codersdk.GroupSource'
total_member_count:
type: integer
description: 'How many members are in this group. Shows the total count,
even if the user is not authorized to read group member details.
May be greater than `len(Group.Members)`.'
workspacesdk.WatchErrorCode:
type: integer
enum:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
x-enum-comments:
_: Ensure that zero value is not a valid code
codersdk.WorkspaceHealth:
type: object
properties:
failing_agents:
type: array
description: FailingAgents lists the IDs of the agents that are failing, if any.
items:
type: string
format: uuid
healthy:
type: boolean
description: Healthy is true if the workspace is healthy.
example: false
codersdk.WorkspaceACL:
type: object
properties:
group:
type: array
items:
$ref: '#/components/schemas/codersdk.WorkspaceGroup'
users:
type: array
items:
$ref: '#/components/schemas/codersdk.WorkspaceUser'
codersdk.WorkspaceAppStatusState:
type: string
enum:
- working
- idle
- complete
- failure
codersdk.CreateWorkspaceRequest:
type: object
description: 'CreateWorkspaceRequest provides options for creating a new workspace. Only one of TemplateID or TemplateVersionID can be specified, not both. If TemplateID is specified, the active version of the template will be used. Workspace names: - Must start with a letter or number - Can only contain letters, numbers, and hyphens - Cannot contain spaces or special characters - Cannot be named `new` or `create` - Must be unique within your workspaces - Maximum length of 32 characters'
properties:
automatic_updates:
$ref: '#/components/schemas/codersdk.AutomaticUpdates'
autostart_schedule:
type: string
name:
type: string
rich_parameter_values:
type: array
description: 'RichParameterValues allows for additional parameters to be provided
during the initial provision.'
items:
$ref: '#/components/schemas/codersdk.WorkspaceBuildParameter'
template_id:
type: string
format: uuid
description: TemplateID specifies which template should be used for creating the workspace.
template_version_id:
type: string
format: uuid
description: TemplateVersionID can be used to specify a specific version of a template for creating the workspace.
template_version_preset_id:
type: string
format: uuid
ttl_ms:
type: integer
required:
- name
codersdk.WorkspaceResourceMetadata:
type: object
properties:
key:
type: string
sensitive:
type: boolean
value:
type: string
codersdk.WorkspaceAgentLogSource:
type: object
properties:
created_at:
type: string
format: date-time
display_name:
type: string
icon:
type: string
id:
type: string
format: uuid
workspace_agent_id:
type: string
format: uuid
codersdk.AgentScriptTiming:
type: object
properties:
display_name:
type: string
ended_at:
type: string
format: date-time
exit_code:
type: integer
sta
# --- truncated at 32 KB (52 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/coder/refs/heads/main/openapi/coder-workspaces-api-openapi.yml