---
title: "Create a variable group for the team"
method: POST
path: "/api/v3/teams/{team_id}/variable-groups"
tags: ["Secrets and Environment Vars"]
---

# Create a variable group for the team

`POST /api/v3/teams/{team_id}/variable-groups`

## Request

- Base URL: `https://codemagic.io`
- URL: `https://codemagic.io/api/v3/teams/{team_id}/variable-groups`
- Auth: API key in header `x-auth-token`
- TypeScript: <https://skmtc.dev/codemagic/apis/codemagic-api/docs/api/v3/teams/:team_id/variable-groups/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `team_id` string, required

## Request body

- TeamVariableGroupsSchemasCreateVariableGroup
  - `name` string, required
  - `advanced_security` TeamVariableGroupsSchemasAdvancedSecuritySchema, required
    - `enabled` boolean, required
    - `selected_apps` unknown[], required: IDs of applications that can access the group's variables. Empty if advanced security is disabled
      - unknown

## Response `201`

Document created, URL follows

- TeamVariableGroupsSchemasVariableGroupSchemaNoPagination
  - `data` TeamVariableGroupsSchemasVariableGroupSchema, required
    - `id` string, required
    - `name` string, required

## Other responses

- `400`: The request could not be validated
- `401`: Authentication is missing or invalid
- `403`: The caller lacks the required permission
- `404`: The requested resource does not exist
- `429`: The rate limit has been exceeded

---

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