URL configuration
The Infinity data source supports advanced URL configuration options including HTTP methods, custom headers, query parameters, and request bodies. Use these options to connect to any REST API or web endpoint.
Before you begin
- Ensure you have the Infinity data source installed and configured
- Know the API endpoint requirements (authentication, headers, body format)
Configure URL options
In the query editor, click the expand icon next to the URL field to access advanced options.
HTTP methods
Note
PUT, PATCH, and DELETE methods are considered dangerous and must be enabled by an administrator in the data source configuration.
Query parameters
Add query parameters that will be appended to the URL. Each parameter has a key and value.
Request headers
Add custom headers to send with the request. Each header has a key and value.
Request body
For POST, PUT, and PATCH requests, configure the request body:
Content types for raw body:
Variables in URLs
Use Grafana variables in your URL to create dynamic queries. This includes global variables and dashboard variables.
Example:
https://api.example.com/data?from=${__from:date:YYYY-MM-DD}&to=${__to:date:YYYY-MM-DD}Result:
https://api.example.com/data?from=2024-01-01&to=2024-01-31For more information about available variables, refer to Macros.
Secure keys in URLs
For API keys or tokens that must be included in URLs, use the secure key configuration in the data source settings instead of hardcoding them in queries.
- Navigate to the data source configuration.
- In the Authentication section, configure your API key.
- Select whether to send the key as a Header or Query parameter.
- Enter the key name and value.
The key value is stored securely and not exposed in dashboards or query logs.
Custom headers
Configure headers in two locations:
Default headers:
The Infinity data source automatically sets these headers:
User-Agent: Go-http-client/1.1Content-Type: application/json(for JSON requests)
You can override these defaults in the data source configuration.
Note
Add secure or sensitive headers only in the data source configuration, not in individual queries.
Grafana metadata headers
Forward Grafana metadata to your API using macros in custom headers or query parameters.
Warning
User macros (
${__user.*}) are not available in alerts, recorded queries, or public dashboards because there is no user context in these scenarios.
Allowed hosts
Allowed hosts restrict which URLs the Infinity data source can connect to. When authentication, custom headers, or TLS certificates are configured, allowed hosts are required. If none of these features are in use and no allowed hosts are specified, all hosts are allowed by default.
To configure allowed hosts:
- Navigate to the data source configuration.
- In the Network section, add allowed host names.
- Save the configuration.
Requirements:
- Host names are case-sensitive
- Use the full host name including protocol (for example,
https://api.example.com) - Multiple hosts can be configured
When allowed hosts are configured, queries to other hosts are blocked.



