Get started with the Chronosphere API
The Chronosphere API is an HTTP/JSON REST API, where the HTTP method and the URL path define endpoints. To access the Chronosphere API, you need an API token.
Create an API token
A service can access the Chronosphere API by authenticating with its API token. Many Chronosphere API requests require an unrestricted service account. For details, see Service accounts.
A user with sufficient permissions can access the Chronosphere API by creating a temporary personal access token. For details, see Personal access tokens.
Send requests
Send requests to your Chronosphere Observability Platform domain, which must include
your Chronosphere API token in an API-Token
HTTP header.
For example, you can pass the token and domain using environment variables to the
curl
command:
export CHRONOSPHERE_API_TOKEN="TOKEN"
export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io"
curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \
-X METHOD \
"https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH"
Replace the following:
TOKEN
: Your API token.INSTANCE
: The subdomain name for your organization's Observability Platform instance.METHOD
: The HTTP method to use with the request, such asGET
orPOST
.ENDPOINT_PATH
: The specific endpoint you want to access.
Chronoctl also uses the environment variable CHRONOSPHERE_API_TOKEN
.
For example, to list all collections:
curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \
-X GET \
"https://${CHRONOSPHERE_DOMAIN}/api/v1/config/collections"
To create a collection, send a POST request with JSON body:
curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \
-X POST \
--data '{"collection": {"name": "My Test Collection"}}' \
"https://${CHRONOSPHERE_DOMAIN}/api/v1/config/collections"
Use an API token
You can use an API token to make HTTP API calls.
For HTTP calls, use the Authorization
header with the Bearer
token authentication
scheme.
For example, to use the API token to call the Query API with curl
, run:
curl -H "Authorization: Bearer ${CHRONOSPHERE_API_TOKEN}" "https://${CHRONOSPHERE_DOMAIN}.chronosphere.io/data/metrics/api/v1/query?query=up"
Available endpoints
For a full list of Chronosphere API endpoints, see: