PATCH/agents/repos/{owner}/{repo}/automations/{automation_id}

Edit an automation for a repository

Edits specified fields on an existing automation in a repository. Omitted fields are left unchanged. The automation's owner_type is immutable and cannot be changed by this operation.

Fine-grained access tokens for "Edit an automation for a repository"

This endpoint works with the following fine-grained token types:

The fine-grained token must have one of the following permission sets for each repository accessed by this request:

  • "Agent tasks" repository permissions (read and write)
  • "Contents" repository permissions (read and write)

The required permission set depends on each repository's Automation permission configuration.

GitHub App installation access tokens are not supported for this endpoint.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

3 parameters · 10 body fields
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository. The name is not case sensitive.
automation_idstringrequired
The unique identifier of the automation.

The automation fields to update. Omitted fields are left unchanged.

namestringoptional
The name of the automation.
enabledbooleanoptional
Set to true to enable, false to disable. Omit to leave unchanged.
write_scopestringoptional
Controls which repository resources a run may modify. `trigger` limits writes to the resource that started the run, when one exists, and resources created during the run; `repository` allows writes to any resource in the repository. Supported values: `trigger`, `repository`. Omit to leave unchanged.
Allowed:triggerrepository
require_actor_write_permissionbooleanoptional
When true, event-triggered runs require the event actor to have repo write permission, even when the org's allow_read_access_triggers policy is enabled. Does not apply to interval-scheduled runs, which always run as the automation owner. Omit to leave unchanged.
modelstringoptional
The model to use for sessions triggered by this automation. Omit to leave unchanged. Send an empty string to clear the model and revert to the platform default.
reasoning_effortstringoptional
The reasoning effort to use for sessions triggered by this automation. Omit to leave unchanged. Send an empty string to clear the override. Currently supported values: `none`, `low`, `medium`, `high`, `xhigh`, `max`
triggersobjectoptional
Public trigger configuration keyed by stable public trigger identifier. Each trigger has a closed, trigger-specific configuration schema.
promptstringoptional
The prompt template for the automation.
toolsarray<string>optional
The tools available to the automation. Send an empty array to clear all tools.
allowed_custom_agentsarray<string>optional
Custom agents (subagents) this automation is allowed to invoke. Send an empty array to clear all custom agents.

5 status codes
200Automation updated successfully
idstringrequired
The unique identifier of the automation.
namestringrequired
The name of the automation.
enabledbooleanoptional
Whether the automation is currently enabled.
owner_typestringoptional
Who owns the automation. `user` keeps it private to its creator and its runs act as that user. `repository` makes it belong to the repository, visible to anyone with read access to the repository, and its runs act as the Copilot app rather than as a person.
Allowed:userrepository
write_scopestringoptional
Controls which repository resources a run may modify. `trigger` limits writes to the resource that started the run, when one exists, and resources created during the run; `repository` allows writes to any resource in the repository. Supported values: `trigger`, `repository`.
Allowed:triggerrepositoryDefault:trigger
require_actor_write_permissionbooleanoptional
When true, event-triggered runs require the event actor to have repo write permission, even when the org's allow_read_access_triggers policy is enabled. Does not apply to interval-scheduled runs, which always run as the automation owner.
Default:false
triggersobjectoptional
Public trigger configuration keyed by stable public trigger identifier. Each trigger has a closed, trigger-specific configuration schema.
promptstringrequired
The prompt template for the automation.
toolsarray<string>optional
The tools available to the automation.
allowed_custom_agentsarray<string>optional
Custom agents (subagents) this automation is allowed to invoke.
modelstringoptional
The model to use for sessions triggered by this automation. Omit to use the platform default.
reasoning_effortstringoptional
The reasoning effort to use for sessions triggered by this automation. Omit or leave empty for no override. Currently supported values: `none`, `low`, `medium`, `high`, `xhigh`, `max`
created_atstringrequired
When the automation was created.
updated_atstringrequired
When the automation was last updated.
created_byobjectrequired
A GitHub user
400Bad request
messagestringrequired
Summary message (e.g. "Validation Failed", "Not Found")
errorsarray<object>optional
List of validation errors (present only for 422 responses)
documentation_urlstringrequired
URL to relevant API documentation
401Authentication required
messagestringrequired
Summary message (e.g. "Validation Failed", "Not Found")
errorsarray<object>optional
List of validation errors (present only for 422 responses)
documentation_urlstringrequired
URL to relevant API documentation
404Resource not found
messagestringrequired
Summary message (e.g. "Validation Failed", "Not Found")
errorsarray<object>optional
List of validation errors (present only for 422 responses)
documentation_urlstringrequired
URL to relevant API documentation
422Validation Failed
messagestringrequired
Summary message (e.g. "Validation Failed", "Not Found")
errorsarray<object>optional
List of validation errors (present only for 422 responses)
documentation_urlstringrequired
URL to relevant API documentation

Error handling

A 400 is returned: Bad request. A 401 is returned: Authentication required. A 404 is returned: Resource not found. A 422 is returned: Validation Failed.