---
title: "POST /api/v1/agent-vault/variables"
method: POST
path: "/api/v1/agent-vault/variables"
tags: ["Agent Vault Variables"]
---

# POST /api/v1/agent-vault/variables

`POST /api/v1/agent-vault/variables`

## Request

- Base URL: `https://us.infisical.com`
- URL: `https://us.infisical.com/api/v1/agent-vault/variables`
- Auth: none declared

Create a global variable, or a personal one of your own

## Request body

- object
  - `scope` 'global' | 'personal', required: global creates a variable services can use, which needs the admin role. personal creates one of your own, which only your personal values can use.
  - `key` string, required: The name values use to refer to the variable, as `{{KEY}}`. Starts with a letter and uses only upper case letters, numbers and underscores.
  - `value` string, required: The value the proxy puts in place of each `{{KEY}}`.

## Response `200`

Default Response

- object
  - `variable` object, required
    - `id` string, uuid, required: The ID of the variable.
    - `key` string, required: The name values use to refer to the variable, as `{{KEY}}`. Starts with a letter and uses only upper case letters, numbers and underscores.
    - `scope` 'global' | 'personal', required: global for a variable admins set up for services, or personal for one of your own, which only your personal values can use and only you can see. Personal keys are unique among your own variables.
    - `usedByServices` object[], required: The services that use this variable, across every access bundle, ordered by access bundle name and then service name. For a personal variable, the services whose personal values, as you set them, use it. A variable in use can't be deleted.
      - `id` string, uuid, required: The ID of a service that uses this variable.
      - `name` string, required: The name of the service.
      - `hostPattern` string, required: The host pattern of the service.
      - `accessBundleId` string, uuid, required: The ID of the access bundle the service belongs to.
      - `accessBundleName` string, required: The name of the access bundle the service belongs to.
    - `createdAt` string, date-time, required: When the variable was added.
    - `updatedAt` string, date-time, required: When the variable was last changed.

## Other responses

- `400`: Default Response
- `401`: Default Response
- `403`: Default Response
- `404`: Default Response
- `422`: Default Response
- `500`: Default Response

## Changes

- **2026-10-24** `699ce770462c`: 1 breaking, 1 info
  - added the new required request property `scope`
  - added the required property `variable/scope` to the response with the `200` status
- **2026-10-16** `dac52fa38c36`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/infisical/apis/infisical-api/changes/api/v1/agent-vault/variables/post.md)

---

[API](https://skmtc.dev/infisical/apis/infisical-api.md) - [All operations](https://skmtc.dev/infisical/apis/infisical-api/llms.txt) - [OpenAPI document](https://skmtc.dev/infisical/apis/infisical-api/revisions/7f940199c899?raw)
