# Link-in-bio (bio pages)

Source: https://developers.leonai.io/docs/guides/link-in-bio/

Bio pages are hosted, multi-link landing pages (a Linktree-style profile). Create a
page, add items, order them, and publish.

Code samples use the planned [TypeScript SDK](https://developers.leonai.io/docs/sdks/) interface, which is not published
yet; each call maps to a REST endpoint in the [API reference](https://developers.leonai.io/docs/api-reference/).

## Create a page

```ts
const { data: page } = await leonai.bioPages.create({
  slug: 'leon', // 3–30 chars, lowercase letters/digits/hyphens
  title: 'Leon',
  bio: 'Links & launches', // optional, up to 500 chars
  avatarUrl: 'https://example.com/me.png', // optional
  theme: { preset: 'midnight', accentColor: '#14b8a6' }, // optional
});
```

`REST: POST /api/v1/bio-pages` (scope `links:write`). Page count is capped by tier
(Free 1, Pro 3, Business 10, Enterprise unlimited).

## Add items

Items are one of three types — `link`, `header`, or `social`:

```ts
await leonai.bioPages.createItem(page.id, {
  type: 'link',
  title: 'My site',
  url: 'https://example.com',
  // or reference an existing short link: linkId: 'link_...'
});
```

`REST: POST /api/v1/bio-pages/:id/items`. A `link`/`social` item can carry a `url` or a
`linkId` (a `linkId`-backed item is tracked by that short link's own analytics), plus an
optional `icon` and `position`.

## Reorder items

Pass item ids in the desired order:

```ts
await leonai.bioPages.reorderItems(page.id, ['item_2', 'item_1']);
```

## Publish / unpublish

```ts
await leonai.bioPages.publish(page.id);
await leonai.bioPages.unpublish(page.id);
```

## Read and update

```ts
await leonai.bioPages.list();
await leonai.bioPages.get(page.id); // includes items
await leonai.bioPages.update(page.id, { bio: 'Links & launches' });
await leonai.bioPages.delete(page.id);
```

`REST: POST /api/v1/bio-pages/:id/publish` (and `.../unpublish`). Reordering uses
`PUT /api/v1/bio-pages/:id/items/order` with the full list of item ids in the desired
order (it must be a permutation of the page's current items).

Once published, the page is resolvable publicly (no auth) at
`GET /api/v1/public/bio/:slug`, and public item clicks are tracked via
`POST /api/v1/public/bio/:slug/items/:itemId/click`.
