Mark Johnson edited this page Sep 15, 2013 · 15 revisions

Bittorrent Sync API

Bittorrent Sync provides an API though a local HTTP server. This allows you to request data about the current status of Bittorrent Sync and issue commeands. The Web UI uses this API, as does btsyncindicator. The API is undocumented, so this documentation was created from my observations using Firebug.

Using the API

The API can be used by sending a GET request to the root URL of the Web UI running on the HTTP server with a query string containing a token, the requested action, and any additional parameters. Each action returns a JSON object.

Session Initialisation

Before any actions can be requested, the session must be initialised. This process provides a session cookie and token that must be sent with any subsequent action requests.

  1. Send a POST request to http://localhost:8888/gui/token.html (where localhost:8888 is the listen address in your Bittorrent Sync configuration).
  2. The response will contain <html><div id='token'>random string here</div></html>. Extract the random string, this is your token.
  3. The response will also contain a cookie called GUID. This is your session cookie, which must be sent with all HTTP requests in this session.


Documentation for actions marked * is incomplete