Automate Vela with its local API: a quick start

Turn on Vela's local REST API on your Mac, then open a tab, read a page and save a screenshot with curl. Covers WebSocket events and how to keep it safe.

Updated 16 November 2026 6 min read Mac

Vela for Mac has an automation API built in. It is a small HTTP server inside the browser that lets your scripts open tabs, read pages, click, type and take screenshots, without a driver or an extension. It is off until you turn it on, it listens only on your own Mac by default, and every request needs a key. This quick start takes you from the switch in Settings to a saved screenshot, using nothing but curl.

Turn on the Automation API

  1. Choose Vela → Settings… from the menu bar, or press ⌘,, and open Automation in the sidebar.
  2. Switch on Enable Automation API. The status line under it turns green and reads Running on port 1306.
  3. Under Authentication, click the copy button next to API Key. Vela creates a key for you the first time you enable the API. Generate replaces it with a new one.

These are the settings you start with:

SettingDefault
Port1306
Bind AddressLocalhost Only (127.0.0.1)
API KeyA random 32-character key, made for you

Once the API is on, it starts again by itself each time you open Vela, until you switch it off.

Make your first request

Open Terminal, store the key in a variable so you do not have to paste it into every command, and ask the browser how it is doing:

export VELA_API_KEY="paste-your-key-here"

curl -H "X-API-Key: $VELA_API_KEY" http://127.0.0.1:1306/api/status

The answer is JSON:

{
  "status": "ok",
  "tabCount": 3,
  "uptime": 12.4,
  "version": "1.5.302",
  "windowCount": 1
}

If you see Unauthorized: Invalid or missing API key with status 401, the key in your variable does not match the one in Settings. When the API is running, the Automation pane also shows a ready-made Quick Start command with your key filled in, which you can copy as it is.

Open a tab and read the page

Create a tab by sending a URL to /api/tabs:

curl -X POST http://127.0.0.1:1306/api/tabs \
  -H "X-API-Key: $VELA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}'

Vela opens the tab in one of your open windows (add a windowId to choose which) and answers with the tab as JSON: its id, windowId, title, url, isLoading and a few more fields. Copy the id, because every page request uses it:

TAB="paste-the-tab-id-here"

# Wait until the page has finished loading
curl -X POST http://127.0.0.1:1306/api/tabs/$TAB/wait-for-load-state \
  -H "X-API-Key: $VELA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"state":"load"}'

# Read the visible text of the page
curl -H "X-API-Key: $VELA_API_KEY" http://127.0.0.1:1306/api/tabs/$TAB/text

The first call answers {"ready": true, "state": "load"} when the page is done. The second returns the page's text in a text field. To send the same tab somewhere else, post a new URL to /api/tabs/$TAB/navigate with the same {"url": "..."} body.

Save a screenshot

The screenshot endpoint returns the image as base64 inside JSON, in a field called data. Two tools that ship with macOS turn that into a PNG file:

curl -s -H "X-API-Key: $VELA_API_KEY" \
  http://127.0.0.1:1306/api/tabs/$TAB/screenshot \
  | plutil -extract data raw -o - - \
  | base64 --decode > page.png

Swap screenshot for pdf and page.png for page.pdf to save the page as a PDF the same way.

Click, fill in forms and run JavaScript

Page actions take a CSS selector in a JSON body. These are the ones you will use most:

RequestBodyWhat it does
POST /api/tabs/:id/clickselectorClicks the first element that matches.
POST /api/tabs/:id/fillselector, valueSets a field's value and fires its input and change events.
POST /api/tabs/:id/typeselector, textTypes text into a field one character at a time.
POST /api/tabs/:id/waitselector, timeoutWaits until the element appears, 10 seconds unless you say otherwise.
POST /api/tabs/:id/executescriptRuns JavaScript in the page and returns its result.
GET /api/tabs/:id/snapshotNoneLists headings, readable text and the visible interactive elements.
DELETE /api/tabs/:idNoneCloses the tab.

The snapshot is handy when you do not know a page's markup. Each interactive element comes back numbered and stamped with a data-vela-ref attribute, so you can click element seven with the selector [data-vela-ref="e7"] instead of guessing at class names.

The same style of request covers windows, profiles, bookmarks, history, downloads and cookies. The API docs list every endpoint with its parameters.

Listen for events over WebSocket

Polling works, but the browser can also tell you when something happens. Connect a WebSocket client to the same port and pass the key as a query parameter:

const ws = new WebSocket("ws://127.0.0.1:1306/api/events?apiKey=YOUR_KEY");

ws.onmessage = (message) => {
  const event = JSON.parse(message.data);
  console.log(event.type, event.data);
};

Each message has a type, a data object and a timestamp. Types include tab.created, tab.closed, navigation.changed, page.loading, page.loaded, download.started and download.completed, so a script can wait for a page to finish instead of guessing how long to sleep.

Keep the API safe

The API can do what you can do in the browser, including reading pages you are signed in to. A few habits keep that power on your side:

  • Stay on localhost. Leave Bind Address on Localhost Only (127.0.0.1). If you choose All Interfaces, Vela warns you that the API becomes reachable from your network.
  • Treat the key like a password. Keep it out of scripts you share and repositories you publish. Send it in the X-API-Key header rather than in the address, where it can end up in logs and shell history.
  • Rotate when in doubt. Generate makes a new key at once and the old one stops working.
  • Switch it off when you are done. With Enable Automation API off, nothing is listening.

Where to go next

With the API running, the built-in reference is one address away: open http://127.0.0.1:1306/api/docs in any browser, or click Open API Manual in the Automation pane. From here:

Questions, answered.

Does the Automation API work on iPhone or iPad?

No. The API server is part of Vela for Mac only. Vela on iPhone and iPad has no Automation settings and does not listen for requests.

Do I need to install a driver or a library first?

No. The server is inside the app, so anything that can send an HTTP request works: curl, a shell script, Python, JavaScript or an AI agent. There is no separate driver to download or keep in step with the browser.

Which port does the API use?

1306 by default, on 127.0.0.1. You can change the port in Settings, under Automation. A copy of Vela started in hidden or headless mode takes the port you pass with --port, or 1307 if you have never changed the port setting.

Why do I get a 401 Unauthorized answer?

The key is missing or does not match. Send it on every request in the X-API-Key header, and copy it again from Settings if you pressed Generate, because that replaces the old key.

Is this the same API that Vela AI's Browser Control uses?

Yes. Browser Control drives the browser through the Automation API, which is why Vela asks you to enable the API and set a key before the assistant can act for you.

Keep reading.

All guides
Developers

Run Vela in hidden or headless mode for scripts

Start Vela from Terminal with no window on screen, then drive it through the local API.

6 minMac
How the web works

Browser automation, explained: drivers, protocols and local APIs

What browser automation is for, the usual ways to do it, and where a local HTTP API in the browser itself fits.

6 minBlog
Profiles & network

How to keep work and personal apart with profiles

Give work, home and each project its own cookies and sign-ins, then switch between them from the toolbar.

6 minMac · iPhone · iPad