# Quickstart
Source: https://docs.aden.space/docs/developers/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 [#prerequisites]

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

<Callout type="warn">
  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.
</Callout>

<Callout>
  `@adenspace/sdk` isn't on npm yet. Until it is, call the REST API with
  `fetch`, as in [Add Aden to your website](/docs/developers/website).
</Callout>

<Steps>
  <Step>
    ### Install the package [#install-the-package]

    <Tabs groupId="package-manager" items="['npm', 'pnpm', 'yarn', 'bun']">
      <Tab value="npm">
        ```bash
        npm install @adenspace/sdk
        ```
      </Tab>

      <Tab value="pnpm">
        ```bash
        pnpm add @adenspace/sdk
        ```
      </Tab>

      <Tab value="yarn">
        ```bash
        yarn add @adenspace/sdk
        ```
      </Tab>

      <Tab value="bun">
        ```bash
        bun add @adenspace/sdk
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step>
    ### Create a team API key [#create-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`).
  </Step>

  <Step>
    ### Create a client [#create-a-client]

    ```ts title="lib/aden.ts"
    import { createAdenClient } from '@adenspace/sdk'

    export const aden = createAdenClient({
        apiKey: process.env.ADEN_API_KEY,
    })
    ```
  </Step>

  <Step>
    ### Make a request [#make-a-request]

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

    ```ts
    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:

    ```ts
    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](/docs/developers/api/authentication#endpoints).
  </Step>

  <Step>
    ### Check the API is up [#check-the-api-is-up]

    ```ts
    if (!(await aden.ping())) {
        throw new Error('Aden API is unreachable')
    }
    ```
  </Step>
</Steps>

## Custom base URL [#custom-base-url]

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

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

## Next [#next]

<Cards>
  <Card title="Authentication" href="/docs/developers/sdk/authentication" description="API keys vs Supabase session tokens." />

  <Card title="Examples" href="/docs/developers/sdk/examples" description="Real patterns from the Aden apps." />

  <Card title="API reference" href="/docs/developers/api" description="Every endpoint, grouped by resource." />
</Cards>