Coder Agents API
The Agents API from Coder — 28 operation(s) for agents.
The Agents API from Coder — 28 operation(s) for agents.
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-agents-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 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: Agents
paths:
/api/v2/debug/{user}/debug-link:
get:
operationId: debug-oidc-context-for-a-user
summary: Debug OIDC context for a user
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: user
in: path
required: true
description: User ID, name, or me
schema:
type: string
responses:
'200':
description: Success
/api/v2/derp-map:
get:
operationId: get-derp-map-updates
summary: Get DERP map updates
tags:
- Agents
security:
- CoderSessionToken: []
responses:
'101':
description: Switching Protocols
/api/v2/tailnet:
get:
operationId: user-scoped-tailnet-rpc-connection
summary: User-scoped tailnet RPC connection
tags:
- Agents
security:
- CoderSessionToken: []
responses:
'101':
description: Switching Protocols
/api/v2/workspaceagents/aws-instance-identity:
post:
operationId: authenticate-agent-on-aws-instance
summary: Authenticate agent on AWS instance
tags:
- Agents
security:
- CoderSessionToken: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/agentsdk.AWSInstanceIdentityToken'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/agentsdk.AuthenticateResponse'
/api/v2/workspaceagents/azure-instance-identity:
post:
operationId: authenticate-agent-on-azure-instance
summary: Authenticate agent on Azure instance
tags:
- Agents
security:
- CoderSessionToken: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/agentsdk.AzureInstanceIdentityToken'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/agentsdk.AuthenticateResponse'
/api/v2/workspaceagents/connection:
get:
operationId: get-connection-info-for-workspace-agent-generic
summary: Get connection info for workspace agent generic
tags:
- Agents
security:
- CoderSessionToken: []
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/workspacesdk.AgentConnectionInfo'
/api/v2/workspaceagents/google-instance-identity:
post:
operationId: authenticate-agent-on-google-cloud-instance
summary: Authenticate agent on Google Cloud instance
tags:
- Agents
security:
- CoderSessionToken: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/agentsdk.GoogleInstanceIdentityToken'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/agentsdk.AuthenticateResponse'
/api/v2/workspaceagents/me/app-status:
patch:
operationId: patch-workspace-agent-app-status
summary: Patch workspace agent app status
tags:
- Agents
security:
- CoderSessionToken: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/agentsdk.PatchAppStatus'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.Response'
/api/v2/workspaceagents/me/external-auth:
get:
operationId: get-workspace-agent-external-auth
summary: Get workspace agent external auth
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: match
in: query
required: true
description: Match
schema:
type: string
- name: id
in: query
required: true
description: Provider ID
schema:
type: string
- name: listen
in: query
required: false
description: Wait for a new token to be issued
schema:
type: boolean
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/agentsdk.ExternalAuthResponse'
/api/v2/workspaceagents/me/gitauth:
get:
operationId: removed-get-workspace-agent-git-auth
summary: 'Removed: Get workspace agent git auth'
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: match
in: query
required: true
description: Match
schema:
type: string
- name: id
in: query
required: true
description: Provider ID
schema:
type: string
- name: listen
in: query
required: false
description: Wait for a new token to be issued
schema:
type: boolean
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/agentsdk.ExternalAuthResponse'
/api/v2/workspaceagents/me/gitsshkey:
get:
operationId: get-workspace-agent-git-ssh-key
summary: Get workspace agent Git SSH key
tags:
- Agents
security:
- CoderSessionToken: []
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/agentsdk.GitSSHKey'
/api/v2/workspaceagents/me/log-source:
post:
operationId: post-workspace-agent-log-source
summary: Post workspace agent log source
tags:
- Agents
security:
- CoderSessionToken: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/agentsdk.PostLogSourceRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.WorkspaceAgentLogSource'
/api/v2/workspaceagents/me/logs:
patch:
operationId: patch-workspace-agent-logs
summary: Patch workspace agent logs
tags:
- Agents
security:
- CoderSessionToken: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/agentsdk.PatchLogs'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.Response'
/api/v2/workspaceagents/me/reinit:
get:
operationId: get-workspace-agent-reinitialization
summary: Get workspace agent reinitialization
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: wait
in: query
required: false
description: Opt in to durable reinit checks
schema:
type: boolean
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/agentsdk.ReinitializationEvent'
'409':
description: Conflict
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.Response'
/api/v2/workspaceagents/me/rpc:
get:
operationId: workspace-agent-rpc-api
summary: Workspace agent RPC API
tags:
- Agents
security:
- CoderSessionToken: []
responses:
'101':
description: Switching Protocols
/api/v2/workspaceagents/{workspaceagent}:
get:
operationId: get-workspace-agent-by-id
summary: Get workspace agent by ID
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: workspaceagent
in: path
required: true
description: Workspace agent ID
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.WorkspaceAgent'
/api/v2/workspaceagents/{workspaceagent}/connection:
get:
operationId: get-connection-info-for-workspace-agent
summary: Get connection info for workspace agent
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: workspaceagent
in: path
required: true
description: Workspace agent ID
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/workspacesdk.AgentConnectionInfo'
/api/v2/workspaceagents/{workspaceagent}/containers:
get:
operationId: get-running-containers-for-workspace-agent
summary: Get running containers for workspace agent
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: workspaceagent
in: path
required: true
description: Workspace agent ID
schema:
type: string
- name: label
in: query
required: true
description: Labels
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.WorkspaceAgentListContainersResponse'
/api/v2/workspaceagents/{workspaceagent}/containers/devcontainers/{devcontainer}:
delete:
operationId: delete-devcontainer-for-workspace-agent
summary: Delete devcontainer for workspace agent
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: workspaceagent
in: path
required: true
description: Workspace agent ID
schema:
type: string
- name: devcontainer
in: path
required: true
description: Devcontainer ID
schema:
type: string
responses:
'204':
description: No Content
/api/v2/workspaceagents/{workspaceagent}/containers/devcontainers/{devcontainer}/recreate:
post:
operationId: recreate-devcontainer-for-workspace-agent
summary: Recreate devcontainer for workspace agent
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: workspaceagent
in: path
required: true
description: Workspace agent ID
schema:
type: string
- name: devcontainer
in: path
required: true
description: Devcontainer ID
schema:
type: string
responses:
'202':
description: Accepted
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.Response'
/api/v2/workspaceagents/{workspaceagent}/containers/watch:
get:
operationId: watch-workspace-agent-for-container-updates
summary: Watch workspace agent for container updates.
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: workspaceagent
in: path
required: true
description: Workspace agent ID
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.WorkspaceAgentListContainersResponse'
/api/v2/workspaceagents/{workspaceagent}/coordinate:
get:
operationId: coordinate-workspace-agent
summary: Coordinate workspace agent
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: workspaceagent
in: path
required: true
description: Workspace agent ID
schema:
type: string
responses:
'101':
description: Switching Protocols
/api/v2/workspaceagents/{workspaceagent}/listening-ports:
get:
operationId: get-listening-ports-for-workspace-agent
summary: Get listening ports for workspace agent
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: workspaceagent
in: path
required: true
description: Workspace agent ID
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.WorkspaceAgentListeningPortsResponse'
/api/v2/workspaceagents/{workspaceagent}/logs:
get:
operationId: get-logs-by-workspace-agent
summary: Get logs by workspace agent
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: workspaceagent
in: path
required: true
description: Workspace agent ID
schema:
type: string
- name: before
in: query
required: false
description: Before log id
schema:
type: integer
- name: after
in: query
required: false
description: After log id
schema:
type: integer
- name: follow
in: query
required: false
description: Follow log stream
schema:
type: boolean
- name: no_compression
in: query
required: false
description: Disable compression for WebSocket connection
schema:
type: boolean
- name: format
in: query
required: false
description: 'Log output format. Accepted: ''json'' (default), ''text'' (plain text with RFC3339 timestamps and ANSI colors). Not supported with follow=true.'
schema:
type: string
enum:
- json
- text
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/codersdk.WorkspaceAgentLog'
/api/v2/workspaceagents/{workspaceagent}/pty:
get:
operationId: open-pty-to-workspace-agent
summary: Open PTY to workspace agent
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: workspaceagent
in: path
required: true
description: Workspace agent ID
schema:
type: string
responses:
'101':
description: Switching Protocols
/api/v2/workspaceagents/{workspaceagent}/startup-logs:
get:
operationId: removed-get-logs-by-workspace-agent
summary: 'Removed: Get logs by workspace agent'
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: workspaceagent
in: path
required: true
description: Workspace agent ID
schema:
type: string
- name: before
in: query
required: false
description: Before log id
schema:
type: integer
- name: after
in: query
required: false
description: After log id
schema:
type: integer
- name: follow
in: query
required: false
description: Follow log stream
schema:
type: boolean
- name: no_compression
in: query
required: false
description: Disable compression for WebSocket connection
schema:
type: boolean
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/codersdk.WorkspaceAgentLog'
/api/v2/workspaceagents/{workspaceagent}/watch-metadata:
get:
operationId: watch-for-workspace-agent-metadata-updates
summary: Watch for workspace agent metadata updates
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: workspaceagent
in: path
required: true
description: Workspace agent ID
schema:
type: string
responses:
'200':
description: Success
/api/v2/workspaceagents/{workspaceagent}/watch-metadata-ws:
get:
operationId: watch-for-workspace-agent-metadata-updates-via-websockets
summary: Watch for workspace agent metadata updates via WebSockets
tags:
- Agents
security:
- CoderSessionToken: []
parameters:
- name: workspaceagent
in: path
required: true
description: Workspace agent ID
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/codersdk.ServerSentEvent'
components:
schemas:
agentsdk.PostLogSourceRequest:
type: object
properties:
display_name:
type: string
icon:
type: string
id:
type: string
description: 'ID is a unique identifier for the log source.
It is scoped to a workspace agent, and can be statically
defined inside code to prevent duplicate sources from being
created for the same agent.'
codersdk.ServerSentEventType:
type: string
enum:
- ping
- data
- error
tailcfg.DERPMap:
type: object
properties:
homeParams:
description: 'HomeParams, if non-nil, is a change in home parameters.
The rest of the DEPRMap fields, if zero, means unchanged.'
allOf:
- $ref: '#/components/schemas/tailcfg.DERPHomeParams'
omitDefaultRegions:
type: boolean
description: 'OmitDefaultRegions specifies to not use Tailscale''s DERP servers, and only use those
specified in this DERPMap. If there are none set outside of the defaults, this is a noop.
This field is only meaningful if the Regions map is non-nil (indicating a change).'
regions:
type: object
description: 'Regions is the set of geographic regions running DERP node(s).
It''s keyed by the DERPRegion.RegionID.
The numbers are not necessarily contiguous.'
additionalProperties:
$ref: '#/components/schemas/tailcfg.DERPRegion'
agentsdk.ExternalAuthResponse:
type: object
properties:
access_token:
type: string
password:
type: string
token_extra:
type: object
additionalProperties: true
type:
type: string
url:
type: string
username:
type: string
description: 'Deprecated: Only supported on `/workspaceagents/me/gitauth`
for backwards compatibility.'
codersdk.LogLevel:
type: string
enum:
- trace
- debug
- info
- warn
- error
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
agentsdk.ReinitializationReason:
type: string
enum:
- prebuild_claimed
tailcfg.DERPRegion:
type: object
properties:
avoid:
type: boolean
description: 'Avoid is whether the client should avoid picking this as its home
region. The region should only be used if a peer is there.
Clients already using this region as their home should migrate
away to a new region without Avoid set.'
embeddedRelay:
type: boolean
description: 'EmbeddedRelay is true when the region is bundled with the Coder
control plane.'
nodes:
type: array
description: 'Nodes are the DERP nodes running in this region, in
priority order for the current client. Client TLS
connections should ideally only go to the first entry
(falling back to the second if necessary). STUN packets
should go to the first 1 or 2.
If nodes within a region route packets amongst themselves,
but not to other regions. That said, each user/domain
should get a the same preferred node order, so if all nodes
for a user/network pick the first one (as they should, when
things are healthy), the inter-cluster routing is minimal
to zero.'
items:
$ref: '#/components/schemas/tailcfg.DERPNode'
regionCode:
type: string
description: 'RegionCode is a short name for the region. It''s usually a popular
city or airport code in the region: "nyc", "sf", "sin",
"fra", etc.'
regionID:
type: integer
description: 'RegionID is a unique integer for a geographic region.
It corresponds to the legacy derpN.tailscale.com hostnames
used by older clients. (Older clients will continue to resolve
derpN.tailscale.com when contacting peers, rather than use
the server-provided DERPMap)
RegionIDs must be non-zero, positive, and guaranteed to fit
in a JavaScript number.
RegionIDs in range 900-999 are reserved for end users to run their
own DERP nodes.'
regionName:
type: string
description: 'RegionName is a long English name for the region: "New York City",
"San Francisco", "Singapore", "Frankfurt", etc.'
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
agentsdk.Log:
type: object
properties:
created_at:
type: string
level:
$ref: '#/components/schemas/codersdk.LogLevel'
output:
type: string
codersdk.WorkspaceAgentScriptStatus:
type: string
enum:
- ok
- exit_failure
- timed_out
- pipes_left_open
codersdk.WorkspaceAgentStartupScriptBehavior:
type: string
enum:
- blocking
- non-blocking
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.WorkspaceAgentListContainersResponse:
type: object
properties:
containers:
type: array
description: Containers is a list of containers visible to the workspace agent.
items:
$ref: '#/components/schemas/codersdk.WorkspaceAgentContainer'
devcontainers:
type: array
description: Devcontainers is a list of devcontainers visible to the workspace agent.
items:
$ref: '#/components/schemas/codersdk.WorkspaceAgentDevcontainer'
warnings:
type: array
description: 'Warnings is a list of warnings that may have occurred during the
process of listing containers. This should not include fatal errors.'
items:
type: string
codersdk.WorkspaceAgentDevcontainer:
type: object
properties:
agent:
$ref: '#/components/schemas/codersdk.WorkspaceAgentDevcontainerAgent'
config_path:
type: string
container:
$ref: '#/components/schemas/codersdk.WorkspaceAgentContainer'
dirty:
type: boolean
error:
type: string
id:
type: string
format: uuid
name:
type: string
status:
description: Additional runtime fields.
allOf:
- $ref: '#/components/schemas/codersdk.WorkspaceAgentDevcontainerStatus'
subagent_id:
format: uuid
allOf:
- $ref: '#/components/schemas/uuid.NullUUID'
workspace_folder:
type: string
workspacesdk.AgentConnectionInfo:
type: object
properties:
derp_force_websockets:
type: boolean
derp_map:
$ref: '#/components/schemas/tailcfg.DERPMap'
disable_direct_connections:
type: boolean
hostname_suffix:
type: string
tailcfg.DERPHomeParams:
type: object
properties:
regionScore:
type: object
description: 'RegionScore scales latencies of DERP regions by a given scaling
factor when determining which region to use as the home
("preferred") DERP. Scores in the range (0, 1) will cause this
region to be proportionally more preferred, and scores in the range
(1, ∞) will penalize a region.
If a region is not present in this map, it is treated as having a
score of 1.0.
Scores should not be 0 or negative; such scores will be ignored.
A nil map means no change from the previous value (if any); an empty
non-nil map can be sent to reset all scores back to 1.0.'
additionalProperties:
type: number
format: float64
codersdk.WorkspaceAgentDevcontainerStatus:
type: string
enum:
- running
- stopped
- starting
- stopping
- deleting
- error
agentsdk.GitSSHKey:
type: object
properties:
private_key:
type: string
public_key:
type: string
agentsdk.PatchAppStatus:
type: object
properties:
app_slug:
type: string
icon:
type: string
description: 'Deprecated: this field is unused and will be removed in a future version.'
message:
type: string
needs_user_attention:
type: boolean
description: 'Deprecated: this field is unused and will be removed in a future version.'
state:
$ref: '#/components/schemas/codersdk.WorkspaceAppStatusState'
uri:
type: string
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.WorkspaceAppStatusState:
type: string
enum:
- working
- idle
- complete
- failure
codersdk.WorkspaceAgentListeningPortsResponse:
type: object
properties:
ports:
type: array
description: 'If there are no ports in the list, nothing should be displayed in the UI.
There must not be a "no ports available" message or anything similar, as
there will always be no ports displayed on platforms where our port
detection logic is unsupported.'
items:
$ref: '#/components/schemas/codersdk.WorkspaceAgentListeningPort'
agentsdk.GoogleInstanceIdentityToken:
type: object
properties:
agent_name:
type: string
description: 'AgentName optionally selects a specific agent when multiple
agents share the same instance identity. An empty string is
treated as unspecified.'
json_web_token:
type: string
required:
- json_web_token
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.WorkspaceAgentListeningPort:
type: object
properties:
network:
type: string
description: only "tcp" at the moment
port:
type: integer
process_n
# --- truncated at 32 KB (46 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/coder/refs/heads/main/openapi/coder-agents-api-openapi.yml