# Build a method

> Make a method from a request in plain words, follow it to the end, steer it with messages, and cancel or dismiss it.

Source: https://docs.fous.com/guides/builds
Index: https://docs.fous.com/llms.txt

A build makes a method from a request in plain words. Fous studies the site, writes the method and tests it on real inputs, usually in about a minute.

## Start a build

```bash
curl https://api.fous.com/v1/builds \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Search Rust crates by keyword",
    "platform": "crates.io",
    "visibility": "private"
  }'
```

```json
{
  "id": "bld_01m5kz8x0vb6dp3jq2w4e5r6t7",
  "status": "building",
  "kind": "new",
  "effect": "read",
  "query": "Search Rust crates by keyword",
  "asked": "Search Rust crates by keyword",
  "platform": "crates.io",
  "events": [],
  "estimate": {
    "low_seconds": 52,
    "high_seconds": 104,
    "median_seconds": 71,
    "samples": 100
  },
  "created_at": "2026-10-23T08:40:02.000Z"
}
```

| Field | Meaning |
| --- | --- |
| `query` | What the method should read or do, 5 to 2,000 characters. |
| `platform` | The site, if the query does not name it. |
| `visibility` | Required for a new method: `public`, or `private` to your organization. |
| `input` | Values to build with. They become the first test. |
| `method` | A method to change ([Change a method](https://docs.fous.com/guides/methods.md#change-a-method)). |

`input_schema`, `output_schema`, `images` and `connections` are in the [API reference](https://docs.fous.com/api-reference/builds.md). Sending the same request again returns the running build.

## Follow it

`?wait=60` answers when the build ends, or on a new event when `after` is the number of `events` you have.

```bash
curl "https://api.fous.com/v1/builds/bld_01m5kz8x0vb6dp3jq2w4e5r6t7?wait=60" \
  -H "Authorization: Bearer $FOUS_API_KEY"
```

```json
{
  "id": "bld_01m5kz8x0vb6dp3jq2w4e5r6t7",
  "status": "ready",
  "kind": "new",
  "effect": "read",
  "query": "Search Rust crates by keyword",
  "asked": "Search Rust crates by keyword",
  "platform": "crates.io",
  "events": [
    {
      "at": "2026-10-23T08:40:21.000Z",
      "kind": "note",
      "message": "The search page reads its results from a JSON endpoint that takes the keyword."
    },
    {
      "at": "2026-10-23T08:40:34.000Z",
      "kind": "status",
      "message": "Testing the method with two keywords."
    }
  ],
  "outcome": { "type": "new_method" },
  "method": {
    "id": "mth_01m5kz9a1b2c3d4e5f6g7h8j9k",
    "slug": "crates.io/search_crates",
    "name": "Search crates",
    "description": "Searches crates.io by keyword.",
    "returns": "name, description, downloads, version",
    "platform": { "name": "crates.io", "domain": "crates.io" },
    "input_schema": {
      "type": "object",
      "required": ["query"],
      "properties": { "query": { "type": "string", "description": "Keyword." } }
    },
    "effect": "read",
    "auth": { "required": false },
    "cost": { "credits": 1 },
    "version": 1,
    "latest_version": 1,
    "private": true
  },
  "created_at": "2026-10-23T08:40:02.000Z",
  "completed_at": "2026-10-23T08:41:12.000Z"
}
```

| Status | Meaning |
| --- | --- |
| `building` | Still working (`202`). |
| `ready` | `method` is ready to run; `outcome` says what was made. |
| `requires_auth` | [Connect an account](https://docs.fous.com/guides/connections.md); the build goes on inside it. |
| `unsupported` | No method could be verified; `reason` says why. |

## Send a message

A message corrects or narrows a running build:

```bash
curl "https://api.fous.com/v1/builds/bld_01m5kz8x0vb6dp3jq2w4e5r6t7/messages" \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Also return each crate’s license."}'
```

```json
{
  "id": "bld_01m5kz8x0vb6dp3jq2w4e5r6t7",
  "status": "building",
  "kind": "new",
  "effect": "read",
  "query": "Search Rust crates by keyword",
  "asked": "Search Rust crates by keyword",
  "platform": "crates.io",
  "events": [
    {
      "at": "2026-10-23T08:40:21.000Z",
      "kind": "note",
      "message": "The search page reads its results from a JSON endpoint that takes the keyword."
    }
  ],
  "estimate": {
    "low_seconds": 52,
    "high_seconds": 104,
    "median_seconds": 71,
    "samples": 100
  },
  "created_at": "2026-10-23T08:40:02.000Z",
  "messages": [
    {
      "at": "2026-10-23T08:40:40.000Z",
      "text": "Also return each crate’s license.",
      "seen": false
    }
  ]
}
```

It turns `seen: true` once the builder reads it. A message sent after the build ended starts a follow-up build.

## Methods that change something

> [!WARNING]
> A `write` method (it posts, books, sends) is proven by doing its action once, for real. When the result is unclear, the build ends `unsupported` with `may_have_run: true`: check the site before you try again.

## Cancel

```bash
curl -X POST "https://api.fous.com/v1/builds/bld_01m5kz8x0vb6dp3jq2w4e5r6t7/cancel" \
  -H "Authorization: Bearer $FOUS_API_KEY"
```

```json
{
  "id": "bld_01m5kz8x0vb6dp3jq2w4e5r6t7",
  "status": "unsupported",
  "kind": "new",
  "effect": "read",
  "query": "Search Rust crates by keyword",
  "asked": "Search Rust crates by keyword",
  "platform": "crates.io",
  "events": [
    {
      "at": "2026-10-23T08:40:21.000Z",
      "kind": "note",
      "message": "The search page reads its results from a JSON endpoint that takes the keyword."
    }
  ],
  "reason": "Stopped.",
  "created_at": "2026-10-23T08:40:02.000Z",
  "completed_at": "2026-10-23T08:40:45.000Z"
}
```

Nothing is charged. A build that already ended answers `409`.

## List and dismiss

`GET /v1/builds` lists the 50 newest builds of the past 30 days, with repairs of your methods (`kind: "repair"`). `DELETE` hides an ended build; its method stays.

```bash
curl https://api.fous.com/v1/builds \
  -H "Authorization: Bearer $FOUS_API_KEY"
```

```bash
curl -X DELETE "https://api.fous.com/v1/builds/bld_01m5kz8x0vb6dp3jq2w4e5r6t7" \
  -H "Authorization: Bearer $FOUS_API_KEY"
```

```json
{ "id": "bld_01m5kz8x0vb6dp3jq2w4e5r6t7", "dismissed": true }
```

## Errors

`402 insufficient_credits`: your credits do not cover the build ([Billing](https://docs.fous.com/guides/billing.md)). `422 not_buildable`: no website, app or API is involved. Every code is in [Errors and limits](https://docs.fous.com/guides/errors.md).
