REST API Access
Sync Gateway REST API Access
Shows how to access Sync Gateway APIs
Related REST API topics: Public REST API | Admin REST API | Metrics REST API | Use the REST API?
Sync Gateway REST APIs are accessed on different TCP ports. This makes it easy to expose the Public REST API and Metrics REST API (if activated) to endpoints while keeping the Admin REST API secure behind your firewall.
If you want to change the ports, you can do that in the configuration file, so:
-
To change the Public REST API port, set the
interface
property in the configuration file. -
To change the Metric REST API port, set the
metricsInterface
property in the configuration file. -
To change the Admin REST API port, set the
adminInterface
property in the configuration file.
The value of the property is a string consisting of a colon followed by a port number (for example, :4985
).
You can also include a host name or numeric IP address before the colon to bind only to that network interface.
As a useful special case, the IP address 127.0.0.1 binds to the loopback interface, making the port unreachable from any other host. This is the default setting for the admin interface.
Sync Gateway uses specific ports for communication with the outside world, mostly Couchbase Lite databases replicating to and from Sync Gateway — see Table 1 for details.
Port | Description |
---|---|
4984 |
Public port. External HTTP port used for replication with Couchbase Lite databases and other applications accessing the REST API on the Internet. The Public REST API is used for client replication. The default port for the Public REST API is 4984. |
4985 |
Admin port. Internal HTTP port for unrestricted access to the database and to run administrative tasks. The Admin REST API is used to administer user accounts and roles. It can also be used to look at the contents of databases in superuser mode. The default port for the Admin REST API is 4985. By default, the Admin REST API is reachable only from localhost for safety reasons. |
4986 |
Metrics port.
By default The Metrics REST API returns Sync Gateway metrics, in JSON and-or Prometheus-compatible formats, for performance monitoring and-or diagnostic purposes, |