---
title: "Create an organization variable"
method: POST
path: "/orgs/{org}/actions/variables"
tags: ["actions"]
---

# Create an organization variable

`POST /orgs/{org}/actions/variables`

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 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.

## Path parameters

- `org` string, required

## Request body

- object
  - `name` string, required — The name of the variable.
  - `value` string, required — The value of the variable.
  - `visibility` 'all' | 'private' | 'selected', 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.
  - `selected_repository_ids` integer[] — 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`.

## Response `201`

Response when creating a variable

- EmptyObject — An object without any properties.

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-7.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-7/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-7/versions/5438365412fe/schema)
