When the Zotero desktop application is running, it exposes a local HTTP server onDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/zotero/zotero-connectors/llms.txt
Use this file to discover all available pages before exploring further.
localhost:23119. The browser extension calls this server to save items, retrieve translator code, check the client’s availability, and exchange preferences. All communication is JSON-based and versioned via a dedicated API version header. The Zotero.Connector singleton (src/common/connector.js) is the single entry point through which the extension reaches this server.
API Version and Request Headers
Every request sent to the connector server includes three standard headers:X-Zotero-Version header lets the server detect version mismatches and respond with HTTP 412.
Zotero.Connector.callMethod(options, data, tab)
The primary method for making connector API calls:
Either a method name string or an options object with the following keys:
method— the API endpoint name (e.g."ping","saveItems")headers— additional HTTP headers merged onto the defaultsqueryString— raw query string appended to the URL (without leading?)timeout— request timeout in milliseconds (default15000)
Request body. When
null, a GET request is sent. When an object, it is JSON.stringify-ed and sent as a POST.The browser tab object. Used by the Google Docs integration to detect if the tab has been discarded during a long-running
document/ operation.responseText for non-JSON responses.
Connectivity State: isOnline
Zotero.Connector.isOnline tracks the live connection state:
| Value | Meaning |
|---|---|
null | Unknown (Chrome initial state — will be determined on first request) |
false | Desktop client is offline (default for Firefox and Safari) |
true | Desktop client is reachable |
isOnline trigger Zotero.Connector.onStateChange(version):
Zotero.Connector.checkIsOnline()
Sends a ping and returns true or false. A non-zero HTTP error status is treated as “online with an error” rather than offline:
Zotero.Connector.ping(payload)
Checks availability and processes server-side preferences in a single round trip:
ping with { activeURL: url } whenever the user navigates, allowing the desktop client to update its “active URL” display.
Preferences Processed from Ping
_processPreferences() reads the following boolean flags from response.prefs and stores them in Zotero.Connector.prefs:
Translator Hash Check
_processTranslatorHash() compares the hash returned in response.prefs.translatorsHash (or sortedTranslatorHash) against the connector’s locally computed hash. On mismatch, it immediately calls Zotero.Translators.updateFromRemote():
API Endpoints
ping
POST /connector/ping — Availability check. Returns prefs object including translator hash, feature flags, and user preferences. Also accepts { activeURL } to report the current tab URL.saveItems
POST /connector/saveItems — Save one or more translated items. Payload includes sessionID, uri, items array, cookie/detailedCookies, and an optional proxy.saveSnapshot / saveSingleFile
POST /connector/saveSnapshot or POST /connector/saveSingleFile — Save a full-page HTML snapshot captured by SingleFile. The saveSingleFile endpoint accepts snapshotContent in the body.getTranslatorCode
POST /connector/getTranslatorCode — Retrieve the JavaScript source for a translator by { translatorID }. Used as the first-choice code source before falling back to the remote repository.getTranslators
POST /connector/getTranslators — Returns the full translator metadata list from the desktop client. Used by Zotero.Repo.getTranslatorMetadataFromZotero().sessionProgress
POST /connector/sessionProgress — Polls attachment download progress for a given sessionID. Returns { items, done }.document/execCommand
POST /connector/document/execCommand — Google Docs integration: sends a word-processor command (e.g. insertCitation) to the desktop client.document/respond
POST /connector/document/respond — Returns the document-side response to a pending integration command. Used in the integration loop until command equals complete.Error Handling
callMethod maps HTTP status codes to typed errors:
Zotero.Connector.CommunicationError
| Status | Meaning |
|---|---|
0 | Network error / desktop client not running |
400–499 | Client-side error (bad request, not authorised, etc.) |
412 | Connector/client version mismatch |
500+ | Server-side error in the desktop client |
Cookie-Enriched Requests: callMethodWithCookies()
For save operations that may involve authenticated attachment downloads, the connector uses callMethodWithCookies() instead of the plain callMethod(). It collects the current tab’s cookies via browser.cookies.getAll() and adds them to the payload as detailedCookies and uri:
