Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to update the dataset you have created.
Send data in JSON format
To send data to Axiom in JSON format:- Encode the events as JSON objects.
- Enter the array of JSON objects into the body of the API request.
- Optional: In the body of the request, set optional parameters such as
timestamp-field
andtimestamp-format
. For more information, see the ingest data API reference. - Set the
Content-Type
header toapplication/json
. - Set the
Authorization
header toBearer API_TOKEN
. - Send the POST request to
https://AXIOM_DOMAIN/v1/datasets/DATASET_NAME/ingest
.
Replace
AXIOM_DOMAIN
with api.axiom.co
if your organization uses the US region, and with api.eu.axiom.co
if your organization uses the EU region. For more information, see Regions.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.Example with grouped events
The following example request contains grouped events. The structure of the JSON payload has the scheme of[ { "labels": { "key1": "value1", "key2": "value2" } }, ]
where the array contains one or more JSON objects describing events.
Example request
Replace
AXIOM_DOMAIN
with api.axiom.co
if your organization uses the US region, and with api.eu.axiom.co
if your organization uses the EU region. For more information, see Regions.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.Example with nested arrays
Example requestReplace
AXIOM_DOMAIN
with api.axiom.co
if your organization uses the US region, and with api.eu.axiom.co
if your organization uses the EU region. For more information, see Regions.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.Example with objects, strings, and arrays
Example requestReplace
AXIOM_DOMAIN
with api.axiom.co
if your organization uses the US region, and with api.eu.axiom.co
if your organization uses the EU region. For more information, see Regions.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.Send data in NDJSON format
To send data to Axiom in NDJSON format:- Encode the events as JSON objects.
- Enter each JSON object in a separate line into the body of the API request.
- Optional: In the body of the request, set optional parameters such as
timestamp-field
andtimestamp-format
. For more information, see the ingest data API reference. - Set the
Content-Type
header to eitherapplication/json
orapplication/x-ndjson
. - Set the
Authorization
header toBearer API_TOKEN
. ReplaceAPI_TOKEN
with the Axiom API token you have generated. - Send the POST request to
https://AXIOM_DOMAIN/v1/datasets/DATASET_NAME/ingest
. ReplaceDATASET_NAME
with the name of the Axiom dataset where you want to send data.
Replace
AXIOM_DOMAIN
with api.axiom.co
if your organization uses the US region, and with api.eu.axiom.co
if your organization uses the EU region. For more information, see Regions.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.Replace
AXIOM_DOMAIN
with api.axiom.co
if your organization uses the US region, and with api.eu.axiom.co
if your organization uses the EU region. For more information, see Regions.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.Send data in CSV format
To send data to Axiom in JSON format:- Encode the events in CSV format. The first line specifies the field names separated by commas. Subsequent new lines specify the values separated by commas.
- Enter the CSV representation in the body of the API request.
- Optional: In the body of the request, set optional parameters such as
timestamp-field
andtimestamp-format
. For more information, see the ingest data API reference. - Set the
Content-Type
header totext/csv
. - Set the
Authorization
header toBearer API_TOKEN
. ReplaceAPI_TOKEN
with the Axiom API token you have generated. - Send the POST request to
https://AXIOM_DOMAIN/v1/datasets/DATASET_NAME/ingest
. ReplaceDATASET_NAME
with the name of the Axiom dataset where you want to send data.
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.Replace AXIOM_DOMAIN
with api.axiom.co
if your organization uses the US region, and with api.eu.axiom.co
if your organization uses the EU region. For more information, see Regions.Replace
AXIOM_DOMAIN
with api.axiom.co
if your organization uses the US region, and with api.eu.axiom.co
if your organization uses the EU region. For more information, see Regions.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.Send data with Axiom Node.js
- Install and configure the Axiom Node.js library.
- Encode the events as JSON objects.
-
Pass the dataset name and the array of JSON objects to the
axiom.ingest
function.
Replace
AXIOM_DOMAIN
with api.axiom.co
if your organization uses the US region, and with api.eu.axiom.co
if your organization uses the EU region. For more information, see Regions.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.