Send data via Axiom API
Learn how to send and load data into Axiom using the API.
This API allows you to send and load data into Axiom. You can use different methods to ingest logs depending on your requirements and log format.
Authorization and Headers
The only expected headers are the Authorization: Bearer
, which is your API or personal token. Learn more about API Token and Org ID.
Using Axiom JS library to ingest data
Axiom maintains the axiom-js to provide official Javascript bindings for the Axiom API.
Install using npm install
:
If you use the Axiom CLI, run eval $(axiom config export -f)
to configure your environment variables.
Otherwise create a personal token in the Axiom settings and export it as AXIOM_TOKEN
. Set AXIOM_ORG_ID
to the organization ID from the settings page of the organization you want to access.
You can also configure the client using options passed to the constructor of the Client:
Create and use a client like this:
These examples send an API event to Axiom. Before getting started with Axiom API, you need to create a Dataset and API Token.
Ingest Events using JSON
The following example request contains grouped events. The structure of the JSON
payload should have the scheme of [ { "labels": { "key1": "value1", "key2": "value12" } }, ]
, in which the array comprises of one or more JSON objects describing Events.
Example Request using JSON
Example Response
A successful POST Request returns a 200
response code JSON with details:
Example Request using Nested Arrays
Example Response
A successful POST Request returns a 200
response code JSON with details:
Example Request using Objects, Strings, and Arrays
Example Response
A successful POST Request returns a 200
response code JSON with details:
Example Response
A successful POST Request returns a 200
response code JSON with details:
Ingest Events using CSV
The following example request contains events. The structure of the CSV
payload uses a comma to separate values 'value1, value2, value3'
.
Example Request using CSV
Example Response
A successful POST Request returns a 200 response code JSON with details:
Datasets names are usually case sensitive, Dataset names must be between 1-128 characters, and may only contain ASCII alphanumeric characters and the ’-’ character.
Was this page helpful?