---
title: "Create a variable alias"
method: POST
path: "/variable/{variableId}/alias"
tags: ["Variable Main Calls"]
---

# Create a variable alias

`POST /variable/{variableId}/alias`

## Request

- Base URL: `https://api.qovery.com`
- URL: `https://api.qovery.com/variable/{variableId}/alias`
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/qovery/apis/qovery-api/docs/variable/:variableId/alias/post.ts> (a function with typed inputs; its response is checked against the schema)

- Allows you to create an alias of one of the existing variables.
- You have to specify an alias (key) in the request body, the scope and the parent id of the alias (project id, environment id or service id)
- The system will create a new variable at the requested level with the same value as the one corresponding to the variable id passed as path parameter.
- The response body will contain the newly created variable
- Information regarding the aliased_variable will be exposed in the "aliased_variable" or in the "aliased_secret" field of the newly created variable
- You can't create an alias on an alias

## Path parameters

- `variableId` string, uuid, required

## Request body

- VariableAliasRequest
  - `key` string, required: the value to be used as Alias of the targeted environment variable.
  - `alias_scope` 'APPLICATION' | 'BUILT_IN' | 'ENVIRONMENT' | 'PROJECT' | 'CONTAINER' | 'JOB' | 'HELM' | 'TERRAFORM', required
  - `alias_parent_id` string, uuid, required: the id of the variable that is aliased.
  - `description` string, nullable: optional variable description (255 characters maximum)
  - `enable_interpolation_in_file` boolean, nullable

## Response `201`

Create variable alias

- VariableResponse
  - `id` string, uuid, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time
  - `key` string, required
  - `value` string, nullable, required
  - `mount_path` string, nullable
  - `overridden_variable` VariableOverride
    - `id` string, uuid, required: The id of the overriden variable
    - `key` string, required: The key of the overriden variable
    - `value` string, nullable: The value of the overriden variable
    - `mount_path` string, required: The mounth path of the overriden variable (only if environment variable type is 'file')
    - `scope` 'APPLICATION' | 'BUILT_IN' | 'ENVIRONMENT' | 'PROJECT' | 'CONTAINER' | 'JOB' | 'HELM' | 'TERRAFORM', required
    - `variable_type` 'VALUE' | 'ALIAS' | 'OVERRIDE' | 'BUILT_IN' | 'FILE', required: type of the environment variable (VALUE, FILE, ALIAS, OVERRIDE or BUIT_IN)
  - `aliased_variable` VariableAlias
    - `id` string, uuid, required
    - `key` string, required
    - `value` string, nullable
    - `mount_path` string, required
    - `scope` 'APPLICATION' | 'BUILT_IN' | 'ENVIRONMENT' | 'PROJECT' | 'CONTAINER' | 'JOB' | 'HELM' | 'TERRAFORM', required
    - `variable_type` 'VALUE' | 'ALIAS' | 'OVERRIDE' | 'BUILT_IN' | 'FILE', required: type of the environment variable (VALUE, FILE, ALIAS, OVERRIDE or BUIT_IN)
  - `scope` 'APPLICATION' | 'BUILT_IN' | 'ENVIRONMENT' | 'PROJECT' | 'CONTAINER' | 'JOB' | 'HELM' | 'TERRAFORM', required
  - `variable_type` 'VALUE' | 'ALIAS' | 'OVERRIDE' | 'BUILT_IN' | 'FILE', required: type of the environment variable (VALUE, FILE, ALIAS, OVERRIDE or BUIT_IN)
  - `service_id` string, uuid: The id of the service referenced by this variable.
  - `service_name` string: The name of the service referenced by this variable.
  - `service_type` 'APPLICATION' | 'CONTAINER' | 'DATABASE' | 'JOB' | 'HELM' | 'TERRAFORM': type of the service (application, database, job, gateway...)
  - `owned_by` string: Entity that created/own the variable (i.e: Qovery, Doppler)
  - `is_secret` boolean, required
  - `description` string
  - `enable_interpolation_in_file` boolean

## Other responses

- `400`: Can't create an alias on a higher scope. Aliases can only be created from one scope to a lower scope. Scope hierarchy is ORGANIZATION > PROJECT > ENVIRONMENT > CONTAINER
- `401`: Access token is missing or invalid
- `403`: Access forbidden
- `404`: Resource not found

---

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