> ## 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 custom domain for several services

> Create a custom domain on several services of the environment at once: one custom domain and one `/` route per service, served by the service default port.
If any service conflicts, nothing is created and the response lists every conflict.
More than one service is refused with a 400 on an environment whose `routing_capabilities.can_share` is `false`.
Nothing is deployed: redeploy the services listed in `impacted_services` to serve the domain.




## OpenAPI

````yaml /api-reference/openapi.yaml post /environment/{environmentId}/customDomain
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: IPs
  - name: Alert Receivers
  - name: Alert Rules
  - name: Admin
  - name: ArgoCD
  - name: Agentic Workflows
  - name: Application
  - name: Application Actions
  - name: Application Build Analysis
  - 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 Build Analysis
  - 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: Blueprint Catalog
  - name: Cloud Provider
  - name: Cloud Provider Credentials
  - name: Clusters
  - name: Cluster Deployment History
  - name: Cluster Operator
  - name: Platform Configuration
  - name: Custom Domain
  - name: Container Custom Domain
  - name: LLM Providers
  - name: MCP Servers
  - name: Agent Activity
    description: >-
      What members' coding agents did on Qovery, linked to the skills they
      loaded: skill loads, API calls made from a Qovery skill, Qovery MCP server
      tool calls and policy denials. Built only from what Qovery already
      records. It returns no prompt text and no request content.
  - name: Skill Presets
    description: >-
      A skill preset is how an organization tells its members' coding agents to
      use Qovery: which Qovery skills apply, team instructions on top of them,
      and skills of the organization's own. Admins manage presets and assign
      each one to the organization, to roles or to members. Any member can read
      the preset that applies to them, which is what the agent's Qovery loader
      skill fetches. Every saved preset is inspected for content that could turn
      a member's agent against them, and every create, edit, delete and skill
      load is recorded in the audit log.
  - 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 Custom Domain
  - 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 Custom Domain
  - name: Organization Event
  - name: Organization Api Token
  - name: Organization Policy 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
  - name: Blueprint Main Calls
  - name: Service Main Calls
paths:
  /environment/{environmentId}/customDomain:
    post:
      tags:
        - Environment Custom Domain
      summary: Create a custom domain for several services
      description: >
        Create a custom domain on several services of the environment at once:
        one custom domain and one `/` route per service, served by the service
        default port.

        If any service conflicts, nothing is created and the response lists
        every conflict.

        More than one service is refused with a 400 on an environment whose
        `routing_capabilities.can_share` is `false`.

        Nothing is deployed: redeploy the services listed in `impacted_services`
        to serve the domain.
      operationId: createEnvironmentCustomDomain
      parameters:
        - $ref: '#/components/parameters/environmentId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EnvironmentCustomDomainRequest'
      responses:
        '201':
          description: The custom domain is created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvironmentCustomDomainResponse'
        '400':
          $ref: '#/components/responses/CustomDomainConflict'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
components:
  parameters:
    environmentId:
      name: environmentId
      in: path
      description: Environment ID
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    EnvironmentCustomDomainRequest:
      type: object
      description: The full state of a custom domain name of an environment.
      required:
        - domain
        - services
      properties:
        domain:
          type: string
          description: The domain name.
          example: my.domain.tld
        generate_certificate:
          type: boolean
          default: true
          description: >-
            Whether Qovery generates a certificate for the domain. Set it to
            `false` when a CDN or another party manages the certificate.
        use_cdn:
          type: boolean
          default: false
          description: >-
            Whether the domain is behind a CDN. If `true`, Qovery only checks
            that the domain points to an IP; otherwise it checks that the domain
            resolves to the service load balancer.
        services:
          type: array
          description: >-
            Every service the domain routes to, each with one `/` route served
            by its default port. Between 1 and 50 services; more than one only
            when the environment `routing_capabilities.can_share` is `true`.
          minItems: 1
          maxItems: 50
          items:
            $ref: '#/components/schemas/CustomDomainServiceRequest'
    EnvironmentCustomDomainResponse:
      type: object
      required:
        - domain
        - generate_certificate
        - use_cdn
        - impacted_services
      properties:
        domain:
          type: string
          description: The domain name.
          example: my.domain.tld
        generate_certificate:
          type: boolean
          description: Whether Qovery generates a certificate for the domain.
        use_cdn:
          type: boolean
          description: Whether the domain is behind a CDN.
        impacted_services:
          type: array
          description: >-
            The services whose custom domains changed, removed services
            included. They need a redeploy to serve the change.
          items:
            $ref: '#/components/schemas/ImpactedServiceResponse'
    CustomDomainServiceRequest:
      type: object
      required:
        - id
        - type
      properties:
        id:
          type: string
          format: uuid
          description: Id of the service. It must belong to the environment.
        type:
          allOf:
            - $ref: '#/components/schemas/ServiceTypeEnum'
          description: >-
            Type of the service. Only `APPLICATION`, `CONTAINER` and `HELM`
            services have custom domains.
    ImpactedServiceResponse:
      type: object
      description: >-
        A service a custom domain write changed. Nothing is deployed; the
        service needs a redeploy to serve the change.
      required:
        - id
        - type
      properties:
        id:
          type: string
          format: uuid
        type:
          $ref: '#/components/schemas/ServiceTypeEnum'
    CustomDomainProblemResponse:
      type: object
      description: >-
        A problem detail (RFC 9457). `errors` is set when the custom domain
        conflicts with other domains.
      properties:
        type:
          type: string
        title:
          type: string
          example: Bad Request
        status:
          type: integer
          example: 400
        detail:
          type: string
          description: All the error messages, joined.
        instance:
          type: string
          description: The path of the request.
        errors:
          type: array
          items:
            $ref: '#/components/schemas/CustomDomainErrorResponse'
    ServiceTypeEnum:
      type: string
      x-stoplight:
        id: d66063cd29913
      description: type of the service (application, database, job, ...)
      enum:
        - APPLICATION
        - DATABASE
        - CONTAINER
        - JOB
        - HELM
        - TERRAFORM
        - ARGOCD_APP
        - AGENTIC_WORKFLOW
    CustomDomainErrorResponse:
      type: object
      description: >-
        One reason a service cannot hold the custom domain, to show under the
        request field it blames.
      required:
        - code
        - field
        - path
        - service_id
        - conflicting_service
        - message
      properties:
        code:
          $ref: '#/components/schemas/CustomDomainErrorCodeEnum'
        field:
          type: string
          description: >-
            The request field to blame, named as on the wire, such as `domain`,
            `path`, `port_id`, `generate_certificate` or `use_cdn`.
          example: path
        path:
          type: string
          nullable: true
          description: The path in conflict. Null when the error is not about a path.
          example: /cable
        service_id:
          type: string
          format: uuid
          description: Id of the service of the request that cannot hold the domain.
        conflicting_service:
          allOf:
            - $ref: '#/components/schemas/CustomDomainServiceResponse'
          nullable: true
          description: >-
            The service of the same environment the domain conflicts with. Null
            when the conflict is with another environment, which the caller may
            not have access to.
        message:
          type: string
          description: A message to show to the user.
          example: /cable already goes to anycable on this domain.
    CustomDomainErrorCodeEnum:
      type: string
      description: >
        Why a service cannot hold the custom domain.

        * `PATH_ALREADY_ROUTED`: another service already routes this path on the
        domain.

        * `GRPC_HOSTNAME_SHARED`: a gRPC port would share the hostname; gRPC has
        no path selection.

        * `SETTINGS_MISMATCH`: `generate_certificate` or `use_cdn` differs from
        the other services on the domain.

        * `DOMAIN_IN_OTHER_ENVIRONMENT`: the name, or a hostname it serves, is
        already used in another environment of the organization.

        * `DOMAIN_ALREADY_ON_SERVICE`: the service already has this domain.

        * `ROUTING_MODE_NOT_SHAREABLE`: the domain is already used and the
        routing mode of the environment cannot share it.
      enum:
        - PATH_ALREADY_ROUTED
        - GRPC_HOSTNAME_SHARED
        - SETTINGS_MISMATCH
        - DOMAIN_IN_OTHER_ENVIRONMENT
        - DOMAIN_ALREADY_ON_SERVICE
        - ROUTING_MODE_NOT_SHAREABLE
    CustomDomainServiceResponse:
      type: object
      required:
        - id
        - type
        - name
      properties:
        id:
          type: string
          format: uuid
          description: Id of the service.
        type:
          allOf:
            - $ref: '#/components/schemas/ServiceTypeEnum'
          description: >-
            Type of the service. Only `APPLICATION`, `CONTAINER` and `HELM`
            services have custom domains.
        name:
          type: string
          description: Name of the service.
  responses:
    '401':
      description: Access token is missing or invalid
    '403':
      description: Access forbidden
    '404':
      description: Resource not found
    CustomDomainConflict:
      description: >-
        Bad request. When the custom domain conflicts with other domains,
        `errors` lists every conflict.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/CustomDomainProblemResponse'
  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" '

````

## Related topics

- [Delete a custom domain of several services](https://www.qovery.com/docs/api-reference/environment-custom-domain/delete-a-custom-domain-of-several-services.md)
- [Validate a custom domain for several services](https://www.qovery.com/docs/api-reference/environment-custom-domain/validate-a-custom-domain-for-several-services.md)
- [Edit a custom domain of several services](https://www.qovery.com/docs/api-reference/environment-custom-domain/edit-a-custom-domain-of-several-services.md)
- [Delete custom domains of several environments](https://www.qovery.com/docs/api-reference/organization-custom-domain/delete-custom-domains-of-several-environments.md)
- [Customizing Preview URL with Qovery CLI](https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/customizing-preview-url-with-qovery-cli.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.