Switchbar API

Switchbar has a URL-based API. Opening a specially formatted URL will cause Switchbar to get into action, and send a link to the right browser or email client (or prompt user to pick one).

A Switchbar API URL looks like this: switchbar://api-method/web-url. The web-url part tells Switchbar which web address it should open, and the api-method part tells Switchbar what to do with it.

Here's a real example: switchbar://open/https://webcatalog.io. Opening that URL will tell Switchbar to prompt you to select from all of your browsers, and to open https://webcatalog.io in the browser you pick.

API Methods

| API Method | Description | Example | | ------------ | ---------------------------------------------------------------- | ---------------------------------------- | | open | Switchbar should decide what to do based on the user's settings. | switchbar://open/https://webcatalog.io |

Using the API

Exactly how you trigger the API will depend on the programming tools that you are using. To get you started, here are a few examples:

  • From the Terminal, or in a shell script, you can use the Choosy API via the open command:
open switchbar://open/https://example.com
set switchbar_url to "switchbar://open/https://example.org"
open location switchbar_url
  • In a browser, browser extension, or bookmarklet, you can set the window's location:
const url = "switchbar://open/https://example.com";
window.location.href = url;
let url: URL! = URL(
    string: "switchbar://open/https://example.com"
NSWorkspace.shared.open(url: url)

Choosy API Compatibility

Switchbar also supports Choosy API so it will work with Choosy browser extensions and any applications that support Choosy.