Grafana Correlations API

The Correlations API from Grafana — 2 operation(s) for correlations.

OpenAPI Specification

grafana-correlations-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Grafana HTTP Access Correlations API
  description: The Grafana HTTP API provides programmatic access to Grafana's core functionality including dashboards, data sources, alerts, users, organizations, folders, annotations, and teams. Authentication is handled via API keys, basic auth, or OAuth tokens passed in the Authorization header.
  version: 11.0.0
  contact:
    name: Grafana Labs
    url: https://grafana.com
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
servers:
- url: https://{instance}.grafana.net/api
  description: Grafana Cloud
  variables:
    instance:
      default: your-instance
- url: http://localhost:3000/api
  description: Local Grafana instance
security:
- BearerAuth: []
- BasicAuth: []
- ApiKeyAuth: []
tags:
- name: Correlations
paths:
  /datasources/correlations:
    parameters: []
    get:
      tags:
      - Correlations
      summary: Grafana Get Correlations
      description: This API operation retrieves correlation configurations from Grafana datasources. Correlations define relationships between different data sources, allowing users to create links and navigate between related data across multiple datasources. The GET request to the /datasources/correlations endpoint returns a list of all configured correlations in the Grafana instance, including details such as source and target datasources, correlation labels, and transformation rules that enable cross-datasource querying and exploration workflows.
      operationId: getCorrelations
      parameters:
      - name: limit
        in: query
        description: Limit the maximum number of correlations to return per page
        style: form
        explode: true
        schema:
          maximum: 1000
          type: integer
          contentEncoding: int64
          default: 100
      - name: page
        in: query
        description: Page index for starting fetching correlations
        style: form
        explode: true
        schema:
          type: integer
          contentEncoding: int64
          default: 1
      - name: sourceUID
        in: query
        description: Source datasource UID filter to be applied to correlations
        style: form
        explode: true
        schema:
          type: array
          items:
            type: string
      responses:
        '200':
          description: (empty)
          headers: {}
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Correlation'
                description: ''
                contentMediaType: application/json
        '401':
          description: UnauthorizedError is returned when the request is not authenticated.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseBody'
        '404':
          description: NotFoundError is returned when the requested resource was not found.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseBody'
        '500':
          description: InternalServerError is a general error indicating something went wrong internally.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseBody'
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
  /datasources/uid/{sourceUID}/correlations:
    parameters: []
    get:
      tags:
      - Correlations
      summary: Grafana Get Correlations By Source UID
      description: This API operation retrieves all correlations associated with a specific data source in Grafana by providing the data source's unique identifier (UID). It uses a GET request to the endpoint /datasources/uid/{sourceUID}/correlations, where {sourceUID} is replaced with the actual UID of the data source you want to query. The operation returns a list of correlation configurations that have been defined for the specified data source, which are used to link related data across different data sources in Grafana, enabling users to navigate between panels and dashboards based on contextual relationships in their observability data.
      operationId: getCorrelationsBySourceUID
      parameters:
      - name: sourceUID
        in: path
        description: ''
        required: true
        schema:
          type: string
      responses:
        '200':
          description: (empty)
          headers: {}
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Correlation'
                description: ''
                contentMediaType: application/json
        '401':
          description: UnauthorizedError is returned when the request is not authenticated.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseBody'
        '404':
          description: NotFoundError is returned when the requested resource was not found.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseBody'
        '500':
          description: InternalServerError is a general error indicating something went wrong internally.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseBody'
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
components:
  schemas:
    Correlation:
      title: Correlation
      type: object
      properties:
        config:
          $ref: '#/components/schemas/CorrelationConfig'
        description:
          type: string
          description: Description of the correlation
          examples:
          - Logs to Traces
        label:
          type: string
          description: Label identifying the correlation
          examples:
          - My Label
        orgId:
          type: integer
          description: OrgID of the data source the correlation originates from
          contentEncoding: int64
          examples:
          - 1
        provisioned:
          type: boolean
          description: Provisioned True if the correlation was created during provisioning
        sourceUID:
          type: string
          description: UID of the data source the correlation originates from
          examples:
          - d0oxYRg4z
        targetUID:
          type: string
          description: UID of the data source the correlation points to
          examples:
          - PE1C5CBDA0504A6A3
        type:
          type: string
          description: 'the type of correlation, either query for containing query information, or external for containing an external URL

            +enum'
        uid:
          type: string
          description: Unique identifier of the correlation
          examples:
          - 50xhMlg9k
      description: Correlation is the model for correlations definitions
    Type1:
      title: Type1
      enum:
      - regex
      - logfmt
      type: string
    CorrelationConfig:
      title: CorrelationConfig
      required:
      - field
      - target
      type: object
      properties:
        field:
          type: string
          description: Field used to attach the correlation link
          examples:
          - message
        target:
          type: object
          additionalProperties: {}
          description: Target data query
          examples:
          - prop1: value1
            prop2: value
        transformations:
          type: array
          items:
            $ref: '#/components/schemas/Transformation'
          description: ''
        type:
          type: string
          description: 'the type of correlation, either query for containing query information, or external for containing an external URL

            +enum'
    Transformation:
      title: Transformation
      type: object
      properties:
        expression:
          type: string
        field:
          type: string
        mapValue:
          type: string
        type:
          $ref: '#/components/schemas/Type1'
    ErrorResponseBody:
      title: ErrorResponseBody
      required:
      - message
      type: object
      properties:
        error:
          type: string
          description: Error An optional detailed description of the actual error. Only included if running in developer mode.
        message:
          type: string
          description: a human readable version of the error
        status:
          type: string
          description: 'Status An optional status to denote the cause of the error.


            For example, a 412 Precondition Failed error may include additional information of why that error happened.'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Service account token or API key
    BasicAuth:
      type: http
      scheme: basic
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Format: Bearer <api-key>'