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. Keep them in a secret manager, never in git or a web page. Aden refuses a key sent from a browser.
@adenspace/sdk isn't on npm yet. Until it is, call the REST API with
fetch, as in Add Aden to your website.
Install the package
npm install @adenspace/sdkCreate a team API key
Keys are bound to one team. In Aden, open your team, go to API and press
New key. Pick Read only unless your code changes things. The key
starts with aden_ and is shown once: copy it into your secret manager now.
Note your team id too: the number in the page's address
(aden.space/app/teams/216/api → 216).
Create a client
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: res, error } = await aden.api.v1.tracks.get({
query: { teamId: process.env.ADEN_TEAM_ID, limit: 10 },
})
if (error) {
console.error(error.status, error.value)
process.exit(1)
}
for (const track of res.data) {
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()
// Read & write keys only
const { data: task } = await aden.api.v1.todos.post({
todo: 'Send the masters to the label',
trackId: 42,
})A key reaches tracks, albums, playlists, shows, tours, posts, milestones, tasks, contacts, webhooks and app data. See Authentication.
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,
})