Grafana Convert API

The Convert API from Grafana — 6 operation(s) for convert.

OpenAPI Specification

grafana-convert-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Grafana HTTP Access Convert 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: Convert
paths:
  /convert/api/prom/rules:
    parameters: []
    get:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Cortex Get Rules
      description: This API operation retrieves Prometheus or Cortex alerting and recording rules from a configured data source and converts them into Grafana's unified alerting format. It acts as a migration utility that fetches existing Prometheus-compatible rules and transforms them so they can be imported or managed within Grafana's alerting system, enabling users to consolidate their monitoring rules into Grafana's native rule structure while maintaining compatibility with Prometheus-style rule definitions.
      operationId: routeConvertPrometheusCortexGetRules
      parameters: []
      responses:
        '200':
          description: PrometheusNamespace
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
        '404':
          description: NotFound
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
    post:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Cortex Post Rule Groups
      description: This API operation converts Prometheus or Cortex rule group configurations into Grafana's native format by accepting a POST request to the /convert/api/prom/rules endpoint. It enables users to migrate their existing Prometheus-style alerting and recording rules from Prometheus or Cortex deployments into Grafana, facilitating the transition between monitoring systems while preserving rule logic and structure. The endpoint processes the submitted rule groups and transforms them into a format compatible with Grafana's alerting engine, streamlining the configuration migration process and reducing manual conversion efforts.
      operationId: routeConvertPrometheusCortexPostRuleGroups
      parameters:
      - name: Content-Type
        in: header
        description: ''
        required: true
        schema:
          const: application/json
          type: string
      responses:
        '202':
          description: ConvertPrometheusResponse
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConvertPrometheusResponse'
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
  /convert/api/prom/rules/{NamespaceTitle}:
    parameters: []
    get:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Cortex Get Namespace
      description: This API operation retrieves and converts Prometheus or Cortex rule configurations from a specific namespace in Grafana. By making a GET request to the endpoint with a namespace title parameter, it fetches the alerting and recording rules defined within that namespace and converts them into a format compatible with Grafana's unified alerting system. This is particularly useful when migrating from Prometheus-style alerting rules to Grafana's native alerting framework, allowing users to maintain their existing rule configurations while leveraging Grafana's enhanced alerting capabilities and management features.
      operationId: routeConvertPrometheusCortexGetNamespace
      parameters:
      - name: NamespaceTitle
        in: path
        description: ''
        required: true
        schema:
          type: string
      responses:
        '200':
          description: PrometheusNamespace
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
        '404':
          description: NotFound
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
    post:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Cortex Post Rule Group
      description: The Grafana API operation POST /convert/api/prom/rules/{NamespaceTitle} converts and creates a Prometheus or Cortex rule group within a specified namespace. This endpoint accepts Prometheus-style rule definitions and transforms them into Grafana's native alert rule format, allowing users to migrate their existing Prometheus alerting and recording rules into Grafana's unified alerting system. The {NamespaceTitle} parameter identifies the target namespace where the converted rule group will be stored, enabling organized management of alert rules across different teams or services within Grafana.
      operationId: routeConvertPrometheusCortexPostRuleGroup
      parameters:
      - name: NamespaceTitle
        in: path
        description: ''
        required: true
        schema:
          type: string
      - name: x-grafana-alerting-datasource-uid
        in: header
        description: ''
        schema:
          type: string
      - name: x-grafana-alerting-recording-rules-paused
        in: header
        description: ''
        schema:
          type: boolean
      - name: x-grafana-alerting-alert-rules-paused
        in: header
        description: ''
        schema:
          type: boolean
      - name: x-grafana-alerting-target-datasource-uid
        in: header
        description: ''
        schema:
          type: string
      - name: x-grafana-alerting-folder-uid
        in: header
        description: ''
        schema:
          type: string
      - name: x-grafana-alerting-notification-settings
        in: header
        description: ''
        schema:
          type: string
      requestBody:
        description: ''
        content:
          application/yaml:
            schema:
              $ref: '#/components/schemas/PrometheusRuleGroup'
        required: false
      responses:
        '202':
          description: ConvertPrometheusResponse
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConvertPrometheusResponse'
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
    delete:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Cortex Delete Namespace
      description: This API operation deletes a specific Prometheus or Cortex rule namespace within Grafana's conversion or migration layer. By sending a DELETE request to the endpoint with a namespace title parameter, users can remove an entire namespace and its associated alert rules or recording rules that were previously converted or imported from Prometheus/Cortex format. This is useful during cleanup operations, when reorganizing rule structures, or when removing legacy configurations that have been migrated to Grafana's native rule format.
      operationId: routeConvertPrometheusCortexDeleteNamespace
      parameters:
      - name: NamespaceTitle
        in: path
        description: ''
        required: true
        schema:
          type: string
      responses:
        '202':
          description: ConvertPrometheusResponse
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConvertPrometheusResponse'
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
  /convert/api/prom/rules/{NamespaceTitle}/{Group}:
    parameters: []
    get:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Cortex Get Rule Group
      description: 'This API operation retrieves a specific Prometheus rule group from a designated namespace in Grafana''s Cortex ruler service. The endpoint accepts two path parameters: NamespaceTitle which identifies the namespace containing the rule group, and Group which specifies the name of the rule group to retrieve. When called, it returns the configuration and rules defined within that particular rule group, allowing users to view and manage their Prometheus alerting and recording rules that have been converted or stored in the Cortex format within Grafana''s unified alerting system.'
      operationId: routeConvertPrometheusCortexGetRuleGroup
      parameters:
      - name: NamespaceTitle
        in: path
        description: ''
        required: true
        schema:
          type: string
      - name: Group
        in: path
        description: ''
        required: true
        schema:
          type: string
      responses:
        '200':
          description: PrometheusRuleGroup
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
        '404':
          description: NotFound
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
    delete:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Cortex Delete Rule Group
      description: This API operation is used to delete a specific Prometheus rule group within Grafana's Cortex-based alerting system. It targets a rule group identified by both its namespace title and group name through the URL path parameters. When called with the DELETE HTTP method, it removes the entire rule group configuration from the specified namespace, effectively eliminating all alert and recording rules contained within that group from the Prometheus-compatible rules engine in Grafana.
      operationId: routeConvertPrometheusCortexDeleteRuleGroup
      parameters:
      - name: NamespaceTitle
        in: path
        description: ''
        required: true
        schema:
          type: string
      - name: Group
        in: path
        description: ''
        required: true
        schema:
          type: string
      responses:
        '202':
          description: ConvertPrometheusResponse
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConvertPrometheusResponse'
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
  /convert/prometheus/config/v1/rules:
    parameters: []
    get:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Get Rules
      description: This API operation retrieves Prometheus alerting and recording rules from a Grafana instance and converts them into a standardized configuration format. When a GET request is made to the /convert/prometheus/config/v1/rules endpoint, it fetches the existing Prometheus-style rules configured within Grafana and transforms them into a version 1 configuration schema, making it easier to migrate, backup, or integrate these rules with other systems or Prometheus instances. This is particularly useful for administrators who need to export their Grafana-managed Prometheus rules or maintain consistency across multiple monitoring environments.
      operationId: routeConvertPrometheusGetRules
      parameters: []
      responses:
        '200':
          description: PrometheusNamespace
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
        '404':
          description: NotFound
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
    post:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Post Rule Groups
      description: This API operation converts Prometheus rule group configurations to Grafana's format via a POST request to the /convert/prometheus/config/v1/rules endpoint. It accepts Prometheus-formatted rule groups as input and transforms them into a compatible format that can be used within Grafana's alerting and recording rule system, facilitating migration or integration between Prometheus and Grafana monitoring setups.
      operationId: routeConvertPrometheusPostRuleGroups
      parameters:
      - name: Content-Type
        in: header
        description: ''
        required: true
        schema:
          const: application/json
          type: string
      responses:
        '202':
          description: ConvertPrometheusResponse
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConvertPrometheusResponse'
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
  /convert/prometheus/config/v1/rules/{NamespaceTitle}:
    parameters: []
    get:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Get Namespace
      description: This API operation retrieves and converts Prometheus alerting and recording rules from a specific namespace within Grafana. By making a GET request to the endpoint with a specified namespace title, it fetches the Prometheus rule configuration for that namespace and converts it into a format compatible with Grafana's alerting system. This is particularly useful when migrating from Prometheus-based alerting to Grafana's unified alerting system, allowing users to import existing Prometheus rule definitions while maintaining their organizational structure by namespace. The operation returns the converted rule configuration that can then be used within Grafana's alert management interface.
      operationId: routeConvertPrometheusGetNamespace
      parameters:
      - name: NamespaceTitle
        in: path
        description: ''
        required: true
        schema:
          type: string
      responses:
        '200':
          description: PrometheusNamespace
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
        '404':
          description: NotFound
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
    post:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Post Rule Group
      description: This API operation converts Prometheus rule group configurations to Grafana's native format by accepting a POST request to the endpoint /convert/prometheus/config/v1/rules/{NamespaceTitle}, where {NamespaceTitle} represents the target namespace for the rule group. It takes Prometheus-formatted alerting and recording rules as input and transforms them into Grafana-compatible rule configurations, facilitating migration or integration between Prometheus and Grafana alerting systems. The operation allows users to seamlessly transfer their existing Prometheus rule definitions into Grafana without manual reconfiguration, preserving the rule logic, labels, annotations, and evaluation intervals while adapting them to Grafana's rule management structure.
      operationId: routeConvertPrometheusPostRuleGroup
      parameters:
      - name: NamespaceTitle
        in: path
        description: ''
        required: true
        schema:
          type: string
      - name: x-grafana-alerting-datasource-uid
        in: header
        description: ''
        schema:
          type: string
      - name: x-grafana-alerting-recording-rules-paused
        in: header
        description: ''
        schema:
          type: boolean
      - name: x-grafana-alerting-alert-rules-paused
        in: header
        description: ''
        schema:
          type: boolean
      - name: x-grafana-alerting-target-datasource-uid
        in: header
        description: ''
        schema:
          type: string
      - name: x-grafana-alerting-folder-uid
        in: header
        description: ''
        schema:
          type: string
      - name: x-grafana-alerting-notification-settings
        in: header
        description: ''
        schema:
          type: string
      requestBody:
        description: ''
        content:
          application/yaml:
            schema:
              $ref: '#/components/schemas/PrometheusRuleGroup'
        required: false
      responses:
        '202':
          description: ConvertPrometheusResponse
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConvertPrometheusResponse'
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
    delete:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Delete Namespace
      description: Deletes a Prometheus rule namespace configuration in Grafana's conversion API. This operation removes all rules associated with the specified namespace by its title, effectively cleaning up converted Prometheus alerting and recording rules that were previously imported or managed through the conversion endpoint. The route is part of Grafana's Prometheus configuration conversion functionality, allowing administrators to manage the lifecycle of converted rule namespaces programmatically.
      operationId: routeConvertPrometheusDeleteNamespace
      parameters:
      - name: NamespaceTitle
        in: path
        description: ''
        required: true
        schema:
          type: string
      responses:
        '202':
          description: ConvertPrometheusResponse
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConvertPrometheusResponse'
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
  /convert/prometheus/config/v1/rules/{NamespaceTitle}/{Group}:
    parameters: []
    get:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Get Rule Group
      description: This API operation retrieves and converts a Prometheus rule group configuration from a specific namespace in Grafana. It accepts GET requests at the endpoint path that includes both the namespace title and group name as path parameters, allowing users to fetch the configuration details of a particular Prometheus alerting or recording rule group. The operation is part of Grafana's conversion utilities that help transform Prometheus-native rule configurations into Grafana's internal format or vice versa, facilitating migration and management of alerting rules across different monitoring system configurations.
      operationId: routeConvertPrometheusGetRuleGroup
      parameters:
      - name: NamespaceTitle
        in: path
        description: ''
        required: true
        schema:
          type: string
      - name: Group
        in: path
        description: ''
        required: true
        schema:
          type: string
      responses:
        '200':
          description: PrometheusRuleGroup
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
        '404':
          description: NotFound
          headers: {}
          content:
            application/yaml:
              schema:
                contentMediaType: application/yaml
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
    delete:
      tags:
      - Convert
      summary: Grafana Route Convert Prometheus Delete Rule Group
      description: This API operation is used to delete a Prometheus rule group from a specific namespace in Grafana's configuration. It targets a particular rule group identified by both the namespace title and group name through the URL path parameters. When invoked with a DELETE HTTP method, it removes the specified rule group configuration from the Prometheus-compatible alerting and recording rules system within Grafana, effectively cleaning up rules that are no longer needed or are being replaced.
      operationId: routeConvertPrometheusDeleteRuleGroup
      parameters:
      - name: NamespaceTitle
        in: path
        description: ''
        required: true
        schema:
          type: string
      - name: Group
        in: path
        description: ''
        required: true
        schema:
          type: string
      responses:
        '202':
          description: ConvertPrometheusResponse
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConvertPrometheusResponse'
        '403':
          description: ForbiddenError
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
      deprecated: false
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
components:
  schemas:
    PrometheusRule:
      title: PrometheusRule
      type: object
      properties:
        alert:
          type: string
        annotations:
          type: object
          additionalProperties:
            type: string
        expr:
          type: string
        for:
          type: string
        keep_firing_for:
          type: string
        labels:
          type: object
          additionalProperties:
            type: string
        record:
          type: string
    PrometheusRuleGroup:
      title: PrometheusRuleGroup
      type: object
      properties:
        interval:
          type: integer
          description: 'A Duration represents the elapsed time between two instants

            as an int64 nanosecond count. The representation limits the

            largest representable duration to approximately 290 years.'
          contentEncoding: int64
        labels:
          type: object
          additionalProperties:
            type: string
        limit:
          type: integer
          contentEncoding: int64
        name:
          type: string
        query_offset:
          type: string
        rules:
          type: array
          items:
            $ref: '#/components/schemas/PrometheusRule'
          description: ''
    ConvertPrometheusResponse:
      title: ConvertPrometheusResponse
      type: object
      properties:
        error:
          type: string
        errorType:
          type: string
        status:
          type: string
    PublicError:
      title: PublicError
      type: object
      properties:
        extra:
          type: object
          additionalProperties: {}
        message:
          type: string
        messageId:
          type: string
        statusCode:
          type: integer
          contentEncoding: int64
      description: 'PublicError is derived from Error and only contains information

        available to the end user.'
    ForbiddenError:
      title: ForbiddenError
      type: object
      properties:
        body:
          allOf:
          - $ref: '#/components/schemas/PublicError'
          - description: 'PublicError is derived from Error and only contains information

              available to the end user.'
  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>'