Introduction
Exporting Grafana dashboards allows you to share visualizations, back up configurations, or migrate between environments. Export failures can occur due to permission issues, API errors, or format problems. Understanding how to properly export dashboards and troubleshoot failures ensures you can reliably share and backup your monitoring configurations.
Symptoms
- Export button shows "Failed to export dashboard" or no action
- Exported JSON file is incomplete or missing panels
- Error: "Permission denied" when attempting export
- Exported dashboard references internal IDs that won't work in other Grafana instances
- Export API returns 403 Forbidden or 500 Internal Server Error
- Export includes sensitive data that shouldn't be shared
Common Causes
- User lacks read permission on the dashboard
- Dashboard has too many panels causing export timeout
- API endpoint is blocked or misconfigured
- Export format includes internal IDs instead of UIDs
- Dashboard contains sensitive annotations or variables
- Browser download is blocked by security settings
Step-by-Step Fix
Permission Issues
- 1.Check user permissions on the dashboard:
- 2.```bash
- 3.curl -s -u admin:password http://localhost:3000/api/dashboards/uid/dashboard-uid | jq '.meta | {canView: .canView, canSave: .canSave, canEdit: .canEdit}'
- 4.
` - 5.Verify user has at least Viewer role:
- 6.- Navigate to Configuration > Users
- 7.- Check user's organization role
- 8.- Check dashboard folder permissions
- 9.Grant export permissions:
- 10.```bash
- 11.curl -X POST -u admin:password \
- 12.-H "Content-Type: application/json" \
- 13.-d '{"userId": 2, "permission": 1}' \
- 14.http://localhost:3000/api/dashboards/uid/dashboard-uid/permissions
- 15.
`
Export via UI
- 1.Standard export process:
- 2.- Open the dashboard you want to export
- 3.- Click the gear icon (Dashboard settings)
- 4.- Click "JSON Model" or "Export"
- 5.- Click "Copy to clipboard" or "Download JSON"
- 6.- Save the file
- 7.For sharing dashboards externally:
- 8.- Click "Share" > "Export"
- 9.- Enable "Export for external use"
- 10.- This removes internal IDs and uses datasource names instead of UIDs
Export via API
- 1.Export dashboard JSON via API:
- 2.```bash
- 3.curl -s -u admin:password \
- 4.http://localhost:3000/api/dashboards/uid/dashboard-uid | jq '.dashboard' > dashboard-export.json
- 5.
` - 6.Export all dashboards:
- 7.```bash
- 8.# List all dashboards
- 9.curl -s -u admin:password http://localhost:3000/api/search?type=dash-db | jq '.[] | .uid'
# Export each dashboard for uid in $(curl -s -u admin:password http://localhost:3000/api/search?type=dash-db | jq -r '.[] | .uid'); do curl -s -u admin:password http://localhost:3000/api/dashboards/uid/$uid | jq '.dashboard' > dashboard-${uid}.json done ```
- 1.Export dashboards in a folder:
- 2.```bash
- 3.curl -s -u admin:password "http://localhost:3000/api/search?type=dash-db&folderUid=folder-uid" | jq '.[] | .uid'
- 4.
`
Export Format Issues
- 1.Check for problematic datasource references:
- 2.```bash
- 3.jq '.panels[] | .datasource' dashboard-export.json
- 4.
` - 5.Ensure datasource references use UIDs, not IDs:
- 6.```json
- 7.// Correct format
- 8."datasource": {
- 9."type": "prometheus",
- 10."uid": "prometheus-uid"
- 11.}
// Incorrect format (internal ID) "datasource": { "id": 1, "name": "Prometheus" } ```
- 1.Fix datasource references:
- 2.```bash
- 3.# Remove internal datasource IDs
- 4.jq 'walk(if type == "object" and has("datasource") then del(.datasource.id) else . end)' dashboard-export.json > dashboard-clean.json
- 5.
`
Clean Export for Sharing
- 1.Remove sensitive data from export:
- 2.```bash
- 3.# Remove annotations that might contain sensitive data
- 4.jq 'del(.annotations.list)' dashboard-export.json > dashboard-clean.json
# Remove template variables with sensitive defaults jq 'del(.templating.list[].current)' dashboard-export.json > dashboard-clean.json ```
- 1.Prepare export for external Grafana:
- 2.- In the UI, use "Export for external use" option
- 3.- This converts datasource UIDs to names
- 4.- Removes internal Grafana references
Bulk Export Issues
- 1.For dashboards with many panels, increase API timeout:
- 2.```ini
- 3.# In grafana.ini
- 4.[server]
- 5.read_timeout = 60
- 6.write_timeout = 60
- 7.
` - 8.Export large dashboards via CLI or script:
- 9.```bash
- 10.# Use jq to extract just the dashboard definition
- 11.curl -s -u admin:password http://localhost:3000/api/dashboards/uid/$uid | \
- 12.jq '{dashboard: .dashboard, meta: {}}' > export.json
- 13.
`
Export Provisioning Format
- 1.Export in provisioning-compatible format:
- 2.```json
- 3.{
- 4."apiVersion": 1,
- 5."dashboard": {
- 6.// dashboard JSON content
- 7.}
- 8.}
- 9.
` - 10.Create provisioning file:
- 11.```bash
- 12.curl -s -u admin:password http://localhost:3000/api/dashboards/uid/$uid | \
- 13.jq '{apiVersion: 1, dashboard: .dashboard}' > provisioning/dashboards/dashboard.json
- 14.
`
Verification
- 1.Validate exported dashboard JSON:
- 2.```bash
- 3.python3 -c "import json; json.load(open('dashboard-export.json'))"
- 4.
` - 5.Verify dashboard structure is complete:
- 6.```bash
- 7.jq '.panels | length' dashboard-export.json
- 8.jq '.templating.list | length' dashboard-export.json
- 9.
` - 10.Test import in another Grafana instance:
- 11.- Import the exported JSON file
- 12.- Verify all panels load correctly
- 13.- Confirm datasource references are resolved
- 14.Check for sensitive data leaks:
- 15.```bash
- 16.grep -i "password|secret|token|key" dashboard-export.json
- 17.
`