TypeScript SDK
Use the Aeolian TypeScript SDK when you want typed calls to the storefront API without writing request URLs, headers, or response types by hand.
Install
npm install @getaeolian/typescriptConfigure once
Create a small client setup file and import it before making SDK calls.
// lib/aeolian.ts
import { client } from '@getaeolian/typescript'
client.setConfig({
headers: {
Authorization: `Bearer ${process.env.NEXT_PUBLIC_AEOLIAN_PUBLISHABLE_KEY}`,
},
})The SDK uses the production API by default. You only need to set baseUrl if you are pointing at another environment.
client.setConfig({
baseUrl: 'https://api.getaeolian.com',
headers: {
Authorization: `Bearer ${process.env.NEXT_PUBLIC_AEOLIAN_PUBLISHABLE_KEY}`,
},
})pk_ in browser or mobile code. Do not put secret or admin credentials in client-side code.Make a request
After setup, import the operation you want and pass the same parameters shown in the API reference.
import '@/lib/aeolian'
import { listProducts } from '@getaeolian/typescript'
const { data, error } = await listProducts({
query: {
limit: 20,
sort: 'created_at',
order: 'desc',
},
})
if (error) throw error
console.log(data)SDK responses return { data, error }. Check error before using data.
Parameters
SDK parameter names match the API reference. Query string values go under query, path values go under path, and JSON request bodies go under body.
const { data, error } = await listProducts({
query: {
limit: 20,
},
})Generated TypeScript types preserve the API shape, including nullable fields. If the API returns Money | null, the SDK type is also Money | null.
Per-request headers
Use per-request headers when a single call needs extra context, such as localization.
const { data, error } = await listProducts({
query: {
limit: 20,
},
headers: {
'Accept-Language': 'en-AU',
'X-Currency': 'AUD',
},
})See Authentication, Pagination, and Errors for the underlying API behavior.