Skip to content

Create an organization variable

POST
/orgs/{org}/agents/variables

Creates an organization agent variable that you can reference in a GitHub Actions workflow.

Authenticated users must have collaborator access to a repository to create, update, or read variables.

OAuth tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

API method documentation

org
required
string

The organization name. The name is not case sensitive.

Media type application/json
object
name
required

The name of the variable.

string
value
required

The value of the variable.

string
visibility
required

The type of repositories in the organization that can access the variable. selected means only the repositories specified by selected_repository_ids can access the variable.

string
Allowed values: all private selected
selected_repository_ids

An array of repository ids that can access the organization variable. You can only provide a list of repository ids when the visibility is set to selected.

Array<integer>
Examples
Example default
{
"name": "USERNAME",
"value": "octocat",
"visibility": "selected",
"selected_repository_ids": [
1296269,
1296280
]
}

Response when creating a variable

Media type application/json
Empty Object

An object without any properties.

object
Examples
Example default
null