Docs
DocumentationQuery ReferenceAPI Reference
Open Console→→
DocumentationQuery ReferenceAPI Reference

Get started

IntroductionSend dataQuery dataPaginationAPI limits

Annotations

List all annotationsGETRetrieve annotationGETCreate annotationPOSTUpdate annotationPUTDelete annotationDELETE

API tokens

List all API tokensGETRetrieve API tokenGETCreate API tokenPOSTRegenerate API tokenPOSTDelete API tokenDELETE

Dashboards

List all dashboardsGETRetrieve dashboardGETCreate dashboardPOSTUpdate dashboardPUTPatch dashboard elementPATCHDelete dashboardDELETE

Datasets

List all datasetsGETRetrieve datasetGETList all fields in datasetGETRetrieve field in datasetGETCreate datasetPOSTIngest dataPOSTRun queryPOSTRun query (legacy)POSTTrim datasetPOSTUpdate datasetPUTUpdate fieldPUTVacuum datasetPOSTDelete datasetDELETE

Edge

Ingest data to edge deploymentIngest Splunk HEC eventsIngest raw Splunk HEC eventsCheck Splunk HEC healthRun APL query to edge deploymentRun batch query to edge deploymentRun MPL query to edge deploymentGet metrics for a datasetGet metric tags for a datasetGet metric tag values for a datasetGet tags for a datasetGet tag values for a dataset

Map fields

List all map fieldsGETCreate map fieldPOSTUpdate list of map fieldsPUTDelete map fieldsDELETE

Monitors

List all monitorsGETRetrieve monitorGETRetrieve monitor historyGETCreate monitorPOSTUpdate monitorPUTDelete monitorDELETE

Notifiers

List all notifiersGETRetrieve notifierGETCreate notifierPOSTUpdate notifierPUTDelete notifierDELETE

Organizations

List all orgsGETRetrieve orgGETCreate orgPOSTUpdate orgPUTProvision orgPOST

Role-based access control

List all rolesGETRetrieve roleGETList all groupsGETRetrieve groupGETCreate rolePOSTCreate groupPOSTUpdate rolePUTUpdate groupPUTDelete roleDELETEDelete groupDELETE

Saved queries

List all saved queriesGETRetrieve saved queryGETCreate saved queryPOSTUpdate saved queryPUTDelete saved queryDELETE

Users

Retrieve current userGETList all usersGETRetrieve userGETCreate userPOSTUpdate current userPUTUpdate user rolePUTDelete user from orgDELETE

Views

List all viewsGETRetrieve viewGETCreate viewPOSTUpdate viewPUTDelete viewDELETE

Virtual fields

List all virtual fieldsGETRetrieve virtual fieldGETCreate virtual fieldPOSTUpdate virtual fieldPUTDelete virtual fieldDELETE
Get started

Send data to Axiom via API

This page explains how to send to Axiom using the API.

The Axiom REST API accepts the following data formats:

  • JSON
  • NDJSON
  • CSV

This page explains how to send data to Axiom via cURL commands in each of these formats, and how to send data with the Axiom Node.js library.

For more information on choosing an ingest format, see Optimize data loading.

For more information on other ingest options, see Send data.

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 ingest data endpoint. For more information, see the API reference.

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.
Info

The Ingest data endpoint only supports API tokens. Personal access tokens (PATs) aren't supported. For more information, see Tokens.

Send data in JSON format

To send data to Axiom in JSON format:

  1. Encode the events as JSON objects.
  2. Enter the array of JSON objects into the body of the API request.
  3. Optional: In the body of the request, set optional parameters such as timestamp-field and timestamp-format. For more information, see the ingest data API reference.
  4. Set the Content-Type header to application/json.
  5. Set the Authorization header to Bearer API_TOKEN.
  6. Send the POST request to https://AXIOM_DOMAIN/v1/ingest/DATASET_NAME.
Info

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.

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

shell
curl -X 'POST' 'https://AXIOM_DOMAIN/v1/ingest/DATASET_NAME' \
  -H 'Authorization: Bearer API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '[
        {
          "time":"2025-01-12T00:00:00.000Z",
          "data":{"key1":"value1","key2":"value2"}
        },
        {
          "data":{"key3":"value3"},
          "labels":{"key4":"value4"}
        }
      ]'
Info

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.

Example response

JSON
{
    "ingested": 2,
    "failed": 0,
    "failures": [],
    "processedBytes": 219,
    "blocksCreated": 0,
    "walLength": 2
}

Example with nested arrays

Example request

shell
curl -X 'POST' 'https://AXIOM_DOMAIN/v1/ingest/DATASET_NAME' \
    -H 'Authorization: Bearer API_TOKEN' \
    -H 'Content-Type: application/json' \
    -d '[
            {
            "axiom": [{
                "logging":[{
                    "observability":[{
                        "location":[{
                            "credentials":[{
                                "datasets":[{
                                    "first_name":"axiom",
                                    "last_name":"logging",
                                    "location":"global"
                                }],
                                "work":[{
                                    "details":"https://app.axiom.co/",
                                    "tutorials":"https://www.axiom.co/blog",
                                    "changelog":"https://www.axiom.co/changelog",
                                    "documentation": "https://www.axiom.co/docs"
                                }]
                            }],
                            "social_media":[{
                                "details":[{
                                    "twitter":"https://twitter.com/AxiomFM",
                                    "linkedin":"https://linkedin.com/company/axiomhq",
                                    "github":"https://github.com/axiomhq"
                                }],
                                "features":[{
                                    "datasets":"view logs",
                                    "stream":"live_tail",
                                    "explorer":"queries"
                                }]
                            }]
                        }]
                    }],
                    "logs":[{
                        "apl": "functions"
                    }]
                }],
                "storage":[{}]
            }]}
        ]'
Info

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.

Example response

JSON
{
    "ingested":1,
    "failed":0,
    "failures":[],
    "processedBytes":1587,
    "blocksCreated":0,
    "walLength":3
}

Example with objects, strings, and arrays

Example request

shell
curl -X 'POST' 'https://AXIOM_DOMAIN/v1/ingest/DATASET_NAME' \
    -H 'Authorization: Bearer API_TOKEN' \
    -H 'Content-Type: application/json' \
    -d '[{ "axiom": {
        "logging": {
            "observability": [
                { "apl": 23, "function": "tostring" },
                { "apl": 24, "operator": "summarize" }
            ],
            "axiom": [
                { "stream": "livetail", "datasets": [4, 0, 16], "logging": "observability", "metrics": 8, "dashboard": 10, "alerting": "kubernetes" }
            ]
        },
        "apl": {
            "reference":
                [[80, 12], [30, 40]]
        }
    }
    }]'
Info

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.

Example response

JSON
{
    "ingested":1,
    "failed":0,
    "failures":[],
    "processedBytes":432,
    "blocksCreated":0,
    "walLength":4
}

Send data in NDJSON format

To send data to Axiom in NDJSON format:

  1. Encode the events as JSON objects.
  2. Enter each JSON object in a separate line into the body of the API request.
  3. Optional: In the body of the request, set optional parameters such as timestamp-field and timestamp-format. For more information, see the ingest data API reference.
  4. Set the Content-Type header to either application/json or application/x-ndjson.
  5. Set the Authorization header to Bearer API_TOKEN. Replace API_TOKEN with the Axiom API token you have generated.
  6. Send the POST request to https://AXIOM_DOMAIN/v1/ingest/DATASET_NAME. Replace DATASET_NAME with the name of the Axiom dataset where you want to send data.
Info

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.

Example request

shell
curl -X 'POST' 'https://AXIOM_DOMAIN/v1/ingest/DATASET_NAME' \
    -H 'Authorization: Bearer API_TOKEN' \
    -H 'Content-Type: application/x-ndjson' \
    -d '{"id":1,"name":"machala"}
        {"id":2,"name":"axiom"}
        {"id":3,"name":"apl"}
        {"index": {"_index": "products"}}
        {"timestamp": "2016-06-06T12:00:00+02:00", "attributes": {"key1": "value1","key2": "value2"}}
        {"queryString": "count()"}'
Info

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.

Example response

JSON
{
    "ingested": 6,
    "failed": 0,
    "failures": [],
    "processedBytes": 266,
    "blocksCreated": 0,
    "walLength": 6
}

Send data in CSV format

To send data to Axiom in JSON format:

  1. 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.
  2. Enter the CSV representation in the body of the API request.
  3. Optional: In the body of the request, set optional parameters such as timestamp-field and timestamp-format. For more information, see the ingest data API reference.
  4. Set the Content-Type header to text/csv.
  5. Set the Authorization header to Bearer API_TOKEN. Replace API_TOKEN with the Axiom API token you have generated.
  6. Send the POST request to https://AXIOM_DOMAIN/v1/ingest/DATASET_NAME. Replace DATASET_NAME with the name of the Axiom dataset where you want to send data.
Info

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 the base domain of your edge deployment. For more information, see Edge deployments.

Example request

shell
curl -X 'POST' 'https://AXIOM_DOMAIN/v1/ingest/DATASET_NAME' \
    -H 'Authorization: Bearer API_TOKEN' \
    -H 'Content-Type: text/csv' \
    -d 'user, name
        foo, bar'
Info

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.

Example response

JSON
{
    "ingested": 1,
    "failed": 0,
    "failures": [],
    "processedBytes": 28,
    "blocksCreated": 0,
    "walLength": 2
}

Send data with Axiom Node.js

  1. Install and configure the Axiom Node.js library.

  2. Encode the events as JSON objects.

  3. Pass the dataset name and the array of JSON objects to the axiom.ingest function.

    typescript
    axiom.ingest('DATASET_NAME', [{ foo: 'bar' }]);
    await axiom.flush();
Info

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.

For more information on other libraries you can use to send data, see Send data.

What’s next

After ingesting data to Axiom, you can query it via API or the Axiom Console.

Was this page helpful?
Suggest edits on GitHub
PreviousGet started with Axiom APINextQuery data via Axiom API
On this page
Send data in JSON formatExample with grouped eventsExample with nested arraysExample with objects, strings, and arraysSend data in NDJSON formatSend data in CSV formatSend data with Axiom Node.jsWhat’s next