API Client
A built-in API client for testing and managing REST endpoints directly inside your workspace.
Opening the API View
- Click API (Webhook icon) in the top bar
- Or press Cmd+8 (Mac) / Ctrl+8 (Windows/Linux)
- Or go to View → API in the menu bar
Base URLs
- Click Add Base URL to create one (e.g.,
https://api.example.com) - Give it a name (e.g., "Production", "Staging", "Local")
- Click a base URL to see its endpoints
- You can have multiple base URLs
Endpoints
- Click Add Endpoint to create one
- Set the method (
GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS) - Set the path (e.g.,
/users/:id) - Click Run (play button) to execute
Path Parameters
Use :param in the path and add a matching key in the Params tab:
- Path:
/api/posts/:id - Params:
id = 3 - Result:
GET /api/posts/3
The param is consumed by the path and won't appear in the query string.
Query Parameters
Any param that doesn't match a :param in the path becomes a query parameter:
- Path:
/api/posts - Params:
page = 1,limit = 10 - Result:
GET /api/posts?page=1&limit=10
Headers
Add custom headers in the Headers tab. Each header has an enable/disable checkbox.
Body
The Body tab appears only for methods that support it (POST, PUT, PATCH).
| Type | Use for |
|---|---|
| none | No body |
| json | JSON payload — {"key": "value"} |
| text | Raw text |
| form | URL-encoded form fields (key-value pairs) |
| multipart | File uploads + text fields |
For multipart, click Text Field or File to add fields. Use Browse to pick files.
Variables
Use {{VAR_NAME}} in any field — headers, params, body, even the URL path.
From .env File
Create a .env file in your project root:
API_KEY=sk-live-abc123
AUTH_TOKEN=Bearer eyJhbGciOi...Then use in headers:
Authorization: {{AUTH_TOKEN}}
X-API-Key: {{API_KEY}}Variables are resolved at request time. The .env value is never saved in the collections file — only {{VAR_NAME}} is stored.
From Pre-request Chain
Variables can also come from previous API responses. See the Pre-request Chain section below.
Pre-request Chain
Each endpoint can have steps that run before the main request. Use this for auth flows.
Set Up a Chain
Open an endpoint and click the Pre-request tab.
Add a Step
Select an endpoint from the dropdown (e.g., POST /auth/login).
Extract Variables
Click Add extraction under the step. Set: TOKEN ← $.accessToken
Use the Variable
In the Headers tab, set: Authorization = Bearer {{TOKEN}}
JSON Path Syntax
| Path | Extracts from |
|---|---|
$.token | { "token": "abc" } |
token | Same ($ is optional) |
$.user.id | { "user": { "id": 42 } } |
$.data[0].name | { "data": [{ "name": "first" }] } |
accessToken | { "accessToken": "eyJ..." } |
Multiple Steps
Steps run in order. Variables accumulate:
- Step 1:
POST /auth/login→ extractTOKEN - Step 2:
GET /api/posts→ extractPOST_ID(uses{{TOKEN}}from step 1) - Main:
GET /api/posts/:id(uses{{TOKEN}}and{{POST_ID}})
Error Handling
- If a step fails (non-2xx), the chain stops by default
- Toggle Skip on error on a step to continue past failures
- Failed steps show a red dot; successful ones show green
Run All
Click Run All to execute all endpoints sequentially (top to bottom).
- Shows progress:
(3/10) - Click Stop to cancel mid-run
- After completion, a Report appears with:
- Pass/fail count and total time
- Per-endpoint status and timing
- Click to expand details
- Copy button copies the full report in markdown format
Managing Endpoints
Drag to Reorder
Drag endpoints by the grip handle on the left to change order. Order is saved and used by Run All.
Duplicate Endpoint
Click the copy icon on an endpoint to duplicate it. The copy appears right after the original. If an endpoint with the same method + path already exists, it skips.
Send to Agent
When a request returns an error (4xx/5xx), click Send to Agent in the response area. It prefills the AI sidebar with the full error context — method, URL, status, and response body.
/api Slash Command
Type /api in the AI chat to let the agent scan your project and automatically populate the API view.
- Type
/apiin the agent input - Optionally describe what to scan:
/api scan all REST endpoints in src/routes - The agent reads your code, finds API endpoints, and adds them to the API view
- It sets up methods, paths, headers, params, and body templates automatically
The AI agent can only interact with the API view when you use the /api slash command. Every time you want the agent to add, update, or run endpoints, you must start your message with /api. Without it, the agent does not have access to API tools like addApiCollection, updateApiEndpoint, and runApiEndpoint.
Refresh
Click the refresh icon in the header to reload collections from the file. Use this if the file was edited externally or deleted.
Storage
Collections are saved at {project}/.invoke/api-collections.json:
- Auto-saves on every edit (debounced 500ms)
- Per-project — each project has its own collections
- Git-trackable — share with your team
Don't commit secrets. Use {{VAR}} with a .env file and add .env to your .gitignore.
Keyboard Shortcut
| Action | Mac | Windows/Linux |
|---|---|---|
| Open API view | Cmd+8 | Ctrl+8 |