> ## Documentation Index
> Fetch the complete documentation index at: https://developers.scoutworks.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Write a recipe

> The shape every recipe follows, and the style it is written in. Use it to write your own, or to suggest one to us.

> [!NOTE]
>
> * **For:** anyone writing a recipe for these docs
> * **You get:** a template to copy, and the rules every recipe follows
> * **Time:** read it once, about five minutes
> * **Scopes:** none

A recipe is one complete job for one person, done with a tool they already have. A volunteer should finish it without writing code of their own, and without reading any other page first.

## The template

Copy this into `apps/developers/recipes/<name>.mdx`, then add the page to `docs.json` under its role, and to [Recipes by tool](https://developers.scoutworks.app/recipes/by-tool.md).

````mdx theme={null}
---
title: 'What you get, in a few words'
description: 'One or two sentences: what it does and where the result lands.'
---

<Info>
  - **For:** the role, such as treasurers or section leaders
  - **You get:** the thing they end up with, such as a **Budgets** tab
  - **Time:** about ten minutes
  - **Scopes:** `accounting:read`
</Info>

Why someone needs this, in their words, and what the recipe does about it.

## 1. Try the request

```bash
curl "https://api-demo.scoutworks.app/api/v1/budgets?limit=200" \
  -H "Authorization: Bearer <the sandbox key>"
```

## 2. Add the script

## 3. Add your key

## 4. Run it

## 5. Switch to your group

Change `api-demo.scoutworks.app` to `api.scoutworks.app`, and replace the
sandbox key with your own. Your key needs …

## Variations

## If something goes wrong

See [Errors](/guides/errors) for every code.
````

## The header

Every recipe opens with the same four lines, so a volunteer can tell in five seconds whether it is for them:

* **For:** a role, never "developers". Leaders, treasurers, group admins and trustees, or districts.
* **You get:** the finished thing, not the steps. "A **Budgets** tab", not "a script that reads budgets".
* **Time:** honest, for someone doing it for the first time.
* **Scopes:** every scope the recipe needs, so the admin creating the key gets it right first time.

## Style

* **Plain UK English.** Short sentences. One idea in each. "Choose", not "click"; "sign in", not "log in".
* **Sentence-case headings.** "Switch to your group", not "Switch To Your Group".
* **Numbered steps** for anything done in order. Use `<Steps>` when each step needs a sentence of its own.
* **Name what is on screen** in bold, exactly as the app or the tool spells it: **Settings → Integrations → API keys**.
* **Say why** when a step is not obvious, in one sentence after it.
* **No jargon** a volunteer would not use. Explain a term the first time, or leave it out.

## Rules every recipe keeps

1. **It works as written with the sandbox key.** Every request uses `api-demo.scoutworks.app` and the public sandbox key, so a reader can paste it and see real-looking results. Our tests run every request a page spells out, and fail if one stops working.
2. **It never shows a real key.** The only key on any page is the sandbox key. Tell readers where to keep their own: Script Properties, a credential store, an environment variable.
3. **It reads every page of a list.** Follow `nextCursor` to the end, and wait `retryAfter` seconds on a `429`. Copy `readAll()` and `fetchScoutworks()` from an existing recipe rather than writing new ones.
4. **It treats money as text.** The API sends `"12.50"`, never a number, so pennies are never lost. Convert only to show it.
5. **It keeps names out of formulas.** Anything written into a spreadsheet passes through `safe()`, so a name that starts with `=` stays text.
6. **It warns about personal data.** If the result holds names, contact details or who owes money, say who it is safe to share with.
7. **It names the scopes it needs**, including the `.people` or `.contacts` scope a column needs, and what happens without it.

## Recipes that change data

A recipe that writes, such as [Bank statement into the books](https://developers.scoutworks.app/recipes/bank-statement.md), also:

* says at the top that the read-only sandbox key cannot run it, so the reader needs their own key with the write scope;
* has a step that tries it on one made-up item, checks the result in Scoutworks, and deletes or undoes it before the real run;
* sends an `Idempotency-Key` with every `POST`, made from the thing being added, so a retry never adds it twice;
* sends the `If-Match` or `updatedAt` it read with every change, and tells the reader what a `412 stale_write` means ([Writing data](https://developers.scoutworks.app/guides/writing-data.md) has the rules);
* waits between writes, to stay under 30 changes a minute;
* writes back what it did, such as the new id, so a second run skips what is already done.

## Suggest a recipe

If your group does something with the API that others could copy, [tell us](https://scoutworks.app/contact). We'll write it up in this shape and credit you if you'd like.


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