Grafana Elements API

The Elements API from Grafana — 1 operation(s) for elements.

OpenAPI Specification

grafana-elements-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Grafana HTTP Access Elements 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: Elements
paths:
  /library-elements:
    parameters: []
    get:
      tags:
      - Elements
      summary: Grafana Get Library Elements
      description: This API operation retrieves library elements from Grafana, which are reusable components such as panels or variables that can be shared across multiple dashboards. When called, it returns a list of library elements available in the Grafana instance, allowing users to query and fetch these shared resources for dashboard creation or management purposes. The GET request to the /library-elements endpoint provides access to the library element catalog, enabling efficient reuse of dashboard components across an organization's Grafana environment.
      operationId: getLibraryElements
      parameters:
      - name: searchString
        in: query
        description: Part of the name or description searched for.
        style: form
        explode: true
        schema:
          type: string
      - name: kind
        in: query
        description: Kind of element to search for.
        style: form
        explode: true
        schema:
          type: integer
          contentEncoding: int64
      - name: sortDirection
        in: query
        description: Sort order of elements.
        style: form
        explode: true
        schema:
          allOf:
          - $ref: '#/components/schemas/sortDirection'
          - description: Sort order of elements.
      - name: typeFilter
        in: query
        description: A comma separated list of types to filter the elements by
        style: form
        explode: true
        schema:
          type: string
      - name: excludeUid
        in: query
        description: Element UID to exclude from search results.
        style: form
        explode: true
        schema:
          type: string
      - name: folderFilter
        in: query
        description: A comma separated list of folder ID(s) to filter the elements by.
        style: form
        explode: true
        schema:
          type: string
      - name: perPage
        in: query
        description: The number of results per page.
        style: form
        explode: true
        schema:
          type: integer
          contentEncoding: int64
          default: 100
      - name: page
        in: query
        description: The page for a set of records, given that only perPage records are returned at a time. Numbering starts at 1.
        style: form
        explode: true
        schema:
          type: integer
          contentEncoding: int64
          default: 1
      responses:
        '200':
          description: (empty)
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LibraryElementSearchResponseisaresponsestructforLibraryElementSearchResult.'
        '401':
          description: UnauthorizedError is returned when the request is not authenticated.
          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:
    LibraryElementDTOisthefrontendDTOforentities.:
      title: LibraryElementDTOisthefrontendDTOforentities.
      type: object
      properties:
        description:
          type: string
        folderId:
          type: integer
          description: 'Deprecated: use FolderUID instead'
          contentEncoding: int64
        folderUid:
          type: string
        id:
          type: integer
          contentEncoding: int64
        kind:
          type: integer
          contentEncoding: int64
        meta:
          $ref: '#/components/schemas/LibraryElementDTOMetaisthemetainformationforLibraryElementDTO.'
        model:
          type: object
        name:
          type: string
        orgId:
          type: integer
          contentEncoding: int64
        schemaVersion:
          type: integer
          contentEncoding: int64
        type:
          type: string
        uid:
          type: string
        version:
          type: integer
          contentEncoding: int64
    LibraryElementSearchResponseisaresponsestructforLibraryElementSearchResult.:
      title: LibraryElementSearchResponseisaresponsestructforLibraryElementSearchResult.
      type: object
      properties:
        result:
          $ref: '#/components/schemas/LibraryElementSearchResultisthesearchresultforentities.'
    LibraryElementDTOMetaisthemetainformationforLibraryElementDTO.:
      title: LibraryElementDTOMetaisthemetainformationforLibraryElementDTO.
      type: object
      properties:
        connectedDashboards:
          type: integer
          contentEncoding: int64
        created:
          type: string
          contentEncoding: date-time
        createdBy:
          $ref: '#/components/schemas/LibraryElementDTOMetaUser'
        folderName:
          type: string
        folderUid:
          type: string
        updated:
          type: string
          contentEncoding: date-time
        updatedBy:
          $ref: '#/components/schemas/LibraryElementDTOMetaUser'
    LibraryElementDTOMetaUser:
      title: LibraryElementDTOMetaUser
      type: object
      properties:
        avatarUrl:
          type: string
        id:
          type: integer
          contentEncoding: int64
        name:
          type: string
    LibraryElementSearchResultisthesearchresultforentities.:
      title: LibraryElementSearchResultisthesearchresultforentities.
      type: object
      properties:
        elements:
          type: array
          items:
            $ref: '#/components/schemas/LibraryElementDTOisthefrontendDTOforentities.'
          description: ''
        page:
          type: integer
          contentEncoding: int64
        perPage:
          type: integer
          contentEncoding: int64
        totalCount:
          type: integer
          contentEncoding: int64
    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.'
    sortDirection:
      title: sortDirection
      enum:
      - alpha-asc
      - alpha-desc
      type: string
  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>'