Grafana Data Sources API

Manage data source connections

Operations 7

GET /datasources List all data sources #
POST /datasources Create a data source #
GET /datasources/{id} Get data source by ID #
PUT /datasources/{id} Update data source by ID #
DELETE /datasources/{id} Delete data source by ID #
GET /datasources/uid/{uid} Get data source by UID #
DELETE /datasources/proxy/{id}/{datasource_proxy_route} Grafana Datasource Proxy DELET Ecalls #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/grafana-data-sources-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

grafana-data-sources-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Grafana Data Sources API
  version: '1.0'
  description: 'Operations tagged Data Sources across 2 of this provider''s published API definitions: grafana-api.yml, grafana-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://{instance}.grafana.net/api
  description: Grafana Cloud
  variables:
    instance:
      default: your-instance
- url: http://localhost:3000/api
  description: Local Grafana instance
- url: http://{defaultHost}
  variables:
    defaultHost:
      default: www.example.com/api
- url: https://{defaultHost}
  variables:
    defaultHost:
      default: www.example.com/api
tags:
- name: Data Sources
  description: Manage data source connections
paths:
  /datasources:
    get:
      tags:
      - Data Sources
      operationId: getDataSources
      summary: List all data sources
      responses:
        '200':
          description: Data sources list
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DataSource'
      security:
      - BearerAuth: []
      - BasicAuth: []
      - ApiKeyAuth: []
    post:
      tags:
      - Data Sources
      operationId: createDataSource
      summary: Create a data source
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDataSourceCommand'
      responses:
        '200':
          description: Data source created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataSource'
        '409':
          description: Data source with same name already exists
      security:
      - BearerAuth: []
      - BasicAuth: []
      - ApiKeyAuth: []
    servers:
    - url: https://{instance}.grafana.net/api
      description: Grafana Cloud
      variables:
        instance:
          default: your-instance
    - url: http://localhost:3000/api
      description: Local Grafana instance
  /datasources/{id}:
    get:
      tags:
      - Data Sources
      operationId: getDataSourceById
      summary: Get data source by ID
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: Data source found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataSource'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
      - BearerAuth: []
      - BasicAuth: []
      - ApiKeyAuth: []
    put:
      tags:
      - Data Sources
      operationId: updateDataSource
      summary: Update data source by ID
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDataSourceCommand'
      responses:
        '200':
          description: Data source updated
      security:
      - BearerAuth: []
      - BasicAuth: []
      - ApiKeyAuth: []
    delete:
      tags:
      - Data Sources
      operationId: deleteDataSourceById
      summary: Delete data source by ID
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: Data source deleted
      security:
      - BearerAuth: []
      - BasicAuth: []
      - ApiKeyAuth: []
    servers:
    - url: https://{instance}.grafana.net/api
      description: Grafana Cloud
      variables:
        instance:
          default: your-instance
    - url: http://localhost:3000/api
      description: Local Grafana instance
  /datasources/uid/{uid}:
    get:
      tags:
      - Data Sources
      operationId: getDataSourceByUid
      summary: Get data source by UID
      parameters:
      - name: uid
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Data source found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataSource'
      security:
      - BearerAuth: []
      - BasicAuth: []
      - ApiKeyAuth: []
    servers:
    - url: https://{instance}.grafana.net/api
      description: Grafana Cloud
      variables:
        instance:
          default: your-instance
    - url: http://localhost:3000/api
      description: Local Grafana instance
  /datasources/proxy/{id}/{datasource_proxy_route}:
    parameters: []
    delete:
      tags:
      - Data Sources
      summary: Grafana Datasource Proxy DELET Ecalls
      description: The Datasource Proxy DELETE operation in Grafana allows users to send HTTP DELETE requests to a configured datasource through Grafana's proxy endpoint by specifying the datasource ID and the target route path. This API endpoint follows the pattern /datasources/proxy/{id}/{datasource_proxy_route} where {id} represents the unique identifier of the datasource and {datasource_proxy_route} is the specific path on the target datasource that should receive the DELETE request. This proxying mechanism enables Grafana to act as an intermediary, handling authentication, authorization, and secure communication with the underlying datasource while allowing users to perform delete operations on datasource-specific resources without directly exposing the datasource endpoints.
      operationId: datasourceProxyDELETEcalls
      parameters:
      - name: id
        in: path
        description: ''
        required: true
        schema:
          type: string
      - name: datasource_proxy_route
        in: path
        description: ''
        required: true
        schema:
          type: string
      responses:
        '202':
          description: (empty)
          headers: {}
          content: {}
        '400':
          description: BadRequestError is returned when the request is invalid and it cannot be processed.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseBody'
        '401':
          description: UnauthorizedError is returned when the request is not authenticated.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseBody'
        '403':
          description: ForbiddenError is returned if the user/token has insufficient permissions to access the requested resource.
          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: true
      x-api-evangelist-processing:
        SplitPascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        WriteDescription: true
        ChooseTags: true
      security:
      - basic: []
      - api_key: []
    servers:
    - url: http://{defaultHost}
      variables:
        defaultHost:
          default: www.example.com/api
    - url: https://{defaultHost}
      variables:
        defaultHost:
          default: www.example.com/api
components:
  responses:
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  schemas:
    CreateDataSourceCommand:
      type: object
      required:
      - name
      - type
      - access
      properties:
        name:
          type: string
        type:
          type: string
        access:
          type: string
          enum:
          - proxy
          - direct
        url:
          type: string
        user:
          type: string
        database:
          type: string
        basicAuth:
          type: boolean
        basicAuthUser:
          type: string
        withCredentials:
          type: boolean
        isDefault:
          type: boolean
        jsonData:
          type: object
        secureJsonData:
          type: object
          description: Sensitive fields sent on create/update only
        uid:
          type: string
    DataSource:
      type: object
      properties:
        id:
          type: integer
        uid:
          type: string
        orgId:
          type: integer
        name:
          type: string
        type:
          type: string
          description: Plugin type, e.g. prometheus, mysql, elasticsearch, loki, influxdb, postgres, graphite, cloudwatch
        typeName:
          type: string
        typeLogoUrl:
          type: string
        access:
          type: string
          enum:
          - proxy
          - direct
        url:
          type: string
        user:
          type: string
        database:
          type: string
        basicAuth:
          type: boolean
        basicAuthUser:
          type: string
        withCredentials:
          type: boolean
        isDefault:
          type: boolean
        jsonData:
          type: object
          description: Data-source-specific configuration
        secureJsonFields:
          type: object
          description: Encrypted fields indicator
        readOnly:
          type: boolean
        version:
          type: integer
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
        status:
          type: string
    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>'
    api_key:
      type: apiKey
      name: Authorization
      in: header
    basic:
      type: http
      scheme: basic
x-refined-from:
- grafana-api.yml
- grafana-openapi.yml