---
title: "Create a repository variable"
method: POST
path: "/repos/{owner}/{repo}/agents/variables"
tags: ["agents"]
---

# Create a repository variable

`POST /repos/{owner}/{repo}/agents/variables`

Creates a repository 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 `repo` scope to use this endpoint.

## Path parameters

- `owner` string, required
- `repo` string, required

## Request body

- object
  - `name` string, required — The name of the variable.
  - `value` string, required — The value of the variable.

## Response `201`

Response

- EmptyObject — An object without any properties.

---

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