> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fetchski-attract.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> From an API key to your first call, in three steps.

**1. Issue an API key**

In the site's CMS, open **API Keys** and create a key. Give it only the
scopes your app needs, and pick its signing mode:

* **Token only:** the key alone authenticates. Use this to try calls in the
  API reference's playground.
* **Signed writes** or **every request signed:** the key also has a signing
  secret (`fss_…`). The SDKs sign each request for you; to sign by hand, see
  [Signing requests](https://docs.fetchski-attract.com/signing.md).

The site shows the key once: `fsk_<site>_<key id>_<secret>`. Keep it in
your app's secrets, never in its code.

> [!TIP]
>
> Reading the public content types needs no key at all. Leave the key
> out and the site answers as it does the public. **Authentication** →
> "What a key reaches today" lists what a key adds.

**2. Install an SDK and point it at the site**

The key you just made also installs the SDK from your site.

> [tab] Laravel
>
> Your own site serves the SDK, and any API key from it lets you in. In a terminal, in your Laravel
> app's folder, run:
>
> ```bash Terminal theme={"dark"}
> composer config repositories.fetchski composer https://acme.example/api/v1/sdk/composer
> composer config bearer.acme.example fsk_acme_…
> composer require fetchski/attract-cms-laravel
> ```
>
> The first line tells Composer the SDK comes from your site (it's saved in `composer.json`). The second
> saves your key in the app's `auth.json`. The third installs the SDK, and the API client it uses, from
> your site. Put your site's address in the first two lines (set your site in the bar under this page's
> title and the example shows it), and paste your whole key in place of `fsk_acme_…`.
>
> > [!NOTE]
> >
> > **Any API key from your site works**, the same one your app uses included: its scopes and signing
> > mode don't matter for installing, only that it's switched on and not past its expiry date. No key
> > yet? Make one in the CMS under **API Keys** ([Authentication](https://docs.fetchski-attract.com/authentication.md)).
>
> > [!WARNING]
> >
> > **`auth.json` holds a key to your site: never commit it.** A Laravel app's `.gitignore` already
> > lists `/auth.json`; keep that line there (add it if yours doesn't have it). In CI, write the same
> > `auth.json` from a secret before installing.
>
> > [!TIP]
> >
> > **`401 Unauthorized`?** Your site refused the key in `auth.json`: it's mistyped or cut short,
> > switched off, or past its expiry date. Run the second line again with the right key.
>
> Then point the SDK at the site:
>
> ```bash Terminal theme={"dark"}
> php artisan attract:install
> ```
>
> It asks for the site's slug, URL, key and signing secret, writes them to `.env`, and checks
> the site answers.

> [tab] TypeScript
>
> Your own site serves the `@fetchski` packages, and any API key from it lets you in. In your
> project's folder (beside its `package.json`), make a file named `.npmrc` holding these two lines:
>
> ```ini .npmrc theme={"dark"}
> @fetchski:registry=https://acme.example/api/v1/sdk/npm/
> //acme.example/api/v1/sdk/npm/:_authToken=fsk_acme_…
> ```
>
> The first line says `@fetchski` packages come from your site; the second is the key to sign in with.
> Put your site's address in both lines (set your site in the bar under this page's title and the
> example shows it), and paste your whole key in place of `fsk_acme_…`. Write the key itself, never a
> variable or a value from `.env`: npm and pnpm don't read `.env`, and pnpm refuses a variable here.
>
> > [!NOTE]
> >
> > **Any API key from your site works**, the same one your app uses included: its scopes and signing
> > mode don't matter for installing, only that it's switched on and not past its expiry date. No key
> > yet? Make one in the CMS under **API Keys** ([Authentication](https://docs.fetchski-attract.com/authentication.md)).
>
> Then keep the file out of git. Add this line to the project's `.gitignore` (make the file if
> there isn't one):
>
> ```text .gitignore theme={"dark"}
> .npmrc
> ```
>
> > [!WARNING]
> >
> > **`.npmrc` now holds a key to your site: never commit it.** If git already tracks a `.npmrc`, stop
> > tracking it with `git rm --cached .npmrc`. Keep these lines in this project's `.npmrc` only, never
> > in the `.npmrc` in your home folder. In CI, write the same file from a secret before installing.
>
> In a terminal, in the same folder as the `.npmrc`, run the line for the package manager your
> project uses:
>
> ```bash npm theme={"dark"}
> npm install @fetchski/attract-cms-sdk
> ```
>
> ```bash pnpm theme={"dark"}
> pnpm add @fetchski/attract-cms-sdk
> ```
>
> ```bash bun theme={"dark"}
> bun add @fetchski/attract-cms-sdk
> ```
>
> > [!TIP]
> >
> > **`401 Unauthorized`?** Your site refused the key in `.npmrc`: it's mistyped or cut short, switched
> > off, or past its expiry date. Check too that `.npmrc` sits in the folder you ran the command in.
>
> Then point the SDK at the site, in your app's `.env`:
>
> ```ini .env theme={"dark"}
> FETCHSKI_ATTRACT_URL=https://acme.example
> FETCHSKI_ATTRACT_API_KEY=fsk_acme_…
> FETCHSKI_ATTRACT_SIGNING_SECRET=fss_…
> ```

**3. Make your first call**

```php Laravel theme={"dark"}
use Fetchski\AttractCmsLaravel\Facades\Attract;

foreach (Attract::faqItems()->listFaqItems(perPage: 20)->results as $item) {
    echo $item->title, PHP_EOL;
}
```

```ts TypeScript theme={"dark"}
import { createSiteClient } from '@fetchski/attract-cms-sdk';

const site = createSiteClient();

const { results } = await site.faqItems().listFaqItems({ perPage: 20 });
for (const item of results) console.log(item.title);
```

```bash cURL theme={"dark"}
curl 'https://acme.example/api/v1/faq-item?perPage=20' \
  --header 'Authorization: ApiKey fsk_acme_…'
```

> [!TIP]
>
> Nothing to catch: the SDKs sign, retry what is safe, and check every
> answer against its type before your code sees it.

## Next steps

> [card] [Laravel SDK](https://docs.fetchski-attract.com/laravel/overview.md)
>
> The facade, fakes and Action scaffolding.

> [card] [TypeScript SDK](https://docs.fetchski-attract.com/typescript/overview.md)
>
> One client, typed models, `fakeSite()`.

> [card] [Authentication](https://docs.fetchski-attract.com/authentication.md)
>
> Scopes, signing and rate limits.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.