openapi: 3.0.3 info: title: Grafana HTTP Access Data Sources 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: 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' 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 /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' 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 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 /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' /datasources/proxy/uid/{uid}/{datasource_proxy_route}: parameters: [] get: tags: - Data Sources summary: Grafana Datasource Proxy GET By UID Calls description: This API operation performs a GET request to proxy datasource calls through Grafana using a datasource's unique identifier (UID). It forwards requests to the configured datasource via the specified proxy route, allowing Grafana to act as an intermediary between the client and the actual datasource. The operation uses the path pattern '/datasources/proxy/uid/{uid}/{datasource_proxy_route}' where {uid} identifies the specific datasource and {datasource_proxy_route} represents the downstream API path to be called on that datasource. This proxying mechanism enables secure datasource access while maintaining Grafana's authentication and authorization controls, eliminating the need for clients to have direct access to datasource credentials or endpoints. operationId: datasourceProxyGETByUIDcalls parameters: - name: datasource_proxy_route in: path description: '' required: true schema: type: string - name: uid in: path description: '' required: true schema: type: string responses: '200': 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: false x-api-evangelist-processing: SplitPascalCaseOperationSummaries: true CaselCaseOperationIds: true WriteDescription: true ChooseTags: true post: tags: - Data Sources summary: Grafana Datasource Proxy POST By UID Calls description: This API operation enables POST requests to be proxied through Grafana to a configured datasource identified by its unique identifier (UID). The endpoint acts as an intermediary, forwarding requests from the Grafana UI to the target datasource using the specified proxy route path. This allows Grafana to securely communicate with various datasources without exposing their direct endpoints to clients, while maintaining authentication and authorization controls. The datasource_proxy_route parameter provides flexibility to target specific endpoints or paths within the datasource's API, making it particularly useful for executing queries, sending data, or performing operations that require POST method semantics through Grafana's unified interface. operationId: datasourceProxyPOSTByUIDcalls parameters: - name: datasource_proxy_route in: path description: '' required: true schema: type: string - name: uid in: path description: '' required: true schema: type: string requestBody: description: '' content: text/plain: schema: contentMediaType: text/plain required: true responses: '201': description: (empty) headers: {} content: {} '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: false x-api-evangelist-processing: SplitPascalCaseOperationSummaries: true CaselCaseOperationIds: true WriteDescription: true ChooseTags: true delete: tags: - Data Sources summary: Grafana Datasource Proxy DELETE By UID Calls description: This API operation performs a DELETE request to a Grafana datasource through the proxy endpoint, utilizing the datasource's unique identifier (UID) and a specific proxy route. It allows clients to make DELETE operations against the underlying datasource via Grafana's proxy layer, which handles authentication, authorization, and request routing. The operation is typically invoked by Grafana's user interface to delete resources or data from configured datasources without direct client access to the datasource itself. The UID parameter identifies the specific datasource configuration in Grafana, while the datasource_proxy_route defines the target path within that datasource's API structure. operationId: datasourceProxyDELETEByUIDcalls parameters: - name: uid 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: false x-api-evangelist-processing: SplitPascalCaseOperationSummaries: true CaselCaseOperationIds: true WriteDescription: true ChooseTags: true /datasources/proxy/{id}/{datasource_proxy_route}: parameters: [] get: tags: - Data Sources summary: Grafana Datasource Proxy GET calls description: This API operation provides a proxy endpoint for executing GET requests against a configured datasource in Grafana. By specifying the datasource ID and a custom proxy route, it allows Grafana to forward requests to the underlying data source while handling authentication, CORS, and other middleware concerns transparently. This is particularly useful for querying data sources that may have complex authentication requirements or need to be accessed from the browser without exposing credentials, as Grafana acts as an intermediary that securely manages the connection to the data source and returns the results to the client. operationId: datasourceProxyGETcalls parameters: - name: datasource_proxy_route in: path description: '' required: true schema: type: string - name: id in: path description: '' required: true schema: type: string responses: '200': 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 post: tags: - Data Sources summary: Grafana Datasource Proxy POST Calls description: The Grafana datasource proxy POST operation allows users to send POST requests to a configured datasource through Grafana's proxy endpoint by specifying the datasource ID and the target route. This API call acts as an intermediary that forwards HTTP POST requests to the underlying datasource while handling authentication, connection management, and security concerns on behalf of the client. The endpoint accepts a datasource identifier in the path along with a dynamic route parameter that determines the specific datasource endpoint to be invoked, enabling users to interact with various datasource APIs such as querying data, executing commands, or performing write operations without directly exposing datasource credentials or connection details to the frontend application. operationId: datasourceProxyPOSTcalls parameters: - name: datasource_proxy_route in: path description: '' required: true schema: type: string - name: id in: path description: '' required: true schema: type: string requestBody: description: '' content: text/plain: schema: contentMediaType: text/plain required: true responses: '201': description: (empty) headers: {} content: {} '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 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 /datasources/uid/{uid}/health: parameters: [] get: tags: - Data Sources summary: Grafana Check Datasource Health With UID description: This API operation performs a health check on a specific Grafana datasource identified by its unique identifier (UID). When invoked via a GET request to the endpoint '/datasources/uid/{uid}/health', it verifies the connectivity and operational status of the datasource, returning information about whether the datasource is accessible and functioning correctly. This is useful for monitoring and troubleshooting datasource configurations, allowing administrators to quickly determine if a particular datasource is available and responding as expected without needing to know the datasource's internal ID, instead using the more user-friendly UID reference. operationId: checkDatasourceHealthWithUID parameters: - name: uid in: path description: '' required: true schema: type: string responses: '200': description: An OKResponse is returned if the request was successful. headers: {} content: application/json: schema: $ref: '#/components/schemas/SuccessResponseBody' '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' '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/{uid}/resources/{datasource_proxy_route}: parameters: [] get: tags: - Data Sources summary: Grafana Call Datasource Resource With UID description: This API operation enables clients to interact with a specific datasource in Grafana by making GET requests to custom resource endpoints exposed by that datasource. It uses the datasource's unique identifier (UID) rather than its numeric ID to route requests through Grafana's proxy to the underlying datasource's resource paths. The operation accepts a variable datasource_proxy_route parameter that allows accessing different resource endpoints specific to the datasource type, effectively acting as a proxy layer that handles authentication and request forwarding while maintaining Grafana's security context. This is particularly useful for datasource plugins that expose additional REST endpoints beyond standard query interfaces, allowing frontend applications to fetch metadata, configuration options, or other supplementary data from the datasource through Grafana's unified API. operationId: callDatasourceResourceWithUID parameters: - name: datasource_proxy_route in: path description: '' required: true schema: type: string - name: uid in: path description: '' required: true schema: type: string responses: '200': description: An OKResponse is returned if the request was successful. headers: {} content: application/json: schema: $ref: '#/components/schemas/SuccessResponseBody' '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: false x-api-evangelist-processing: SplitPascalCaseOperationSummaries: true CaselCaseOperationIds: true WriteDescription: true ChooseTags: true /datasources/{id}/health: parameters: [] get: tags: - Data Sources summary: Grafana Check Datasource Health By ID description: Sends a health check request to the data source identified by its numeric ID and returns the current operational status. This endpoint verifies whether Grafana can successfully connect to and communicate with the specified data source, helping administrators diagnose connectivity issues or validate data source configurations. The response typically includes status information indicating whether the data source is reachable and functioning properly, along with any relevant error messages if the health check fails. operationId: checkDatasourceHealthByID parameters: - name: id in: path description: '' required: true schema: type: string responses: '200': description: An OKResponse is returned if the request was successful. headers: {} content: application/json: schema: $ref: '#/components/schemas/SuccessResponseBody' '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' '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 /datasources/{id}/resources/{datasource_proxy_route}: parameters: [] get: tags: - Data Sources summary: Grafana Call Datasource Resource By ID description: This API operation allows you to make GET requests to a specific Grafana datasource's custom resources by providing the datasource ID and a resource route path. It acts as a proxy that forwards requests to the underlying datasource plugin's resource handler, enabling access to datasource-specific endpoints and functionality that may not be covered by standard Grafana APIs. The datasource_proxy_route parameter is a wildcard path that gets passed through to the datasource's backend, allowing flexible interaction with various datasource capabilities such as querying metadata, retrieving schema information, or accessing custom features exposed by the particular datasource plugin. operationId: callDatasourceResourceByID parameters: - name: datasource_proxy_route in: path description: '' required: true schema: type: string - name: id in: path description: '' required: true schema: type: string responses: '200': description: An OKResponse is returned if the request was successful. headers: {} content: application/json: schema: $ref: '#/components/schemas/SuccessResponseBody' '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 components: schemas: ErrorResponse: type: object properties: message: type: string status: type: string 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 SuccessResponseBody: title: SuccessResponseBody type: object properties: message: 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.' responses: NotFound: description: Resource not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' 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 '