---
title: "Create a secret alias at the environment level"
method: POST
path: "/environment/{environmentId}/secret/{secretId}/alias"
tags: ["Environment Secret"]
---

# Create a secret alias at the environment level

`POST /environment/{environmentId}/secret/{secretId}/alias`

## Request

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

- Allows you to add an alias at environment level on an existing secret having higher scope, in order to customize its key.
- You only have to specify a key in the request body
- The system will create a new secret at environment level with the same value as the one corresponding to the secret id in the path
- The response body will contain the newly created secret
- Information regarding the aliased_secret will be exposed in the "aliased_secret" field of the newly created secret
- You can't create an alias on an alias

## Path parameters

- `environmentId` string, uuid, required
- `secretId` string, uuid, required

## Request body

- Key
  - `key` string, required
  - `description` string, nullable: optional variable description (255 characters maximum)
  - `enable_interpolation_in_file` boolean, nullable

## Response `201`

Create secret alias

- Secret
  - `id` string, uuid, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time
  - `key` string, required: key is case sensitive
  - `overridden_secret` SecretOverride
    - `id` string, uuid, required
    - `key` string, required
    - `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)
    - `description` string, nullable: optional variable description (255 characters maximum)
    - `enable_interpolation_in_file` boolean, nullable
  - `aliased_secret` SecretAlias
    - `id` string, uuid, required
    - `key` string, required
    - `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)
    - `description` string, nullable: optional variable description (255 characters maximum)
    - `enable_interpolation_in_file` boolean, nullable
  - `scope` 'APPLICATION' | 'BUILT_IN' | 'ENVIRONMENT' | 'PROJECT' | 'CONTAINER' | 'JOB' | 'HELM' | 'TERRAFORM', required
  - `variable_type` 'VALUE' | 'ALIAS' | 'OVERRIDE' | 'BUILT_IN' | 'FILE': type of the environment variable (VALUE, FILE, ALIAS, OVERRIDE or BUIT_IN)
  - `service_id` string, uuid
  - `service_name` string
  - `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)
  - `description` string, nullable: optional variable description (255 characters maximum)
  - `enable_interpolation_in_file` boolean, nullable

## 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 BUILT_IN > PROJECT > ENVIRONMENT > APPLICATION
- `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)
