> ## Documentation Index
> Fetch the complete documentation index at: https://www.qovery.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a secret alias at the job level

> - Allows you to add an alias at job 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 job 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




## OpenAPI

````yaml /api-reference/openapi.yaml post /job/{jobId}/secret/{secretId}/alias
openapi: 3.0.0
info:
  version: 1.0.4
  title: Qovery API
  description: >
    - Qovery is the fastest way to deploy your full-stack apps on any Cloud
    provider.

    - ℹ️ The API is stable and still in development.
  contact:
    name: Qovery Product Team
    url: https://www.qovery.com
    email: support+api+documentation@qovery.com
  x-logo:
    url: https://console.qovery.com/assets/logos/logo-white.svg
    altText: Qovery
servers:
  - url: https://api.qovery.com
security:
  - bearerAuth: []
  - ApiKeyAuth: []
tags:
  - name: Account
  - name: Account Info
  - name: Alert Receivers
  - name: Alert Rules
  - name: Admin
  - name: ArgoCD
  - name: Application
  - name: Application Actions
  - name: Application Configuration
  - name: Application Database
  - name: Application Deployment Restriction
  - name: Application Deployment History
  - name: Application Environment Variable
  - name: Application Logs
  - name: Application Main Calls
  - name: Application Secret
  - name: Application Annotations Group
  - name: Applications
  - name: AutoscalingPolicy
  - name: Container
  - name: Container Actions
  - name: Container Configuration
  - name: Container Database
  - name: Container Deployment History
  - name: Container Environment Variable
  - name: Container Logs
  - name: Container Main Calls
  - name: Container Registry
  - name: Container Secret
  - name: Container Annotations Group
  - name: Containers
  - name: Deployment Stage Main Calls
  - name: Job
  - name: Job Actions
  - name: Job Configuration
  - name: Job Database
  - name: Job Deployment Restriction
  - name: Job Deployment History
  - name: Job Environment Variable
  - name: Job Logs
  - name: Job Main Calls
  - name: Job Registry
  - name: Job Secret
  - name: Job Annotations Group
  - name: Jobs
  - name: KedaTriggerAuthentication
  - name: Helm
  - name: Helm Actions
  - name: Helm Configuration
  - name: Helm Database
  - name: Helm Deployment Restriction
  - name: Helm Deployment History
  - name: Helm Logs
  - name: Helm Main Calls
  - name: Helm Repository
  - name: Helms
  - name: Backups
  - name: Billing
  - name: Cloud Provider
  - name: Cloud Provider Credentials
  - name: Clusters
  - name: Custom Domain
  - name: Container Custom Domain
  - name: Database
  - name: Database Actions
  - name: Database Application
  - name: Database Container
  - name: Database Deployment History
  - name: Database Main Calls
  - name: Database Annotations Group
  - name: Databases
  - name: Environment
  - name: Environment Actions
  - name: Environment Deployment History
  - name: Environment Deployment Rule
  - name: Environment Logs
  - name: Environment Main Calls
  - name: Environment Secret
  - name: Environment Variable
  - name: Environments
  - name: Git
  - name: Github App
  - name: Git repositories
  - name: Members
  - name: Organization
  - name: Organization Account Git Repositories
  - name: Organization Cluster Lock
  - name: Organization Main Calls
  - name: Organization Custom Role
  - name: Organization Event
  - name: Organization Api Token
  - name: Organization Webhook
  - name: Organization Annotations Group
  - name: Organization Labels Group
  - name: Organization Enterprise Connection
  - name: Project
  - name: Project Deployment Rule
  - name: Project Environment Variable
  - name: Project Main Calls
  - name: Project Secret
  - name: Projects
  - name: Referral & Rewards
  - name: Secret Manager Access
  - name: Terraforms
  - name: Terraform Main Calls
  - name: Terraform Resources
  - name: Terraform Deployment History
  - name: Terraform Deployment Restriction
  - name: Container Registries
  - name: Helm Repositories
  - name: User Sign Up
  - name: Variable Main Calls
  - name: Helm Custom Domain
  - name: Lifecycle Template Main Calls
paths:
  /job/{jobId}/secret/{secretId}/alias:
    post:
      tags:
        - Job Secret
      summary: Create a secret alias at the job level
      description: >
        - Allows you to add an alias at job 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 job 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
      operationId: createJobSecretAlias
      parameters:
        - $ref: '#/components/parameters/jobId'
        - $ref: '#/components/parameters/secretId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Key'
      responses:
        '201':
          description: Create secret alias
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Secret'
        '400':
          description: >-
            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':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
components:
  parameters:
    jobId:
      name: jobId
      in: path
      description: Job ID
      required: true
      schema:
        type: string
        format: uuid
    secretId:
      name: secretId
      in: path
      description: Secret ID
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    Key:
      type: object
      title: EnvironmentVariableAliasRequest
      required:
        - key
      properties:
        key:
          type: string
        description:
          type: string
          x-stoplight:
            id: qe7qh1tjtkwrm
          maxLength: 255
          description: optional variable description (255 characters maximum)
          nullable: true
        enable_interpolation_in_file:
          type: boolean
          x-stoplight:
            id: alajw1h9vgr9e
          nullable: true
    Secret:
      allOf:
        - $ref: '#/components/schemas/Base'
        - type: object
          required:
            - key
            - scope
          properties:
            key:
              type: string
              description: key is case sensitive
            overridden_secret:
              $ref: '#/components/schemas/SecretOverride'
            aliased_secret:
              $ref: '#/components/schemas/SecretAlias'
            scope:
              $ref: '#/components/schemas/APIVariableScopeEnum'
            variable_type:
              $ref: '#/components/schemas/APIVariableTypeEnum'
            service_id:
              type: string
              format: uuid
            service_name:
              type: string
            service_type:
              $ref: '#/components/schemas/LinkedServiceTypeEnum'
            owned_by:
              type: string
              description: 'Entity that created/own the variable (i.e: Qovery, Doppler)'
            description:
              type: string
              x-stoplight:
                id: fznezq37gx9ux
              maxLength: 255
              description: optional variable description (255 characters maximum)
              nullable: true
            enable_interpolation_in_file:
              type: boolean
              x-stoplight:
                id: j13355s39qy21
              nullable: true
    Base:
      type: object
      required:
        - id
        - created_at
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        created_at:
          type: string
          readOnly: true
          format: date-time
        updated_at:
          type: string
          readOnly: true
          format: date-time
    SecretOverride:
      type: object
      required:
        - id
        - key
        - mount_path
        - scope
        - variable_type
      properties:
        id:
          type: string
          format: uuid
        key:
          type: string
        mount_path:
          type: string
        scope:
          $ref: '#/components/schemas/APIVariableScopeEnum'
        variable_type:
          $ref: '#/components/schemas/APIVariableTypeEnum'
        description:
          type: string
          x-stoplight:
            id: edfpfqj87ezos
          maxLength: 255
          description: optional variable description (255 characters maximum)
          nullable: true
        enable_interpolation_in_file:
          type: boolean
          x-stoplight:
            id: ls2iylkcayehn
          nullable: true
    SecretAlias:
      type: object
      required:
        - id
        - key
        - mount_path
        - scope
        - variable_type
      properties:
        id:
          type: string
          format: uuid
        key:
          type: string
          example: QOVERY_DATABASE_PSQL_NAME
        mount_path:
          type: string
        scope:
          $ref: '#/components/schemas/APIVariableScopeEnum'
        variable_type:
          $ref: '#/components/schemas/APIVariableTypeEnum'
        description:
          type: string
          x-stoplight:
            id: 14nham449j6uk
          maxLength: 255
          description: optional variable description (255 characters maximum)
          nullable: true
        enable_interpolation_in_file:
          type: boolean
          x-stoplight:
            id: bm88z8ltgrcc6
          nullable: true
    APIVariableScopeEnum:
      type: string
      enum:
        - APPLICATION
        - BUILT_IN
        - ENVIRONMENT
        - PROJECT
        - CONTAINER
        - JOB
        - HELM
        - TERRAFORM
    APIVariableTypeEnum:
      type: string
      description: >
        type of the environment variable (VALUE, FILE, ALIAS, OVERRIDE, BUIT_IN,
        EXTERNAL_SECRET)
      enum:
        - VALUE
        - ALIAS
        - OVERRIDE
        - BUILT_IN
        - FILE
        - EXTERNAL_SECRET
    LinkedServiceTypeEnum:
      type: string
      description: type of the service (application, database, job, gateway...)
      enum:
        - APPLICATION
        - CONTAINER
        - DATABASE
        - JOB
        - HELM
        - TERRAFORM
  responses:
    '401':
      description: Access token is missing or invalid
    '403':
      description: Access forbidden
    '404':
      description: Resource not found
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT tokens should be used with OIDC account (human to machine). JWT
        tokens used by the Qovery console to communicate with the API have a
        TTL. Curl Example ' curl https://console.qovery.com/organization -H
        "Authorization: Bearer $qovery_token" '
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Token API are generated by Qovery to manage machine to machine
        interaction and do not have a TTL. Curl Example ' curl
        https://console.qovery.com/organization -H "Authorization: Token
        $qovery_token" '

````