---
title: "Add a secret to the container"
method: POST
path: "/container/{containerId}/secret"
tags: ["Container Secret"]
---

# Add a secret to the container

`POST /container/{containerId}/secret`

## Request

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

- Add a secret to the container.

## Path parameters

- `containerId` string, uuid, required

## Request body

- SecretRequest
  - `key` string, required: key is case sensitive
  - `value` string: value of the secret. Clear value will never be returned
  - `mount_path` string, nullable: should be set for file only. variable mount path make secret a file (where file should be mounted).
  - `description` string, nullable: optional variable description (255 character maximum)
  - `enable_interpolation_in_file` boolean, nullable

## Response `201`

Add a secret

- 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`: Bad request
- `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)
