This page explains how to query data via the Axiom API using the following: For an introduction to the basics of the Axiom API and to the authentication options, see Introduction to Axiom API. The API requests on this page use the query data endpoint. For more information, see the API reference.Documentation Index
Fetch the complete documentation index at: https://axiom.co/docs/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to ingest data to the dataset you have created.
Query data with cURL
To query data with cURL:- Build the APL query. For more information, see Introduction to APL.
- Encode the APL query as a JSON object and enter it into the body of the API request.
- Optional: In the body of the request, set optional parameters such as
startTimeandendTime. For more information, see the query data API reference. - Set the
Content-Typeheader toapplication/json. - Set the
Authorizationheader toBearer API_TOKEN. - Send the POST request to one of the following:
- For tabular output, use
https://AXIOM_DOMAIN/v1/query/_apl?format=tabular. - For legacy output, use
https://AXIOM_DOMAIN/v1/query/_apl?format=legacy.
- For tabular output, use
Example
Replace
AXIOM_DOMAIN with the base domain of your edge deployment. For more information, see Edge deployments.Replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.Replace DATASET_NAME with the name of the Axiom dataset where you send your data.Query data with Axiom Node.js
- Install and configure the Axiom Node.js library.
- Build the APL query. For more information, see Introduction to APL.
-
Pass the APL query as a string to the
axiom.queryfunction.ReplaceDATASET_NAMEwith the name of the Axiom dataset where you send your data.