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

# Create the PostgreSQL private endpoint

> **This endpoint is in beta.** API contract is stable, and no breaking changes are expected in the future. <br /><br /> Creates the AWS private endpoint service of a Postgres service. Creation takes about 5 to 10 minutes: `state` is `creating` until the service is `available`. A VPC endpoint can connect only after its ID is approved with the update endpoint. Returns 409 if the service already has a private endpoint. Private endpoints are available only for AWS Postgres services, and only for organizations with the feature enabled.

Beta

**This endpoint is in beta.** API contract is stable, and no breaking changes are expected in the future. \
\
&#x20;Creates the AWS private endpoint service of a Postgres service. Creation takes about 5 to 10 minutes: `state` is `creating` until the service is `available`. A VPC endpoint can connect only after its ID is approved with the update endpoint. Returns 409 if the service already has a private endpoint. Private endpoints are available only for AWS Postgres services, and only for organizations with the feature enabled.

#### Permission

The API key must have the `control-plane:postgres-service:manage` permission.


## OpenAPI

````yaml _specs/cloud-openapi.json POST /v1/organizations/{organizationId}/postgres/{postgresId}/privateEndpoint
openapi: 3.1.1
info:
  title: OpenAPI spec for ClickHouse Cloud
  version: '1.0'
  contact:
    name: ClickHouse Support
    url: >-
      https://clickhouse.com/docs/en/cloud/manage/openapi?referrer=openapi-1451325
    email: support@clickhouse.com
servers:
  - url: https://api.clickhouse.cloud
security:
  - basicAuth: []
tags:
  - name: Organization
  - name: Notifications
  - name: User management
  - name: Billing
  - name: Role Management
  - name: Service
  - name: Backup
  - name: Snapshot
  - name: API keys
  - name: Prometheus
  - name: ClickPipes
  - name: ClickStack
  - name: Postgres
  - name: UDF
  - name: Query API endpoints
  - name: Saved queries
paths:
  /v1/organizations/{organizationId}/postgres/{postgresId}/privateEndpoint:
    post:
      tags:
        - Postgres
      summary: Create the PostgreSQL private endpoint
      description: >-
        **This endpoint is in beta.** API contract is stable, and no breaking
        changes are expected in the future. <br /><br /> Creates the AWS private
        endpoint service of a Postgres service. Creation takes about 5 to 10
        minutes: `state` is `creating` until the service is `available`. A VPC
        endpoint can connect only after its ID is approved with the update
        endpoint. Returns 409 if the service already has a private endpoint.
        Private endpoints are available only for AWS Postgres services, and only
        for organizations with the feature enabled.
      operationId: postgresPrivateEndpointPost
      parameters:
        - in: path
          name: organizationId
          description: ID of the organization that owns the Postgres service.
          required: true
          schema:
            type: string
            format: uuid
        - in: path
          name: postgresId
          description: ID of the Postgres service.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostgresPrivateEndpointPostRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: number
                    description: HTTP status code.
                    example: 200
                  requestId:
                    type: string
                    description: Unique id assigned to every request. UUIDv4
                    format: uuid
                  result:
                    $ref: '#/components/schemas/PostgresPrivateEndpoint'
        '400':
          description: >-
            The request cannot be processed due to a client error. Please verify
            your request parameters and try again.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: number
                    description: HTTP status code.
                    example: 400
                  error:
                    type: string
                    description: Detailed error description.
                  requestId:
                    type: string
                    description: Unique id assigned to every request. UUIDv4
                    format: uuid
        '500':
          description: >-
            An internal server error has occurred. If this issue persists,
            please contact ClickHouse Cloud support for assistance.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTP status code.
                    example: 500
                  error:
                    type: string
                    description: Detailed error description.
                  requestId:
                    type: string
                    description: Unique id assigned to every request. UUIDv4
                    format: uuid
components:
  schemas:
    PostgresPrivateEndpointPostRequest:
      properties:
        supportedRegions:
          type: array
          description: >-
            AWS region IDs, other than the service region, from which VPC
            endpoints can connect, such as `us-west-2`. The service region is
            always supported and must not be listed. Requires cross-region
            private endpoints to be enabled for the organization.
          items:
            type: string
          example:
            - us-west-2
          uniqueItems: true
    PostgresPrivateEndpoint:
      properties:
        state:
          description: >-
            State of the private endpoint service: one of 'creating',
            'available', 'deleting'. More states may be added. It is `creating`
            for about 5 to 10 minutes after creation, then `available`.
          type: string
          example: available
        endpointServiceName:
          description: >-
            Name of the AWS endpoint service. Use it as the service name when
            creating a VPC endpoint. Omitted until the service is created.
          type: string
          example: com.amazonaws.vpce.us-east-1.vpce-svc-0123456789abcdef0
        endpointServiceId:
          description: >-
            ID of the AWS endpoint service. Omitted until the service is
            created.
          type: string
          example: vpce-svc-0123456789abcdef0
        privateHostname:
          description: >-
            Hostname that resolves to the Postgres service from an approved VPC
            endpoint. Omitted until the service is available.
          type: string
        privateDnsName:
          description: >-
            Private DNS name of the endpoint service. Omitted until it is
            assigned.
          type: string
        privateDnsVerificationState:
          description: >-
            Verification state of the private DNS name. Omitted until it is
            assigned.
          type: string
        ipAddressType:
          description: IP address type of the endpoint service.
          type: string
          example: dual
        ports:
          type: array
          description: Ports the endpoint service forwards.
          items:
            $ref: '#/components/schemas/PostgresPrivateEndpointPort'
        supportedRegions:
          type: array
          description: >-
            AWS region IDs, other than the service region, from which VPC
            endpoints can connect, such as `us-west-2`. The service region is
            always supported and must not be listed. Requires cross-region
            private endpoints to be enabled for the organization.
          items:
            type: string
          example:
            - us-west-2
        allowedVpcEndpoints:
          type: array
          description: VPC endpoints approved to connect.
          items:
            $ref: '#/components/schemas/PostgresPrivateEndpointVpcEndpoint'
      required:
        - state
        - ipAddressType
        - ports
        - supportedRegions
        - allowedVpcEndpoints
    PostgresPrivateEndpointPort:
      properties:
        port:
          description: Port exposed by the endpoint service.
          type: integer
          example: 5432
        targetPort:
          description: Port on the Postgres service it forwards to.
          type: integer
          example: 5432
      required:
        - port
        - targetPort
    PostgresPrivateEndpointVpcEndpoint:
      properties:
        vpcEndpointId:
          description: ID of the AWS VPC endpoint that is allowed to connect.
          type: string
          example: vpce-0123456789abcdef0
          pattern: ^vpce-[0-9a-f]{17}$
        description:
          description: Optional description of the VPC endpoint.
          type: string
          example: Production VPC
          maxLength: 255
      required:
        - vpcEndpointId
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >-
        Use key ID and key secret obtained in ClickHouse Cloud console:
        https://clickhouse.com/docs/cloud/manage/openapi
      x-permission-scopes: >-
        The scope list of a `security` requirement holds ClickHouse Cloud API
        key permission ids (for example `control-plane:organization:view`), not
        OAuth scopes. OpenAPI has no field for API key permissions, so this is
        the closest available place. A key must hold every permission listed on
        an operation to call it; an operation with no scopes needs none beyond a
        valid key. Every operation declares at most one requirement object,
        always for this scheme, so the list is only ever conjunctive —
        alternative sets of permissions are never expressed.

````