Aden
SDK

Quickstart

Install the SDK, authenticate, and make your first request.

Five steps, each wired once. After this you don't touch it again.

Prerequisites

  • Node.js >= 20, Bun, or Deno
  • A team you can create an API key in

Treat API keys like passwords. Anyone holding one can read and write your team's data. Keep them in a secret manager, never in git.

Install the package

npm install @adenspace/sdk

Create a team API key

Keys are scoped to one team. In the Aden web app, open your team, go to Settings → API keys, and click New key. The value starts with aden_live_ and is shown once. Copy it into your secret manager now.

Create a client

lib/aden.ts
import { createAdenClient } from '@adenspace/sdk'

export const aden = createAdenClient({
    apiKey: process.env.ADEN_API_KEY,
})

Make a request

Every path in the API is mirrored on the client, so autocomplete guides you.

const { data: tracks, error } = await aden.api.v1.tracks.get({
    query: { limit: 10 },
})

if (error) {
    console.error(error.status, error.value)
    process.exit(1)
}

for (const track of tracks) {
    console.log(`${track.title}, ${track.status}`)
}

Path parameters are function calls, and POST bodies go as the first argument:

const { data: track } = await aden.api.v1.tracks({ id: 42 }).get()

const { data: created } = await aden.api.v1.tracks.post({
    title: 'New demo',
    teamId: 123,
})

Check the API is up

if (!(await aden.ping())) {
    throw new Error('Aden API is unreachable')
}

Custom base URL

Point the client at local dev, a staging environment, or self-hosted Aden:

const aden = createAdenClient({
    baseUrl: 'http://localhost:3000',
    apiKey: process.env.ADEN_API_KEY,
})

Next

Was this helpful?

On this page