Data Sources API
The Data Sources API provides endpoints for managing data source configurations in Grafana.Get All Data Sources
Retrieve all data sources for the current organization.integer
Data source internal ID
string
Data source unique identifier
string
Data source name
string
Data source type (e.g., “prometheus”, “mysql”, “postgres”)
string
Access mode: “proxy” (via Grafana backend) or “direct” (from browser)
string
Data source URL
boolean
Whether this is the default data source
Get Data Source by UID
Retrieve a single data source by its UID.string
required
Data source unique identifier
Create Data Source
Create a new data source.string
required
Data source name
string
required
Data source type (e.g., “prometheus”, “mysql”, “postgres”)
string
required
Data source URL
string
default:"proxy"
Access mode: “proxy” or “direct”
string
Database name (for database data sources)
string
Database user (for database data sources)
boolean
default:"false"
Enable basic authentication
string
Basic auth username
boolean
default:"false"
Set as default data source
object
Additional data source configuration (varies by type)
object
Update Data Source by UID
Update an existing data source.string
required
Data source unique identifier
Delete Data Source by UID
Delete a data source by its UID.string
required
Data source unique identifier
Get Data Source by Name
Retrieve a data source by its name.string
required
Data source name
This endpoint is deprecated. Use the UID-based endpoint instead.
Get Data Source ID by Name
Retrieve a data source ID by its name.string
required
Data source name
This endpoint is deprecated. Use the UID-based endpoint instead.
Check Data Source Health
Send a health check request to a data source.string
required
Data source unique identifier
string
Health status: “OK”, “ERROR”, or “UNKNOWN”
string
Health check message
object
Additional health check details (optional)
Permissions
If you are running Grafana Enterprise with Fine-grained access control enabled:- Read: Requires
datasources:readpermission - Create: Requires
datasources:createpermission - Update: Requires
datasources:writepermission with scopedatasources:uid:<uid> - Delete: Requires
datasources:deletepermission with scopedatasources:uid:<uid> - Query: Requires
datasources:querypermission with scopedatasources:uid:<uid>