This post discusses a convenient way to query, explore and test the REST API exposed by the Couchbase Mobile Sync Gateway using the Postman Chrome Developer tool. Sync Gateway exposes a REST, Batch & Stream interface that allows clients interact with it over the Internet.


NOTE:  We will be discussing Couchbase Mobile v1.4 which is the current production release. There is a newer Developer Preview version 2.0 of Couchbase Mobile



Couchbase Sync Gateway is part of the Couchbase Mobile stack and is an Internet-facing synchronization mechanism that securely syncs data across devices as well as between devices and the cloud. There are two ports over which the Sync Gateway listens to requests- The Admin port (defaults to 4985) and the Public port (defaults to 4984). In production deployments, the admin port is typically blocked from access over the Internet.

Installation of Couchbase Sync Gateway

Please follow instructions in the blog post to install the the Sync Gateway in your Mac OS development environment. See the downloads site for all the available packages, and the full installation guide for complete details. To install on Linux distributions other than the supported ones, see this post.


Installation of Postman

Postman is a Chrome Developer tool that can be downloaded for free from the Chrome browser web store .

Using Postman to Query the Couchbase  Sync Gateway

  • Get the Postman collections

The Postman collection files and environment definition for the Admin and Public interface of the Sync Gateway is available for download from this Github Repo.

There should be three files:-


This is the Portman collection corresponding to the Admin interface of the Sync Gateway


This is the Portman collection corresponding to the Public interface of the Sync Gateway


This is the Environment Definitions file that defines the variables used by the Admin and Public collections

Launch the Postman App

  • Import the collections

Follow the steps in the video below to import the collections that were downloaded in the previous step.

Importing Sync gateway postman collections

  • Import the environment file

Follow the steps in the video below to import the environment definition corresponding to the Postman collections

Importing the Environment Definition for Admin and Public Interfaces

Importing the Environment Definition for Admin and Public Interfaces

  • Set the appropriate environment

Follow the steps in the video below to set the environment to the one that you just imported. Update the values of the variables to suit your environment. Make sure that the adminurl points to the Sync Gateway at Admin Port and the publicurl variable points to the Sync Gateway at Public port. It defaults to http://localhost:4985 and http://localhost:4984 respectively.

Setting the Postman Environment

  • That’s it!  Run your queries

The following is a demonstration of running a request on the Admin Interface

Querying the Admin Interface of Sync Gateway

Querying the Admin Interface of Sync Gateway


The following is a demonstration of running a request on the Public Interface. Make sure you set the authorization header is set appropriately to use the appropriate authentication mechanism.

Querying Sync Gateway Public Interface

Querying the Public Interface of Sync Gateway

CLI Option

If you are interested in executing the Postman Collection from the command line interface, which may be the case for instance, if you want to integrate this as part of your Continuous Integration process, then you should check out  Newman, which is CLI runner for Postman.

For example, the command below will run the Sync-Gateway-Admin.postman_collection with the Sync-Gateway-Environment file.

If your Sync Gateway is running with SSL enabled and is using a self-signed certificate, the “-k” option will suppress validation of the cert (“insecure” SSL connection). This is not recommended in production environments.




Next Steps

The Postman Collections provide an easy way to query, explore and test the REST interface exposed by the Sync Gateway. If you see an issue in the collections definitions or if you would like to enhance it, please submit a Pull Request to the Github Repo.

If you have further questions, feel free to reach out to me at Twitter @rajagp or email me

The Couchbase Mobile Dev Forums is another great place to get your mobile related questions answered .

Also, checkout out the Couchbase Sync Gateway API Definitions for details on the web interface.


Posted by Priya Rajagopal, Developer Advocate, Couchbase

Priya Rajagopal is a Mobile Developer Advocate for Couchbase, living in Ann Arbor, MI. She has been professionally developing software for over 18 years and was most recently the Director of Mobile Development at a startup. Although her current interests lie in mobile development, she has previously worked on a range of technologies including IPTV, Social TV, targeted advertising, network management , RESTful architectures and platform security. As a TISPAN IPTV standards delegate, she was a key contributor to the IPTV architectural specifications. She has spent a decade in software R&D and is a co-inventor on almost 2 dozen US patents.


  1. good example, postman is a good tools to understand Sync Gateway REST API, it is also a good test tools to test your Sync Gateway business logic.
    If you like CLI to run test user case,I recommend [newman]( to run postman collections,which was the tools I am using for test my sync gateway logic.
    I want to share a little tips for using newman to test sync gateway logic:
    add 300ms for –delay-request to avoid query _changes feed with “normal” and “since” returns empty results first time.
    see also

    1. Priya Rajagopal April 18, 2017 at 7:56 am

      Thanks ! Good point. I have added a section on CLI option

Leave a reply