Skip to main content
POST
/
query
import { Autumn as autumn } from 'autumn-js'

const response = await autumn.query({
customer_id: 'user_123',
feature_id: 'messages',
range: '30d'
})
{
"list": [
{
"period": 1672531200000,
"messages": 45
},
{
"period": 1672617600000,
"messages": 32
},
{
"period": 1672704000000,
"messages": 18
}
]
}
This endpoint allows you to query usage data for specific features over various time ranges. It returns historical usage information that can be used for analytics, reporting, or displaying usage graphs to customers.
You can query usage for a single feature or multiple features in one request by passing an array of feature IDs.
The response returns a list of objects. Each object includes a period timestamp and one key per requested feature ID with its usage value.

Authorizations

Authorization
string
header
required

Use your Autumn Secret Key as the Bearer token.

Body

application/json
customer_id
string
required

Your unique identifier for the customer

feature_id
required

Feature ID or array of feature IDs to query usage for

range
enum<string>

Time range for the query. Defaults to "30d" if not provided. last_cycle returns usage since the last billing cycle.

Available options:
24h,
7d,
30d,
90d,
last_cycle

Response

200 - application/json

Usage data for the specified features

list
object[]

List of usage data points for each time period

I