Use the REST API to start and manage Copilot cloud agent tasks
Note
Most endpoints use Authorization: Bearer <YOUR-TOKEN> and Accept: application/vnd.github+json headers, plus X-GitHub-Api-Version: 2026-03-10. Curl examples below omit these standard headers for brevity.
GET /agents/repos/{owner}/{repo}/tasks
Note
This endpoint is in public preview and is subject to change.
Returns a list of tasks for a specific repository
Fine-grained access tokens for "List tasks for repository"
This endpoint works with the following fine-grained token types:
GitHub App user access tokens
Fine-grained personal access tokens
The fine-grained token must have the following permission set:
"Agent tasks" repository permissions (read)
GitHub App installation access tokens are not supported for this endpoint.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository. The name is not case sensitive.
per_page (integer)
The number of results per page (max 100).
Default: 30
page (integer)
The page number of the results to fetch.
Default: 1
sort (string)
The field to sort results by. Can be updated_at or created_at.
Default: updated_at
Can be one of: updated_at, created_at
direction (string)
The direction to sort results. Can be asc or desc.
Default: desc
Can be one of: asc, desc
state (string)
Comma-separated list of task states to filter by. Can be any combination of: queued, in_progress, completed, failed, idle, waiting_for_user, timed_out, cancelled.
is_archived (boolean)
Filter by archived status. When true, returns only archived tasks. When false or omitted, returns only non-archived tasks. Defaults to false.
Default: false
since (string)
Only show tasks updated at or after this time (ISO 8601 timestamp)
creator_id (array)
Filter tasks by creator user ID. Accepts one or more user IDs.
200 - Tasks retrieved successfully
400 - Bad request
401 - Authentication required
403 - Insufficient permissions
404 - Resource not found
422 - Validation Failed
Request:
curl -L \
-X GET \
https://api.github.com/agents/repos/OWNER/REPO/tasks
Response schema (Status: 200):
tasks: required, array of objects:
id: required, stringurl: stringhtml_url: stringname: stringcreator: one of:
id: integer, format: int64creator_type: string, enum: user, organizationuser_collaborators: array of objects:
id: integer, format: int64owner: object:
id: integer, format: int64repository: object:
id: integer, format: int64state: required, string, enum: queued, in_progress, completed, failed, idle, waiting_for_user, timed_out, cancelledsession_count: integer, format: int32artifacts: array of objects:
provider: required, string, enum: githubtype: required, string, enum: pull, branchdata: required, one of:
id: required, integer, format: int64global_id: stringhead_ref: required, stringbase_ref: required, stringarchived_at: string or null, format: date-timeupdated_at: string, format: date-timecreated_at: required, string, format: date-timecustom_agent: object:
id: stringtotal_active_count: integer, format: int32total_archived_count: integer, format: int32POST /agents/repos/{owner}/{repo}/tasks
Note
This endpoint is in public preview and is subject to change.
Starts a new Copilot cloud agent task for a repository.
This endpoint is only available to users with a Copilot Business or Copilot Enterprise subscription.
Fine-grained access tokens for "Start a task"
This endpoint works with the following fine-grained token types:
GitHub App user access tokens
Fine-grained personal access tokens
The fine-grained token must have the following permission set:
"Agent tasks" repository permissions (read and write)
GitHub App installation access tokens are not supported for this endpoint.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository. The name is not case sensitive.
prompt (string) (required)
The user's prompt for the agent
model (string)
The model to use for this task. The allowed models may change over time and depend on the user's GitHub Copilot plan and organization policies. Currently supported values: claude-sonnet-4.6, claude-opus-4.6, gpt-5.2-codex, gpt-5.3-codex, gpt-5.4, claude-sonnet-4.5, claude-opus-4.5
custom_agent (string)
Optional identifier for a custom agent to use for this task. Use the custom agent's filename without the extension - for example, for a .github/agents/performance-optimizer.agent.md custom agent, use performance-optimizer.
create_pull_request (boolean)
Whether to create a PR.
Default: false
base_ref (string)
Base ref for new branch/PR
head_ref (string)
Head ref for existing branch/PR. If provided with base_ref, the agent looks up open PR context for head_ref targeting base_ref and commits to head_ref instead of creating a new branch.
201 - Task created successfully
400 - Problems parsing JSON
401 - Authentication required
403 - Insufficient permissions
422 - Validation Failed
Request:
curl -L \
-X POST \
https://api.github.com/agents/repos/OWNER/REPO/tasks \
-d '{
"prompt": "Fix the login button on the homepage",
"base_ref": "main"
}'
Response schema (Status: 201):
id: required, stringurl: stringhtml_url: stringname: stringcreator: one of:
id: integer, format: int64creator_type: string, enum: user, organizationuser_collaborators: array of objects:
id: integer, format: int64owner: object:
id: integer, format: int64repository: object:
id: integer, format: int64state: required, string, enum: queued, in_progress, completed, failed, idle, waiting_for_user, timed_out, cancelledsession_count: integer, format: int32artifacts: array of objects:
provider: required, string, enum: githubtype: required, string, enum: pull, branchdata: required, one of:
id: required, integer, format: int64global_id: stringhead_ref: required, stringbase_ref: required, stringarchived_at: string or null, format: date-timeupdated_at: string, format: date-timecreated_at: required, string, format: date-timecustom_agent: object:
id: stringRequest:
curl -L \
-X POST \
https://api.github.com/agents/repos/OWNER/REPO/tasks \
-d '{
"prompt": "Fix the login button on the homepage",
"base_ref": "main",
"custom_agent": "my-custom-agent"
}'
Response schema (Status: 201):
id: required, stringurl: stringhtml_url: stringname: stringcreator: one of:
id: integer, format: int64creator_type: string, enum: user, organizationuser_collaborators: array of objects:
id: integer, format: int64owner: object:
id: integer, format: int64repository: object:
id: integer, format: int64state: required, string, enum: queued, in_progress, completed, failed, idle, waiting_for_user, timed_out, cancelledsession_count: integer, format: int32artifacts: array of objects:
provider: required, string, enum: githubtype: required, string, enum: pull, branchdata: required, one of:
id: required, integer, format: int64global_id: stringhead_ref: required, stringbase_ref: required, stringarchived_at: string or null, format: date-timeupdated_at: string, format: date-timecreated_at: required, string, format: date-timecustom_agent: object:
id: stringGET /agents/repos/{owner}/{repo}/tasks/{task_id}
Note
This endpoint is in public preview and is subject to change.
Returns a task by ID scoped to an owner/repo path
Fine-grained access tokens for "Get a task by repo"
This endpoint works with the following fine-grained token types:
GitHub App user access tokens
Fine-grained personal access tokens
The fine-grained token must have the following permission set:
"Agent tasks" repository permissions (read)
GitHub App installation access tokens are not supported for this endpoint.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository. The name is not case sensitive.
task_id (string) (required)
The unique identifier of the task.
200 - Task retrieved successfully
400 - Bad request
401 - Authentication required
403 - Insufficient permissions
404 - Resource not found
422 - Validation Failed
Request:
curl -L \
-X GET \
https://api.github.com/agents/repos/OWNER/REPO/tasks/TASK_ID
Response schema (Status: 200):
id: required, stringurl: stringhtml_url: stringname: stringcreator: one of:
id: integer, format: int64creator_type: string, enum: user, organizationuser_collaborators: array of objects:
id: integer, format: int64owner: object:
id: integer, format: int64repository: object:
id: integer, format: int64state: required, string, enum: queued, in_progress, completed, failed, idle, waiting_for_user, timed_out, cancelledsession_count: integer, format: int32artifacts: array of objects:
provider: required, string, enum: githubtype: required, string, enum: pull, branchdata: required, one of:
id: required, integer, format: int64global_id: stringhead_ref: required, stringbase_ref: required, stringarchived_at: string or null, format: date-timeupdated_at: string, format: date-timecreated_at: required, string, format: date-timecustom_agent: object:
id: stringsessions: array of objects:
id: required, stringname: stringuser: object:
id: integer, format: int64owner: object:
id: integer, format: int64repository: object:
id: integer, format: int64task_id: stringstate: required, string, enum: queued, in_progress, completed, failed, idle, waiting_for_user, timed_out, cancelledcreated_at: required, string, format: date-timeupdated_at: string, format: date-timecompleted_at: string, format: date-timeprompt: stringhead_ref: stringbase_ref: stringmodel: stringusage: object:
type: required, string, enum: ai_credits, premium_requestsamount: required, number, format: doubleerror: object:
message: stringGET /agents/tasks
Note
This endpoint is in public preview and is subject to change.
Returns a list of tasks for the authenticated user
Fine-grained access tokens for "List tasks"
This endpoint works with the following fine-grained token types:
GitHub App user access tokens
Fine-grained personal access tokens
The fine-grained token must have the following permission set:
"Agent tasks" repository permissions (read)
GitHub App installation access tokens are not supported for this endpoint.
accept (string)application/vnd.github+json is recommended.per_page (integer)
The number of results per page (max 100).
Default: 30
page (integer)
The page number of the results to fetch.
Default: 1
sort (string)
The field to sort results by. Can be updated_at or created_at.
Default: updated_at
Can be one of: updated_at, created_at
direction (string)
The direction to sort results. Can be asc or desc.
Default: desc
Can be one of: asc, desc
state (string)
Comma-separated list of task states to filter by. Can be any combination of: queued, in_progress, completed, failed, idle, waiting_for_user, timed_out, cancelled.
is_archived (boolean)
Filter by archived status. When true, returns only archived tasks. When false or omitted, returns only non-archived tasks. Defaults to false.
Default: false
since (string)
Only show tasks updated at or after this time (ISO 8601 timestamp)
200 - Tasks retrieved successfully
400 - Bad request
401 - Authentication required
403 - Insufficient permissions
422 - Validation Failed
Request:
curl -L \
-X GET \
https://api.github.com/agents/tasks
Response schema (Status: 200):
Same response schema as List tasks for repository.
GET /agents/tasks/{task_id}
Note
This endpoint is in public preview and is subject to change.
Returns a task by ID with its associated sessions
Fine-grained access tokens for "Get a task by ID"
This endpoint works with the following fine-grained token types:
GitHub App user access tokens
Fine-grained personal access tokens
The fine-grained token must have the following permission set:
"Agent tasks" repository permissions (read)
GitHub App installation access tokens are not supported for this endpoint.
accept (string)application/vnd.github+json is recommended.task_id (string) (required)200 - Task retrieved successfully
400 - Problems parsing request
401 - Authentication required
403 - Insufficient permissions
404 - Resource not found
422 - Validation Failed
Request:
curl -L \
-X GET \
https://api.github.com/agents/tasks/TASK_ID
Response schema (Status: 200):
Same response schema as Get a task by repo.