Reference Workflows 06 / 06
API call step
Make an HTTP request from inside the page session. A step a recorded Writ workflow can run, with its fields and an example.
On this page
The api_call step performs an HTTP request from inside the live page, so it carries the session's cookies — often faster and more robust than driving the UI, especially against endpoints discovered from the site's own network traffic.
In a workflow, this step is a JSON object with "type": "api_call". Steps run in order, and each step can read the outputs of the steps before it.
Fields
Set these inside the step’s config object.
-
urlstring required - The endpoint URL (placeholders supported).
-
methodstring - GET, POST, PUT, PATCH, or DELETE.
-
headersmap - Request headers; reference
{{vault:name}}secrets, never inline them. -
bodyjson - Request body for write methods;
{{extracted:key}}values from earlier steps resolve here.
Example
One api_call step, as it appears in the steps list of a workflow.
{
"type": "api_call",
"config": {
"method": "GET",
"url": "https://example.com/api/products?page={{page}}",
"headers": { "Authorization": "Bearer {{vault:api_token}}" }
}
} How it behaves
- Runs as an in-page request, so the logged-in session from earlier steps is reused.
- Response values can be named and chained into later steps as
{{extracted:key}}. - Only call endpoints on services you are authorized to use.
Where it runs
The step runs wherever its workflow runs. On Writ Desktop, runs are free and can reach systems that only your own network can reach.
On Writ Cloud, each call costs credits: 20 when the run needs a browser, 2 when it does not. A call that fails because of the site or Writ costs nothing.
Related steps
- Login (request)
login_postSign in as a request instead of a DOM form, on your own account. - Evaluate (JS)
evaluateRun JavaScript in the page and capture its result. - Extract
extractPull structured data out of the page into named fields.
Next
- 01 All workflow steps The full step list, grouped by family.
- 02 Record a workflow Show Writ the clicks once in a real browser, then replay them with new inputs on demand or on a schedule.
- 03 Call your API Run an API over REST from any language: endpoints, keys, waiting for results, caching and responses.
- 04 Credits and plans What each call, page and check costs in credits, what plans include, and what happens at zero.