> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-detect-table-modification.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# List Prometheus scrape targets

> **This endpoint is in beta.** API contract is stable, and no breaking changes are expected in the future. <br /><br /> Returns one Prometheus scrape target per service in the organization, in the [HTTP service discovery](https://prometheus.io/docs/prometheus/latest/http_sd/) (`http_sd`) format. Only services the API key is authorized to view are included; services that are being deleted or have been deleted are omitted.

Point an [`http_sd_configs`](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config) job at this endpoint to discover and scrape all services in the organization automatically. Prometheus refreshes the target list on every discovery poll, so newly created and deleted services are picked up without configuration changes.

Discovered targets scrape with `filtered_metrics=true` by default; pass `?filtered_metrics=false` to this endpoint to discover unfiltered targets. See the [Prometheus integration guide](https://clickhouse.com/docs/integrations/prometheus) for more on the exported metrics.

<span data-endpoint-badge="Beta"><Badge color="blue">Beta</Badge></span>

**This endpoint is in beta.** API contract is stable, and no breaking changes are expected in the future. <br /><br /> Returns one Prometheus scrape target per service in the organization, in the [HTTP service discovery](https://prometheus.io/docs/prometheus/latest/http_sd/) (`http_sd`) format. Only services the API key is authorized to view are included; services that are being deleted or have been deleted are omitted.

Point an [`http_sd_configs`](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config) job at this endpoint to discover and scrape all services in the organization automatically. Prometheus refreshes the target list on every discovery poll, so newly created and deleted services are picked up without configuration changes.

Discovered targets scrape with `filtered_metrics=true` by default; pass `?filtered_metrics=false` to this endpoint to discover unfiltered targets. See the [Prometheus integration guide](https://clickhouse.com/docs/integrations/prometheus) for more on the exported metrics.


## OpenAPI

````yaml _specs/cloud-openapi.json GET /v1/organizations/{organizationId}/prometheus/discovery
openapi: 3.1.2
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-1077626
    email: support@clickhouse.com
servers:
  - url: https://api.clickhouse.cloud
security:
  - basicAuth: []
tags:
  - name: Organization
  - name: User management
  - name: Billing
  - name: Role Management
  - name: Service
  - name: Backup
  - name: OpenAPI
  - name: Prometheus
  - name: ClickPipes
  - name: ClickStack
  - name: Postgres
  - name: UDF
paths:
  /v1/organizations/{organizationId}/prometheus/discovery:
    get:
      tags:
        - Prometheus
      summary: List Prometheus scrape targets
      description: >-
        **This endpoint is in beta.** API contract is stable, and no breaking
        changes are expected in the future. <br /><br /> Returns one Prometheus
        scrape target per service in the organization, in the [HTTP service
        discovery](https://prometheus.io/docs/prometheus/latest/http_sd/)
        (`http_sd`) format. Only services the API key is authorized to view are
        included; services that are being deleted or have been deleted are
        omitted.


        Point an
        [`http_sd_configs`](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config)
        job at this endpoint to discover and scrape all services in the
        organization automatically. Prometheus refreshes the target list on
        every discovery poll, so newly created and deleted services are picked
        up without configuration changes.


        Discovered targets scrape with `filtered_metrics=true` by default; pass
        `?filtered_metrics=false` to this endpoint to discover unfiltered
        targets. See the [Prometheus integration
        guide](https://clickhouse.com/docs/integrations/prometheus) for more on
        the exported metrics.
      operationId: organizationPrometheusDiscoveryGet
      parameters:
        - in: path
          name: organizationId
          description: ID of the requested organization.
          required: true
          schema:
            type: string
            format: uuid
        - in: query
          name: filtered_metrics
          description: >-
            Whether discovered targets scrape a filtered list of metrics. Sets
            the filtered_metrics parameter on each discovered target. Defaults
            to true.
          schema:
            type: string
            format: boolean
          example: 'true'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PrometheusDiscoveryTargetGroup'
        '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:
    PrometheusDiscoveryTargetGroup:
      properties:
        targets:
          type: array
          description: Host (and port) of the ClickHouse Cloud API.
          items:
            type: string
        labels:
          $ref: '#/components/schemas/PrometheusDiscoveryLabels'
    PrometheusDiscoveryLabels:
      properties:
        __scheme__:
          description: URL scheme Prometheus must scrape the target with.
          type: string
        __metrics_path__:
          description: Path of the per-service Prometheus metrics endpoint.
          type: string
        __param_filtered_metrics:
          description: Value passed as the filtered_metrics query parameter on each scrape.
          type: string
          format: boolean
        clickhouse_org_id:
          description: Organization ID the service belongs to.
          type: string
          format: uuid
        clickhouse_service_id:
          description: Service ID.
          type: string
          format: uuid
        clickhouse_discovery_service_name:
          description: Service name.
          type: string
  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

````