Sample - GitHub REST API
POST/orgs/{org}/actions/variables

Create an organization variable

Creates an organization 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 theadmin: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.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

1 parameter · 4 body fields
orgstringrequired
The organization name. The name is not case sensitive.
namestringrequired
The name of the variable.
valuestringrequired
The value of the variable.
visibilitystringrequired
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.
Allowed:allprivateselected
selected_repository_idsarray<integer>optional
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`.

1 status code
201Response when creating a variable