# How Writ works

> APIs, functions, runs, sign-ins, credits and the places they run, on one page.

Source: https://usewrit.app/docs/concepts/

Most of what you make in Writ is an API: a set of functions that read or act on a website. You call those
functions from code, from an AI assistant or on a schedule, and each call is a run. The rest of this page
names the other pieces you meet in the app and how they fit together.

## APIs, functions and runs

An **API** is what Writ builds for a website. You find yours under **APIs**. Some
screens, endpoints and AI tools call the same thing a **workflow**, for example **Edit workflow** in the app or `writ_run_workflow` for assistants. A recording also produces a
workflow, and it lives in the same list.

An API holds one or more **functions**. A function does one thing, such as “search listings”
or “get order status”. It takes **inputs** (a city, a maximum price, an order number) and
returns data as JSON. The API’s **Functions** tab lists each function with its inputs, what it
returns and what one call costs. **Run just this function** tries it.

Some functions call the site’s own data requests and need no browser. Others drive a real browser. That
choice sets the price of a call on Writ Cloud: 2 credits without a browser, 20 with one.

Every time a function or workflow executes, that is a **run**. The **Runs** page
lists them by type and status. From a run you can **Watch** it live, **View data**, or **Cancel run**. When a run stops for you, for example on a CAPTCHA, a sign-in
or a verification code, it shows **Solve** and waits.

Each function also decides **What happens to the data**: **Save the data** adds
each call’s rows to the API’s data, where you can search and export them. **Return only** gives
the rows to the caller and keeps nothing.

## Ways to call what you built

The same API can be started in several ways at once. You set most of them up on the API’s **Call** tab.

| Way | What starts the run | Where you set it up |
| --- | --- | --- |
| REST endpoint | Your code sends an HTTP request with the inputs | Call tab, Publish REST endpoint |
| MCP tool | Your AI assistant calls a tool | Call tab, Enable MCP; or connect the Writ Cloud MCP server |
| Schedule | A time, such as every hour or every Monday at 9:00 | Call tab, triggers |
| Incoming webhook | Another service sends a request to a Writ address | Call tab, triggers; or Developers, Endpoints |
| Monitor reaction | A page you watch changes | The monitor’s Run a workflow reaction |
| Automation | An event, such as a finished harvest or a completed workflow | Automations |

The **Run** button in the app starts a run by hand. The SDKs for Python, TypeScript, Go and
Rust wrap the REST calls. See [Call your API](https://usewrit.app/docs/call) and [Connect an AI assistant](https://usewrit.app/docs/mcp).

## Scribe, Harvest, monitors and outputs

**Scribe** is the AI assistant inside Writ. You open it from the sidebar (⌘J) and describe what
you need. It builds APIs, sets up monitors, collects sites and wires up automations, and asks you when it
needs a sign-in, a choice or a CAPTCHA solved. See [Scribe, the assistant](https://usewrit.app/docs/scribe).

**Harvest** collects many pages of one site into a **dataset**, one row per page.
You use it for catalogs, job boards, articles or documentation. A harvest can run again to refresh the
data, and **Make callable** gives it an API address.

A **monitor** checks one page on a schedule and reacts when the part you watch changes: it can
notify you, run a workflow, wake an AI agent or call a webhook. Monitors live under **Monitors**.

An **automation** joins events to steps: when something happens (a schedule, a webhook, a
finished run, a changed page), it runs the steps you chose, such as running a workflow or sending a
notification.

**Outputs** is where results land: the saved data of each API and each harvest. You can
search it, download it as CSV, JSON, Markdown or HTML, or read it over the API. See [Outputs and exports](https://usewrit.app/docs/storage).

## Sign-ins and secrets

A **persona** is a saved sign-in for one site, made from your own account. Writ uses it to sign
in as you when a page is behind a login. A persona can also supply the second factor: a code from an
authenticator, or a code sent by email or SMS. You manage personas under **Personas**.

A **secret** is a value you don’t want to paste into steps, such as an API key or a password.
It sits in **Secrets**, and steps refer to it by name, for example `{{vault:shop_api_key}}`.

Where a sign-in is kept depends on where it runs. Logins kept in Writ Cloud need the Starter plan or higher.
On Writ Desktop, logins stay on your computer, cost nothing, and have no limit.

> **note:** Writ runs on your own accounts, with your own credentials and data, on sites you are authorized to use.

## Credits and where it runs

Writ runs in two places. **Writ Cloud** runs on Writ’s servers, works while your computer is
off, and counts usage in **credits**. **Writ Desktop** runs on your computer, over
your own internet connection, and is free. You can also connect your own servers with the open-source
agent. A computer or server connected to your account is a **linked machine**.

Each API has an **Execution target** on its **Call** tab: **Writ Cloud**, **Local agent** (a linked machine), or **Auto (local, else cloud)**.
Runs on a linked machine are free.

Each plan includes credits every month. A call that fails because of the site or Writ costs nothing. A
build by Writ’s own AI counts against the **Writ AI builds per month** each plan includes; past them a build is a flat credit price, charged in full only when it delivers a working API; a build you stop pays what it used, never more than its price. See [Cloud or Desktop](https://usewrit.app/docs/where-it-runs) and [Credits and plans](https://usewrit.app/docs/billing-wallet).

## Glossary

| Term | Meaning | Where you see it |
| --- | --- | --- |
| API | A set of functions Writ built for a website | APIs |
| Workflow | Another name for an API in some screens, endpoints and AI tools; also what a recording makes | APIs, Edit workflow |
| Function | One callable operation of an API, with inputs and an output | An API’s Functions tab |
| Input | A value the caller passes to a function | Functions tab; the request body |
| Run | One execution of a function, workflow, monitor check or harvest | Runs |
| Execution target | Where an API runs: Writ Cloud, a linked machine, or the machine first | An API’s Call tab |
| Scribe | The AI assistant inside Writ that builds and sets things up | Scribe in the sidebar (⌘J) |
| Harvest | A collection of many pages of one site | Harvest |
| Dataset | Rows saved by an API or a harvest | Outputs |
| Monitor | A scheduled check of a page that reacts when it changes | Monitors |
| Automation | Steps that run when an event happens | Automations |
| Persona | A saved sign-in for one site | Personas |
| Secret | A stored key or password that steps refer to by name | Secrets |
| Hand-off | A run that pauses until you solve a CAPTCHA, sign in or enter a code | Runs, Solve |
| Credit | The unit Writ Cloud usage is counted in | Billing & Usage |
| Writ AI build | An API built by Writ’s own AI; each plan includes a number a month | Billing & Usage, Limits |
| Linked machine | Writ Desktop or the open-source agent, connected to your account | Agents |
| MCP | The protocol AI assistants use to call tools | Developers, Endpoints, MCP tools |

## Next

-
- [Choose how to start](https://usewrit.app/docs/choosing-a-method): Website to API, Record, Harvest or Monitor: which one fits the job.
-
- [Cloud or Desktop](https://usewrit.app/docs/where-it-runs): What changes between Writ’s servers and your computer.
-
- [Test and edit an API](https://usewrit.app/docs/functions): Functions, inputs, outputs and the Call tab in detail.
-
- [Sign-ins and secrets](https://usewrit.app/docs/personas): Personas, 2FA codes and the secrets vault.
