Hi There, i need to connect to a json API and the authentication method is with the header X-Token and the key, i can’t seem to see a way to do this with the infinity connector currently, just wondering if anyone else has had a issue with this before?
Welcome @alexking1 to the community
This is fully supported in Infinity → use the API Key authentication method which handles any custom header including X-Token.
Via UI:
- Go to Connections → Data sources → your Infinity datasource → Settings
- Under Authentication → select API Key Value pair
- Configure:
| Field | Value |
|---|---|
| Key | X-Token |
| Value | your-api-key-here |
| Add to | header |
- Click Save & test
Via Provisioning YAML:
yaml
apiVersion: 1
datasources:
- name: MyAPI
type: yesoreyeram-infinity-datasource
jsonData:
httpHeaderName1: "X-Token"
secureJsonData:
httpHeaderValue1: "your-api-key-here"
Use secureJsonData for the header value to keep it encrypted.
You don’t need a special X-Token option → the API Key method already does this
So the actual HTTP request Grafana sends becomes:
GET https://your-api.com/data
X-Token: abc123
The API Key auth method handles any custom header → not just standard API keys. The Key field becomes your header name (X-Token), Value becomes your token, and In: header sends it with every request.
Thanks this is really helpful - i also need to add in --location prior to the get URL as a query parameter how best do you think this is done?
Could you share the full CURL command you’re working from?
--location in CURL typically means follow redirects rather than a query parameter, so just want to confirm
What vendor is this api for? Please share their documentation for the rest api
Or is this an internal endpoint
