Build Run and maintain 08 / 11
Keep an API working
Daily checks, automatic repairs, and what to do when a call starts failing.
On this page
Websites change their pages, their requests and their sign-in. When they do, a function that worked yesterday can fail or come back empty. Writ watches every run, can repair an API on its own, and tells you when it needs you.
What Writ checks on its own
- Every run. Writ records whether it succeeded and, if not, why: the site changed, the run was signed out, a security check, a block, a timeout or a bad input. The API’s Overview shows the result, for example Last run failed or Failing ×3.
- Direct requests. Many functions call the site’s own requests without a browser. When such a request stops returning the expected data, the run falls back to a browser so you still get your data, and Writ notes why. With automatic repair on, that note starts a repair. Until then, these calls can cost the browser price, 20 credits instead of 2.
- Marketplace listings. Once a listing has been installed, Writ calls it once a day with the saved example inputs of its cheapest function and shows the result as its Health. These checks are free for the creator and for everyone who installed it.
- Monitors repair their own selectors; see Monitor a page.
Automatic repair
With AI Auto-Repair on, Writ fixes an API as soon as a run fails in a way that points to a change on the site. Repairs are free.
-
Turn it on
On the API’s Overview, open Advanced — how it runs. Under Venue & reliability, pick AI Auto-Repair and click Enable Auto-Repair. After a failure, the Overview also offers it directly: Auto-repair broken steps → Enable. It is off by default for your own APIs and on by default for APIs you publish on the marketplace.
-
Writ repairs the broken part
- For a function that uses the site’s requests, Writ opens the site in a browser, finds the request that now carries the data, and rebuilds the function with the same name and inputs. Only a replacement that passes a live test is saved, and a fresh run proves it.
- For browser steps, Writ finds an element that moved during the run itself. If the site’s flow changed, it records the workflow again from the entry URL, with its saved login.
-
You see what changed
You get a Run auto-repaired notification. The Overview shows Auto-repair with the number of repairs and the time of the last one; View the log lists the runs involved, and a repaired run reads Failed (repaired). If a repair fails, the run is marked AI auto-repair tried and could not fix it on the Runs page, and Repair failed appears under Needs attention on Home.
When a run fails
- Notifications. Run failed arrives in the app and by email, and says what happens next, for example that a repair is already running. Run needs you means a run is paused on a security check, a code or a sign-in. Scheduled run skipped means a scheduled run could not start, for example with no credits left. Choose channels in Alerts and notifications.
- Runs page. Filter by status (Failed, Paused and others), by type and by time. On a row, Solve opens a paused run that is waiting for you, Watch shows a running one live, and the menu has View details, View data and Cancel run.
- What stopped it. A run that ended on the site’s side says so in plain words: Security check not passed, Verification code not entered, Signed out of the site or Blocked by the site, with the reason, such as Nobody answered in time or API calls never wait for you.
A run started with an API key or a webhook never pauses for a person: it fails at once and says why. Runs from the app, a schedule or your assistant hand the browser to you instead. See Blocks, CAPTCHAs and hand-offs.
Troubleshooting
| What you see | Likely cause | What to do |
|---|---|---|
| “A step could not find its element on the page”, or fields that used to be filled come back empty. | The site changed its page. | Turn on AI Auto-Repair, or tell Scribe what is wrong. Verify with a deep pass on the Overview re-tests every function. |
| “The run returned no usable data”, or a success with zero results on a search that should match. | The site changed its requests, or the run was signed out without an error. | Check the persona first, then repair. From your assistant, run the diagnosis below. |
| Signed out of the site, or “The sign-in was rejected”. | The saved login expired or its password changed. | Writ signs in again on its own when a session expires. If the sign-in itself is refused, update the login in the persona. See Sign-ins and secrets. |
| Verification code not entered. | The site asked for a 2FA code and nobody gave it in time. | Set up the persona’s 2FA (authenticator, email or SMS) so Writ gets the code itself. |
| Security check not passed. | A CAPTCHA that the run could not pass alone. | Solve it when the run hands it to you. Paid CAPTCHA solving, on Pro and up, adds 10 credits to the call. See Blocks, CAPTCHAs and hand-offs. |
Blocked by the site, or an answer with site_block. | The site refuses connections from data centers. | Pick one of the offers: a plan with residential connections, Writ Desktop over your own connection, or credits. See Blocks, CAPTCHAs and hand-offs. |
| “An input did not meet the workflow’s rules”. | A value the caller sent has the wrong format or is missing. | Check the function’s inputs on the Documentation tab, which lists the values each one accepts. |
“The page did not load in time”, or a 504 from your endpoint. | A slow site, or a run longer than the endpoint’s wait. | Call it with Return immediately and collect the result later. A cloud run lasts at most 15 minutes. See Call your API. |
A 402 error, or Scheduled run skipped. | No credits left. | Wait for the monthly credits, add funds, upgrade, or run it on Writ Desktop for free. See Credits and plans. |
Fix it from your AI assistant
With Writ connected to your assistant over MCP, you can ask it to find and fix the problem. Two tools do the work:
writ_diagnose_http_workflowchecks a saved API (workfloworworkflow_id). Given a run (task_id), it shows what each request of that run got back, which is the first clue when a run returned nothing. An empty answer with status 200 usually means the site stopped serving the session, for example signed out or blocked, not that nothing matched.writ_update_workflowreads the API and edits it. Called without changes, it returns an outline with step ids. Withfunction_updatesit changes one function, andvalidate_onlychecks a change without saving it. Saving runs nothing.
My Writ API "Hacker News" returned no stories on its last run.
Find out why with writ_diagnose_http_workflow, fix the broken function
with writ_update_workflow, then run it once to prove the fix.
The assistant diagnoses, edits, then runs the API with writ_run_workflow to prove the fix.
Its own model does the work, so this uses your assistant’s tokens, not Writ’s AI. Every tool is listed in MCP tools.