Getting Started with Axiom API
Axiom understands your resources and provides an API to ingest structured data logs, handle queries, and manage your deployments. This REST-style API uses JSON for serialization and gives you complete control over the entire Axiom platform.
This page covers the basics for interacting with the Axiom API, instructions for ingesting data, and notes on some commonly used endpoints.
You can use the API commands with curl by providing your Access Token.
API Basics
All our endpoints live under the url https://api.axiom.co and follow the REST architectural style.
Here's an example in curl:
curl -X 'POST' 'https://api.axiom.co/v1/datasets/$DATASET_NAME/ingest' \
-H 'Authorization: Bearer $API_TOKEN' \
-H 'Content-Type: application/x-ndjson' \
-d '{ "axiom": "logging"}'Content Type
All requests must be encoded as JSON with the Content-Type header set to application/json. If not otherwise specified, responses from the Axiom API, including errors, are encoded exclusively as JSON as well.
Datasets
Datasets are required to send, query, and retrieve requests. Datasets are a collection of similar events. When data is sent to Axiom, it is stored in a dataset.
You will need to create or use an existing Dataset to get started with Axiom REST API.
See Creating a Dataset to get started.
Authentication
Requests to the Axiom API must provide an API token through the Authorization header:
Authorization: Bearer <$API_TOKEN or $PERSONAL_TOKEN>The Authorization header with an access token:
API Tokens can be created and managed from Settings --> API Tokens on Axiom UI.
See Access Tokens for more detail.
Organization ID
Organization identification is required for you to send requests using Personal Tokens.
The org id credentials can be obtained on the Settings page.
The org id can also be obtained from the url of your Axiom deployment.
In your Axiom deployment url https://app.axiom.co/axiom-wt8j/datasets, the credential axiom-wt8j is the organization ID.
Failed Authentication
If authentication is unsuccessful for a request, the error status code 403 is returned.
Types
Below is a list of the types of data used within the Axiom API:
| Name | Definition | Example |
|---|---|---|
| ID | A unique value used to identify resources. | "io12h34io1h24i" |
| String | A sequence of characters used to represent text. | "string value" |
| Boolean | A type of two possible values representing true or false. | true |
| Integer | A number without decimals. | 4567 |
| Float | A number with decimals. | 15.67 |
| Map | A data structure with a list of values assigned to a unique key. | { "key": "value" } |
| List | A data structure with only a list of values separated by a comma. | ["value", 4567, 45.67] |