A newer version of this documentation is available.

View Latest

Admin REST API (Static Page)

      +

      Description of the Sync Gateway Admin REST API, alternative representation as a static page

      Resources

      This section describes the operations available with this REST API. The operations are grouped in the following categories.

      Authentication

      Manage authentication

      OpenID Connect authentication initiation via Location header redirect

      GET /{db}/_oidc
      Description

      Called by clients to initiate the OpenID Connect Authorization Code Flow. Redirects to the OpenID Connect provider if successful.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      provider
      optional

      The OpenID Connect provider to use for authentication. The list of providers are defined in the Sync Gateway config. If left empty, the default provider will be used.

      String

      offline
      optional

      If true, the OpenID Connect provider is requested to confirm with the user the permissions requested and refresh the OIDC token. To do this, access_type=offline and prompt=consent is set on the redirection link.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      302

      Successfully connected with the OpenID Connect provider so now redirecting to the requested OIDC provider for authentication.

      400

      The provider provided is not defined in the Sync Gateway config. If no provided was specified then there is no default provider set.

      404

      Resource could not be found

      HTTP_Error

      500

      Unable to connect and validate with the OpenID Connect provider requested

      OpenID Connect authentication callback

      GET /{db}/_oidc_callback
      Description

      The callback URL that the client is redirected to after authenticating with the OpenID Connect provider.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      error
      optional

      The OpenID Connect error, if any occurred.

      String

      code
      required

      The OpenID Connect authentication code.

      String

      provider
      optional

      The OpenID Connect provider to use for authentication. The list of providers are defined in the Sync Gateway config. If left empty, the default provider will be used.

      String

      state
      optional

      The OpenID Connect state to verify against the state cookie. This is used to prevent cross-site request forgery (CSRF). This is not required if disable_callback_state=true for the provider config (NOT recommended).

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully authenticated with OpenID Connect.

      OpenID_Connect_callback_properties

      400

      A problem occurred when reading the callback request body

      401

      An error was received from the OpenID Connect provider. This means the error query parameter was filled.

      404

      Resource could not be found

      HTTP_Error

      500

      A problem occurred in regards to the token

      post_db__facebook_401_response

      OpenID Connect authentication initiation via WWW-Authenticate header

      GET /{db}/_oidc_challenge
      Description

      Called by clients to initiate the OpenID Connect Authorization Code Flow. This will establish a connection with the provider, then put the redirect URL in the WWW-Authenticate header.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      provider
      optional

      The OpenID Connect provider to use for authentication. The list of providers are defined in the Sync Gateway config. If left empty, the default provider will be used.

      String

      offline
      optional

      If true, the OpenID Connect provider is requested to confirm with the user the permissions requested and refresh the OIDC token. To do this, access_type=offline and prompt=consent is set on the redirection link.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      400

      The provider provided is not defined in the Sync Gateway config. If no provided was specified then there is no default provider set.

      401

      Successfully connected with the OpenID Connect provider so now the client can login.

      404

      Resource could not be found

      HTTP_Error

      500

      Unable to connect and validate with the OpenID Connect provider requested

      OpenID Connect token refresh

      GET /{db}/_oidc_refresh
      Description

      Refresh the OpenID Connect token based on the provided refresh token.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      refresh_token
      required

      The OpenID Connect refresh token.

      String

      provider
      optional

      The OpenID Connect provider to use for authentication. The list of providers are defined in the Sync Gateway config. If left empty, the default provider will be used.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully authenticated with OpenID Connect.

      OpenID_Connect_callback_properties

      400

      The provider provided is not defined in the Sync Gateway config. If no provided was specified then there is no default provider set.

      404

      Resource could not be found

      HTTP_Error

      500

      Unable to connect and validate with the OpenID Connect provider requested

      OpenID Connect mock provider

      GET /{db}/_oidc_testing/.well-known/openid-configuration
      Description

      Mock an OpenID Connect provider response for testing purposes. This returns a response that is the same structure as what Sync Gateway expects from an OIDC provider after initiating OIDC authentication.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully generated OpenID Connect provider mock response.

      get_db__oidc_testing__well_known_openid_configuration_200_response

      403

      The OpenID Connect unsupported config option oidc_test_provider is not enabled. To use this endpoint, this option must be enabled.

      404

      Resource could not be found

      HTTP_Error

      OpenID Connect mock login page handler

      GET /{db}/_oidc_testing/authenticate
      Description

      Used to handle the login page displayed for the GET /{db}/_oidc_testing/authorize endpoint.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      redirect_uri
      optional

      The Sync Gateway OpenID Connect callback URL.

      String

      scope
      required

      The OpenID Connect authentication scope.

      String

      username
      required

      String

      tokenttl
      required

      Integer

      identity-token-formats
      required

      String

      authenticated
      required

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      302

      Redirecting to Sync Gateway OpenID Connect callback URL

      403

      The OpenID Connect unsupported config option oidc_test_provider is not enabled. To use this endpoint, this option must be enabled.

      404

      Resource could not be found

      HTTP_Error

      OpenID Connect mock login page

      GET /{db}/_oidc_testing/authorize
      Description

      Show a mock OpenID Connect login page for the client to log in to.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      scope
      required

      The OpenID Connect authentication scope.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      OK

      400

      A validation error occurred with the scope.

      HTTP_Error

      403

      The OpenID Connect unsupported config option oidc_test_provider is not enabled. To use this endpoint, this option must be enabled.

      404

      Resource could not be found

      HTTP_Error

      500

      An error occurred.

      HTTP_Error

      OpenID Connect public certificates for signing keys

      GET /{db}/_oidc_testing/certs
      Description

      Return a mock OpenID Connect public key to be used as signing keys.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Returned public key successfully

      get_db__oidc_testing_certs_200_response

      403

      The OpenID Connect unsupported config option oidc_test_provider is not enabled. To use this endpoint, this option must be enabled.

      404

      Resource could not be found

      HTTP_Error

      500

      An error occurred while getting the private RSA key

      post_db__facebook_401_response

      Create a new Facebook-based session

      POST /{db}/_facebook
      Description

      Creates a new session based on a Facebook user. On a successful session creation, a session cookie is stored to keep the user authenticated for future API calls.

      If CORS is enabled, the origin must match an allowed login origin otherwise an error will be returned.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      PostDbFacebookRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Session created successfully

      400

      Origin is not in the approved list of allowed origins

      HTTP_Error

      401

      Received error from Facebook verifier

      post_db__facebook_401_response

      404

      Resource could not be found

      HTTP_Error

      502

      Received invalid response from the Facebook verifier

      post_db__facebook_401_response

      504

      Unable to send request to Facebook API

      post_db__facebook_401_response

      Create a new Google-based session

      POST /{db}/_google
      Description

      Creates a new session based on a Google user. On a successful session creation, a session cookie is stored to keep the user authenticated for future API calls.

      If CORS is enabled, the origin must match an allowed login origin otherwise an error will be returned.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      PostDbGoogleRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Session created successfully

      400

      Origin is not in the approved list of allowed origins

      HTTP_Error

      401

      Received error from Google token verifier or invalid application ID in the config

      post_db__facebook_401_response

      404

      Resource could not be found

      HTTP_Error

      502

      Received invalid response from the Google token verifier

      post_db__facebook_401_response

      504

      Unable to send request to the Google token verifier

      OpenID Connect mock login page handler

      POST /{db}/_oidc_testing/authenticate
      Description

      Used to handle the login page displayed for the GET /{db}/_oidc_testing/authorize endpoint.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      Properties passed from the OpenID Connect mock login page to the handler

      PostDbOidcTestingAuthenticateRequest

      Query Parameters
      Name Description Schema

      redirect_uri
      optional

      The Sync Gateway OpenID Connect callback URL.

      String

      scope
      required

      The OpenID Connect authentication scope.

      String

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      302

      Redirecting to Sync Gateway OpenID Connect callback URL

      403

      The OpenID Connect unsupported config option oidc_test_provider is not enabled. To use this endpoint, this option must be enabled.

      404

      Resource could not be found

      HTTP_Error

      OpenID Connect mock login page

      POST /{db}/_oidc_testing/authorize
      Description

      Show a mock OpenID Connect login page for the client to log in to.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      scope
      required

      The OpenID Connect authentication scope.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      OK

      400

      A validation error occurred with the scope.

      HTTP_Error

      403

      The OpenID Connect unsupported config option oidc_test_provider is not enabled. To use this endpoint, this option must be enabled.

      404

      Resource could not be found

      HTTP_Error

      500

      An error occurred.

      HTTP_Error

      OpenID Connect mock token

      POST /{db}/_oidc_testing/token
      Description

      Return a mock OpenID Connect token for the OIDC authentication flow.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      PostDbOidcTestingTokenRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Properties expected back from an OpenID Connect provider after successful authentication

      OIDC_token

      400

      Invalid token provided

      403

      The OpenID Connect unsupported config option oidc_test_provider is not enabled. To use this endpoint, this option must be enabled.

      404

      Resource could not be found

      HTTP_Error

      Database Configuration

      Configure Sync Gateway databases

      Delete import filter

      DELETE /{keyspace}/_config/import_filter
      Description

      This will remove the custom import filter function from the database configuration so that Sync Gateway will not filter any documents during import.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Header Parameters
      Name Description Schema

      If-Match
      optional

      If set to a configuration's Etag value, enables optimistic concurrency control for the request. Returns HTTP 412 if another update happened underneath this one.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully deleted the import filter

      404

      Resource could not be found

      HTTP_Error

      412

      Precondition Failed The supplied If-Match header did not match the current version of the configuration. Returned when optimistic concurrency control is used, and there has been an update to the configuration in between this update.

      HTTP_Error

      Remove custom sync function

      DELETE /{keyspace}/_config/sync
      Description

      This will remove the custom sync function from the database configuration.

      The default sync function is equivalent to:

      function (doc) {
        channel(doc.channels);
      }
      

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Header Parameters
      Name Description Schema

      If-Match
      optional

      The revision ID to target.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully reset the sync function

      404

      Resource could not be found

      HTTP_Error

      412

      Precondition Failed The supplied If-Match header did not match the current version of the configuration. Returned when optimistic concurrency control is used, and there has been an update to the configuration in between this update.

      HTTP_Error

      Get database configuration

      GET /{db}/_config
      Description

      Retrieve the full configuration for the database specified.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      redact
      optional

      No longer supported field.

      Default: true

      Boolean

      include_javascript
      optional

      Include the fields that have Javascript functions in the response. E.g. sync function, import filter, and event handlers.

      Default: true

      Boolean

      include_runtime
      optional

      Whether to include the values set at runtime, and default values.

      Default: false

      Boolean

      refresh_config
      optional

      Forces the configuration to be reloaded on the Sync Gateway node.

      Default: false

      Boolean

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully retrieved database configuration

      Database_config

      404

      Resource could not be found

      HTTP_Error

      Get database import filter

      GET /{keyspace}/_config/import_filter
      Description

      This returns the database's import filter that documents are ran through when importing.

      Response will be blank if there has been no import filter set.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Produces
      • application/javascript

      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully retrieved the import filter

      String

      404

      Resource could not be found

      HTTP_Error

      Get database sync function

      GET /{keyspace}/_config/sync
      Description

      This returns the database's sync function.

      Response will be blank if there has been no sync function set.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Produces
      • application/javascript

      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully retrieved the sync function

      String

      404

      Resource could not be found

      HTTP_Error

      Update database configuration

      POST /{db}/_config
      Description

      This is used to update the database configuration fields specified. Only the fields specified in the request will have their values replaced.

      The bucket and database name cannot be changed. If these need to be changed, the database will need to be deleted then recreated with the new settings.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      The database configuration fields to update

      DatabaseConfig

      Header Parameters
      Name Description Schema

      If-Match
      optional

      If set to a configuration's Etag value, enables optimistic concurrency control for the request. Returns HTTP 412 if another update happened underneath this one.

      String

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      201

      Database configuration successfully updated

      400

      There was a problem with your request

      HTTP_Error

      404

      Not Found

      412

      Precondition Failed The supplied If-Match header did not match the current version of the configuration. Returned when optimistic concurrency control is used, and there has been an update to the configuration in between this update.

      HTTP_Error

      Replace database configuration

      PUT /{db}/_config
      Description

      Replaces the database configuration with the one sent in the request.

      The bucket and database name cannot be changed. If these need to be changed, the database will need to be deleted then recreated with the new settings.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      The new database configuration to use

      DatabaseConfig

      Header Parameters
      Name Description Schema

      If-Match
      optional

      If set to a configuration's Etag value, enables optimistic concurrency control for the request. Returns HTTP 412 if another update happened underneath this one.

      String

      Query Parameters
      Name Description Schema

      disable_oidc_validation
      optional

      If set, will not attempt to validate the configured OpenID Connect providers are reachable.

      Default: false

      Boolean

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      201

      Database configuration successfully updated

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      412

      Precondition Failed The supplied If-Match header did not match the current version of the configuration. Returned when optimistic concurrency control is used, and there has been an update to the configuration in between this update.

      HTTP_Error

      Set database import filter

      PUT /{keyspace}/_config/import_filter
      Description

      This will allow you to update the database's import filter.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      The import filter to use

      Example: body_example

      String

      Header Parameters
      Name Description Schema

      If-Match
      optional

      If set to a configuration's Etag value, enables optimistic concurrency control for the request. Returns HTTP 412 if another update happened underneath this one.

      String

      Query Parameters
      Name Description Schema

      disable_oidc_validation
      optional

      If set, will not attempt to validate the configured OpenID Connect providers are reachable.

      Default: false

      Boolean

      Produces
      • application/json

      Consumes
      • application/javascript

      Responses
      HTTP Code Description Schema

      200

      Updated import filter successfully

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      412

      Precondition Failed The supplied If-Match header did not match the current version of the configuration. Returned when optimistic concurrency control is used, and there has been an update to the configuration in between this update.

      HTTP_Error

      Set database sync function

      PUT /{keyspace}/_config/sync
      Description

      This will allow you to update the sync function.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      The new sync function to use

      ifeval::["function (doc, oldDoc) {
      channel(doc.channels);
      }" != "null"]
      Example: function (doc, oldDoc) {
      channel(doc.channels);
      }

      String

      Header Parameters
      Name Description Schema

      If-Match
      optional

      If set to a configuration's Etag value, enables optimistic concurrency control for the request. Returns HTTP 412 if another update happened underneath this one.

      String

      Query Parameters
      Name Description Schema

      disable_oidc_validation
      optional

      If set, will not attempt to validate the configured OpenID Connect providers are reachable.

      Default: false

      Boolean

      Produces
      • application/json

      Consumes
      • application/javascript

      Responses
      HTTP Code Description Schema

      200

      Updated sync function successfully

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      412

      Precondition Failed The supplied If-Match header did not match the current version of the configuration. Returned when optimistic concurrency control is used, and there has been an update to the configuration in between this update.

      HTTP_Error

      Database Management

      Create and manage Sync Gateway databases

      Remove a database

      DELETE /{db}/
      Description

      Removes a database from the Sync Gateway cluster

      Note: If running in legacy mode, this will only delete the database from the current node.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully removed the database

      Object

      404

      Resource could not be found

      HTTP_Error

      500

      Cannot remove database from bucket

      HTTP_Error

      Get a list of all the databases

      GET /_all_dbs
      Description

      This retrieves all the databases that are in the current Sync Gateway node. If verbose, returns bucket and state information for each database, otherwise returns names only.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      verbose
      optional

      Boolean

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully retrieved all database names

      get__all_dbs_200_response

      Get database information

      GET /{db}/
      Description

      Retrieve information about the database.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully returned database information

      get_db__200_response

      404

      Resource could not be found

      HTTP_Error

      Get the status of the most recent compact operation

      GET /{db}/_compact
      Description

      This will retrieve the current status of the most recent compact operation.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      type
      optional

      This is the type of compaction to use. The type must be either:

      • attachment for cleaning up legacy (pre-3.0) attachments
      • tombstone for purging the JSON bodies of non-leaf revisions.'

      Values: attachment, tombstone
      Default: tombstone

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Compaction status retrieved successfully

      Compact_status

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Get resync status

      GET /{db}/_resync
      Description

      This will retrieve the status of last resync operation (whether it is running or not) in the Sync Gateway cluster.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      successfully retrieved the most recent resync operation status

      Resync_status

      404

      Resource could not be found

      HTTP_Error

      Get changes list

      GET /{keyspace}/_changes
      Description

      This request retrieves a sorted list of changes made to documents in the database, in time order of application. Each document appears at most once, ordered by its most recent change, regardless of how many times it has been changed.

      This request can be used to listen for update and modifications to the database for post processing or synchronization. A continuously connected changes feed is a reasonable approach for generating a real-time log for most applications.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Query Parameters
      Name Description Schema

      limit
      optional

      Maximum number of changes to return.

      Integer

      since
      optional

      Starts the results from the change immediately after the given sequence ID. Sequence IDs should be considered opaque; they come from the last_seq property of a prior response.

      String

      style
      optional

      Controls whether to return the current winning revision (main_only) or all the leaf revision including conflicts and deleted former conflicts (all_docs).

      Values: main_only, all_docs
      Default: main_only

      String

      active_only
      optional

      Set true to exclude deleted documents and notifications for documents the user no longer has access to from the changes feed.

      Default: false

      Boolean

      include_docs
      optional

      Include the body associated with each document.

      Boolean

      revocations
      optional

      If true, revocation messages will be sent on the changes feed.

      Boolean

      filter
      optional

      Set a filter to either filter by channels or document IDs.

      Values: sync_gateway/bychannel, _doc_ids

      String

      channels
      optional

      A comma-separated list of channel names to filter the response to only the channels specified. To use this option, the filter query option must be set to sync_gateway/bychannels.

      String

      doc_ids
      optional

      A valid JSON array of document IDs to filter the documents in the response to only the documents specified. To use this option, the filter query option must be set to _doc_ids and the feed parameter must be normal. Also accepts a comma separated list of document IDs instead.

      String List

      heartbeat
      optional

      The interval (in milliseconds) to send an empty line (CRLF) in the response. This is to help prevent gateways from deciding the socket is idle and therefore closing it. This is only applicable to feed=longpoll or feed=continuous. This will override any timeouts to keep the feed alive indefinitely. Setting to 0 results in no heartbeat. The maximum heartbeat can be set in the server replication configuration.

      Default: 0
      Minimum: 25000

      Integer

      timeout
      optional

      This is the maximum period (in milliseconds) to wait for a change before the response is sent, even if there are no results. This is only applicable for feed=longpoll or feed=continuous changes feeds. Setting to 0 results in no timeout.

      Default: 300000
      Minimum: 0
      Maximum: 900000

      Integer

      feed
      optional

      The type of changes feed to use.

      Values: normal, longpoll, continuous, websocket
      Default: normal

      String

      request_plus
      optional

      When true, ensures all valid documents written prior to the request being issued are included in the response. This is only applicable for non-continuous feeds.

      Default: false

      Boolean

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully returned the changes feed

      get_keyspace__changes_200_response

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Check if database exists

      HEAD /{db}/
      Description

      Check if a database exists by using the response status code.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Database exists

      404

      Resource could not be found

      HTTP_Error

      /{db}/_changes

      HEAD /{keyspace}/_changes
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Responses
      HTTP Code Description Schema

      200

      OK

      400

      Bad Request

      404

      Not Found

      Manage a compact operation

      POST /{db}/_compact
      Description

      This allows a new compact operation to be done on the database, or to stop an existing running compact operation.

      The type of compaction that is done depends on what the type query parameter is set to. The 2 options will:

      • tombstone - purge the JSON bodies of non-leaf revisions. This is known as database compaction. Database compaction is done periodically automatically by the system. JSON bodies of leaf nodes (conflicting branches) are not removed therefore it is important to resolve conflicts in order to re-claim disk space.
      • attachment - purge all unlinked/unused legacy (pre 3.0) attachments. If the previous attachment compact operation failed, this will attempt to restart the compact_id at the appropriate phase (if possible).

      Both types can each have a maximum of 1 compact operation running at any one point. This means that an attachment compaction can be running at the same time as a tombstone compaction but not 2 tombstone compactions.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      type
      optional

      This is the type of compaction to use. The type must be either:

      • attachment for cleaning up legacy (pre-3.0) attachments
      • tombstone for purging the JSON bodies of non-leaf revisions.'

      Values: attachment, tombstone
      Default: tombstone

      String

      action
      optional

      Defines whether the a compact operation is being started or stopped.

      Values: start, stop
      Default: start

      String

      reset
      optional

      Attachment compaction only

      This forces a fresh compact start instead of trying to resume the previous failed compact operation.

      Boolean

      dry_run
      optional

      Attachment compaction only

      This will run through all 3 stages of attachment compact but will not purge any attachments. This can be used to check how many attachments will be purged.'

      Boolean

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Started or stopped compact operation successfully

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      503

      Cannot start compaction due to another compaction operation still running.

      HTTP_Error

      /{db}/_ensure_full_commit

      POST /{db}/_ensure_full_commit
      Description

      This endpoint is non-functional but is present for CouchDB compatibility.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      201

      OK

      post_db__ensure_full_commit_201_response

      Take the database offline

      POST /{db}/_offline
      Description

      This will take the database offline meaning actions can be taken without disrupting current operations ungracefully or having the restart the Sync Gateway instance.

      This will not take the backing Couchbase Server bucket offline.

      Taking a database offline that is in the progress of coming online will take the database offline after it comes online.

      Taking the database offline will:

      • Close all active _changes feeds for the database.
      • Reject all access to the database via the Public REST API (returning a 503 Service Unavailable code).
      • Reject most Admin API requests (by returning a 503 Service Unavailable code). The only endpoints to be available are: the resync endpoints, the configuration endpoints, DELETE, GET, HEAD /{db}/, POST /{db}/_offline, and POST /{db}/_online.
      • Stops webhook event handlers.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Database has been taken offline successfully

      404

      Resource could not be found

      HTTP_Error

      503

      An error occurred while trying to take the database offline

      HTTP_Error

      Bring the database online

      POST /{db}/_online
      Description

      This will bring the database online so the Public and full Admin REST API requests can be served.

      Bringing a database online will:

      • Close the database connection to the backing Couchbase Server bucket.
      • Reload the database configuration, and connect to the backing Couchbase Server bucket.
      • Re-establish access to the database from the Public REST API and accept all Admin API requests.

      A specific delay before bringing the database online may be wanted to:

      • Make the database available for Couchbase Lite clients at a specific time.
      • Make the databases on several Sync Gateway instances available at the same time.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      Add an optional delay to wait before bringing the database online

      PostDbOnlineRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Database will be brought online immediately or with the specified delay

      404

      Resource could not be found

      HTTP_Error

      503

      An error occurred

      HTTP_Error

      Start or stop Resync

      POST /{db}/_resync
      Description

      This can be used to start or stop a resync operation. A resync operation will cause all documents in the keyspace to be reprocessed through the sync function.

      Generally, a resync operation might be wanted when the sync function has been modified in such a way that the channel or access mappings for any existing documents would change as a result.

      A resync operation cannot be run if the database is online. The database can be taken offline by calling the POST /{db}/_offline endpoint.

      In a multi-node cluster, the resync operation must be run on only a single node. Therefore, users should bring other nodes offline before initiating this action. Undefined system behaviour will happen if running resync on more than 1 node.

      The requireUser() and requireRole() calls in the sync function will always return true.

      • action=start - This is an asynchronous operation, and will start resync in the background.
      • action=stop - This will stop the currently running resync operation.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      PostDbResyncRequest

      Query Parameters
      Name Description Schema

      action
      optional

      This is whether to start a new resync job or stop an existing one.

      Values: start, stop
      Default: start

      String

      regenerate_sequences
      optional

      Use this only when requested to do so by the Couchbase support team This request will regenerate the sequence numbers for each document processed. If scopes parameter is specified, the principal sequence documents will not have their sequences updated.

      Boolean

      reset
      optional

      This forces a fresh resync run instead of trying to resume the previous resync operation

      Default: false

      Boolean

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      successfully changed the status of the resync operation

      Resync_status

      503

      Service Unavailable

      HTTP_Error

      Get changes list

      POST /{keyspace}/_changes
      Description

      This request retrieves a sorted list of changes made to documents in the database, in time order of application. Each document appears at most once, ordered by its most recent change, regardless of how many times it has been changed.

      This request can be used to listen for update and modifications to the database for post processing or synchronization. A continuously connected changes feed is a reasonable approach for generating a real-time log for most applications.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      PostKeyspaceChangesRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully returned the changes feed

      get_keyspace__changes_200_response

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Compare revisions to what is in the database

      POST /{keyspace}/_revs_diff
      Description

      Takes a set of document IDs, each with a set of revision IDs. For each document, an array of unknown revisions are returned with an array of known revisions that may be recent ancestors.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      PostKeyspaceRevsDiffRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Comparisons successful

      post_keyspace__revs_diff_200_response

      404

      Resource could not be found

      HTTP_Error

      Create a new Sync Gateway database

      PUT /{db}/
      Description

      This is to create a new database for Sync Gateway.

      The new database name will be the name specified in the URL, not what is specified in the request body database configuration.

      If the bucket is not provided in the database configuration, Sync Gateway will attempt to find and use the database name as the bucket.

      By default, the new database will be brought online immediately. This can be avoided by including "offline": true in the configuration in the request body.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      The configuration to use for the new database

      DatabaseConfig

      Query Parameters
      Name Description Schema

      disable_oidc_validation
      optional

      If set, will not attempt to validate the configured OpenID Connect providers are reachable.

      Default: false

      Boolean

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      201

      Database created successfully

      400

      There was a problem with your request

      HTTP_Error

      403

      An authentication failure occurred

      HTTP_Error

      409

      A database already exists for this bucket

      HTTP_Error

      412

      A database under that name already exists

      HTTP_Error

      500

      A server error occurred

      HTTP_Error

      Database Security

      Create and manage database users and roles

      Delete a role

      DELETE /{db}/_role/{name}
      Description

      Delete a role from the database.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      name
      required

      The name of the role.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      OK

      404

      Resource could not be found

      HTTP_Error

      Delete a user

      DELETE /{db}/_user/{name}
      Description

      Delete a user from the database.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      name
      required

      The name of the user.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      User deleted successfully

      404

      Resource could not be found

      HTTP_Error

      Get all names of the roles

      GET /{db}/_role/
      Description

      Retrieves all the roles that are in the database.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      deleted
      optional

      Indicates that roles marked as deleted should be included in the result.

      Default: false

      Boolean

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Roles retrieved successfully

      Set

      404

      Resource could not be found

      HTTP_Error

      Get a role

      GET /{db}/_role/{name}
      Description

      Retrieve a single roles properties.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      name
      required

      The name of the role.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Properties associated with a role

      Role_1

      404

      Resource could not be found

      HTTP_Error

      Get all the names of the users

      GET /{db}/_user/
      Description

      Retrieves all the names of the users that are in the database.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      name_only
      optional

      Whether to return user names only, or more detailed information for each user.

      Default: true

      Boolean

      limit
      optional

      How many results to return. Using a value of 0 results in no limit.

      Integer

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Users retrieved successfully

      List

      404

      Resource could not be found

      HTTP_Error

      Get a user

      GET /{db}/_user/{name}
      Description

      Retrieve a single users information.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      name
      required

      The name of the user.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Properties associated with a user

      User_1

      404

      Resource could not be found

      HTTP_Error

      /{db}/_role/

      HEAD /{db}/_role/
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      OK

      404

      Resource could not be found

      HTTP_Error

      Check if role exists

      HEAD /{db}/_role/{name}
      Description

      Check if the role exists by checking the status code.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      name
      required

      The name of the role.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Role exists

      404

      Resource could not be found

      HTTP_Error

      /{db}/_user/

      HEAD /{db}/_user/
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      OK

      404

      Resource could not be found

      HTTP_Error

      Check if user exists

      HEAD /{db}/_user/{name}
      Description

      Check if the user exists by checking the status code.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      name
      required

      The name of the user.

      String

      Responses
      HTTP Code Description Schema

      200

      User exists

      404

      Not Found

      Create a new role

      POST /{db}/_role/
      Description

      Create a new role using the request body to specify the properties on the role.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      Properties associated with a role

      Role1

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      201

      New role created successfully

      404

      Resource could not be found

      HTTP_Error

      409

      Resource already exists under that name

      HTTP_Error

      Create a new user

      POST /{db}/_user/
      Description

      Create a new user using the request body to specify the properties on the user.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      Properties associated with a user

      User1

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      201

      New user created successfully

      404

      Resource could not be found

      HTTP_Error

      409

      Resource already exists under that name

      HTTP_Error

      Upsert a role

      PUT /{db}/_role/{name}
      Description

      If the role does not exist, create a new role otherwise update the existing role.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      name
      required

      The name of the role.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      Properties associated with a role

      Role1

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      OK

      201

      Created

      404

      Resource could not be found

      HTTP_Error

      Upsert a user

      PUT /{db}/_user/{name}
      Description

      If the user does not exist, create a new user otherwise update the existing user.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      name
      required

      The name of the user.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      Properties associated with a user

      User1

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Existing user modified successfully

      201

      New user created

      404

      Resource could not be found

      HTTP_Error

      Document

      Create and manage documents and attachments

      Delete a document

      DELETE /{keyspace}/{docid}
      Description

      Delete a document from the database. A new revision is created so the database can track the deletion in synchronized copies.

      A revision ID either in the header or on the query parameters is required.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The document ID to run the operation against.

      String

      Header Parameters
      Name Description Schema

      If-Match
      optional

      The revision ID to target.

      String

      Query Parameters
      Name Description Schema

      rev
      optional

      The document revision to target.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      New revision created successfully

      New_revision

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Delete an attachment on a document

      DELETE /{keyspace}/{docid}/{attach}
      Description

      This request deletes an attachment associated with the document.

      If the attachment exists, the attachment will be removed from the document.

      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The document ID to run the operation against.

      String

      attach
      required

      The attachment name. This value must be URL encoded. For example, if the attachment name is blob_/avatar, the path component passed to the URL should be blob_%2Favatar (tested with URLEncoder).

      String

      Header Parameters
      Name Description Schema

      If-Match
      optional

      An alternative way of specifying the document revision ID.

      String

      Query Parameters
      Name Description Schema

      rev
      optional

      The existing document revision ID to modify.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Attachment removed from the document successfully

      New_revision

      404

      Resource could not be found

      HTTP_Error

      409

      Resource already exists under that name

      HTTP_Error

      Delete a local document

      DELETE /{keyspace}/_local/{docid}
      Description

      This request deletes a local document.

      Local document IDs begin with _local/. Local documents are not replicated or indexed, don't support attachments, and don't save revision histories. In practice they are almost only used by Couchbase Lite's replicator, as a place to store replication checkpoint data.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The name of the local document ID excluding the _local/ prefix.

      String

      Query Parameters
      Name Description Schema

      rev
      required

      The revision ID of the revision to delete.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully removed the local document.

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      409

      A revision ID conflict would result from deleting this document revision.

      Gets all the documents in the database with the given parameters

      GET /{keyspace}/_all_docs
      Description

      Returns all documents in the database based on the specified parameters.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Query Parameters
      Name Description Schema

      include_docs
      optional

      Include the body associated with each document.

      Boolean

      channels
      optional

      Include the channels each document is part of that the calling user also has access too.

      Boolean

      access
      optional

      Include what user/roles that each document grants access too.

      Boolean

      revs
      optional

      Include all the revisions for each document under the _revisions property.

      Boolean

      update_seq
      optional

      Include the document sequence number update_seq property for each document.

      Boolean

      keys
      optional

      An array of document ID strings to filter by.

      String List

      startkey
      optional

      Return records starting with the specified key.

      String

      endkey
      optional

      Stop returning records when this key is reached.

      String

      limit
      optional

      This limits the number of result rows returned. Using a value of 0 has the same effect as the value 1.

      BigDecimal

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Operation ran successfully

      get_keyspace__all_docs_200_response

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Get a document

      GET /{keyspace}/{docid}
      Description

      Retrieve a document from the database by its doc ID.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The document ID to run the operation against.

      String

      Query Parameters
      Name Description Schema

      rev
      optional

      The document revision to target.

      String

      open_revs
      optional

      Option to fetch specified revisions of the document. The value can be all to fetch all leaf revisions or an array of revision numbers (i.e. open_revs=["rev1", "rev2"]). Only leaf revision bodies that haven't been pruned are guaranteed to be returned. If this option is specified the response will be in multipart format. Use the Accept: application/json request header to get the result as a JSON object.

      String List

      show_exp
      optional

      Whether to show the expiry property (_exp) in the response.

      Boolean

      revs_from
      optional

      Trim the revision history to stop at the first revision in the provided list. If no match is found, the revisions will be trimmed to the revs_limit.

      String List

      atts_since
      optional

      Include attachments only since specified revisions. Excludes the attachments for the specified revisions. Only gets used if attachments=true.

      String List

      revs_limit
      optional

      Maximum amount of revisions to return for each document.

      Integer

      attachments
      optional

      Include attachment bodies in response.

      Boolean

      replicator2
      optional

      Returns the document with the required properties for replication. This is an enterprise-edition only feature.

      Boolean

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Document found and returned successfully

      get_keyspace_docid_200_response

      400

      Document ID is not in an allowed format therefore is invalid. This could be because it is over 250 characters or is prefixed with an underscore (\"_\").

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      501

      Not Implemented. It is likely this error was caused due to trying to use an enterprise-only feature on the community edition.

      HTTP_Error

      Get an attachment from a document

      GET /{keyspace}/{docid}/{attach}
      Description

      This request retrieves a file attachment associated with the document.

      The raw data of the associated attachment is returned (just as if you were accessing a static file). The Content-Type response header is the same content type set when the document attachment was added to the database. The Content-Disposition response header will be set if the content type is considered unsafe to display in a browser (unless overridden by by database config option serve_insecure_attachment_types) which will force the attachment to be downloaded.

      If the meta query parameter is set then the response will be in JSON with the additional metadata tags.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The document ID to run the operation against.

      String

      attach
      required

      The attachment name. This value must be URL encoded. For example, if the attachment name is blob_/avatar, the path component passed to the URL should be blob_%2Favatar (tested with URLEncoder).

      String

      Header Parameters
      Name Description Schema

      Range
      optional

      RFC-2616 bytes range header.

      String

      Query Parameters
      Name Description Schema

      rev
      optional

      The document revision to target.

      String

      content_encoding
      optional

      Set to false to disable the Content-Encoding response header.

      Default: true

      Boolean

      meta
      optional

      Return only the metadata of the attachment in the response body.

      Default: false

      Boolean

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Found attachment successfully.

      206

      Partial attachment content returned

      404

      Resource could not be found

      HTTP_Error

      416

      Requested range exceeds content length

      Get local document

      GET /{keyspace}/_local/{docid}
      Description

      This request retrieves a local document.

      Local document IDs begin with _local/. Local documents are not replicated or indexed, don't support attachments, and don't save revision histories. In practice they are almost only used by Couchbase Lite's replicator, as a place to store replication checkpoint data.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The name of the local document ID excluding the _local/ prefix.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully found local document

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Get a document with the corresponding metadata

      GET /{keyspace}/_raw/{docid}
      Description

      Returns the a documents latest revision with its metadata.

      Note: The direct use of this endpoint is unsupported. The sync metadata is maintained internally by Sync Gateway and its structure can change. It should not be used to drive business logic of applications since the response to the /{db}/_raw/{id} endpoint can change at any time.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The document ID to run the operation against.

      String

      Query Parameters
      Name Description Schema

      include_doc
      optional

      Include the body associated with the document.

      String

      redact
      optional

      This redacts sensitive parts of the response. Cannot be used when include_docs=true

      Boolean

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Document found successfully

      get_keyspace__raw_docid_200_response

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      /{db}/_all_docs

      HEAD /{keyspace}/_all_docs
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Query Parameters
      Name Description Schema

      include_docs
      optional

      Include the body associated with each document.

      Boolean

      channels
      optional

      Include the channels each document is part of that the calling user also has access too.

      Boolean

      access
      optional

      Include what user/roles that each document grants access too.

      Boolean

      revs
      optional

      Include all the revisions for each document under the _revisions property.

      Boolean

      update_seq
      optional

      Include the document sequence number update_seq property for each document.

      Boolean

      keys
      optional

      An array of document ID strings to filter by.

      String List

      startkey
      optional

      Return records starting with the specified key.

      String

      endkey
      optional

      Stop returning records when this key is reached.

      String

      limit
      optional

      This limits the number of result rows returned. Using a value of 0 has the same effect as the value 1.

      BigDecimal

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      OK

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Check if a document exists

      HEAD /{keyspace}/{docid}
      Description

      Return a status code based on if the document exists or not.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The document ID to run the operation against.

      String

      Query Parameters
      Name Description Schema

      rev
      optional

      The document revision to target.

      String

      open_revs
      optional

      Option to fetch specified revisions of the document. The value can be all to fetch all leaf revisions or an array of revision numbers (i.e. open_revs=["rev1", "rev2"]). Only leaf revision bodies that haven't been pruned are guaranteed to be returned. If this option is specified the response will be in multipart format. Use the Accept: application/json request header to get the result as a JSON object.

      String List

      show_exp
      optional

      Whether to show the expiry property (_exp) in the response.

      Boolean

      revs_from
      optional

      Trim the revision history to stop at the first revision in the provided list. If no match is found, the revisions will be trimmed to the revs_limit.

      String List

      atts_since
      optional

      Include attachments only since specified revisions. Excludes the attachments for the specified revisions. Only gets used if attachments=true.

      String List

      revs_limit
      optional

      Maximum amount of revisions to return for each document.

      Integer

      attachments
      optional

      Include attachment bodies in response.

      Boolean

      replicator2
      optional

      Returns the document with the required properties for replication. This is an enterprise-edition only feature.

      Boolean

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Document exists

      400

      Document ID is not in an allowed format therefore is invalid. This could be because it is over 250 characters or is prefixed with an underscore (\"_\").

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Check if attachment exists

      HEAD /{keyspace}/{docid}/{attach}
      Description

      This request check if the attachment exists on the specified document.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The document ID to run the operation against.

      String

      attach
      required

      The attachment name. This value must be URL encoded. For example, if the attachment name is blob_/avatar, the path component passed to the URL should be blob_%2Favatar (tested with URLEncoder).

      String

      Query Parameters
      Name Description Schema

      rev
      optional

      The document revision to target.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      The document exists and the attachment exists on the document.

      404

      Resource could not be found

      HTTP_Error

      Check if local document exists

      HEAD /{keyspace}/_local/{docid}
      Description

      This request checks if a local document exists.

      Local document IDs begin with _local/. Local documents are not replicated or indexed, don't support attachments, and don't save revision histories. In practice they are almost only used by Couchbase Lite's replicator, as a place to store replication checkpoint data.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The name of the local document ID excluding the _local/ prefix.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Document exists

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      /{keyspace}/_raw/{docid}

      HEAD /{keyspace}/_raw/{docid}
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The document ID to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Document exists

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Create a new document

      POST /{keyspace}/
      Description

      Create a new document in the keyspace.

      This will generate a random document ID unless specified in the body.

      A document can have a maximum size of 20MB.

      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      PostKeyspaceRequest

      Query Parameters
      Name Description Schema

      roundtrip
      optional

      Block until document has been received by change cache

      Boolean

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      New document revision created successfully.

      New_revision

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      409

      Resource already exists under that name

      HTTP_Error

      415

      Invalid content type

      HTTP_Error

      Get all the documents in the database using a built-in view

      POST /{keyspace}/_all_docs
      Description

      Returns all documents in the database based on the specified parameters.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      PostKeyspaceAllDocsRequest

      Query Parameters
      Name Description Schema

      include_docs
      optional

      Include the body associated with each document.

      Boolean

      channels
      optional

      Include the channels each document is part of that the calling user also has access too.

      Boolean

      access
      optional

      Include what user/roles that each document grants access too.

      Boolean

      revs
      optional

      Include all the revisions for each document under the _revisions property.

      Boolean

      update_seq
      optional

      Include the document sequence number update_seq property for each document.

      Boolean

      startkey
      optional

      Return records starting with the specified key.

      String

      endkey
      optional

      Stop returning records when this key is reached.

      String

      limit
      optional

      This limits the number of result rows returned. Using a value of 0 has the same effect as the value 1.

      BigDecimal

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Operation ran successfully

      get_keyspace__all_docs_200_response

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Bulk document operations

      POST /{keyspace}/_bulk_docs
      Description

      This will allow multiple documented to be created, updated or deleted in bulk.

      To create a new document, simply add the body in an object under docs. A doc ID will be generated by Sync Gateway unless _id is specified.

      To update an existing document, provide the document ID (_id) and revision ID (_rev) as well as the new body values.

      To delete an existing document, provide the document ID (_id), revision ID (_rev), and set the deletion flag (_deleted) to true.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      Example: {"new_edits":true,"docs":[{"_id":"FooBar","foo":"bar"},{"_id":"AliceSettings","_rev":"5-832a6db48ed130adadede928aee54576","FailedLoginAttempts":7},{"_id":"BobSettings","_rev":"1-fa76ba41ee5fdfee1b91fc478ed09e59","_deleted":true}]}

      PostKeyspaceBulkDocsRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      201

      Executed all operations. Each object in the returned array represents a document. Each document should be checked to make sure it was successfully added to the database.

      Set

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Get multiple documents in a MIME multipart response

      POST /{keyspace}/_bulk_get
      Description

      This request returns any number of documents, as individual bodies in a MIME multipart response.

      Each enclosed body contains one requested document. The bodies appear in the same order as in the request, but can also be identified by their X-Doc-ID and X-Rev-ID headers (if the attachments query is true).

      A body for a document with no attachments will have content type application/json and contain the document itself.

      A body for a document that has attachments will be written as a nested multipart/related body.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      Example: {"docs":[{"id":"FooBar"},{"id":"attachment"},{"id":"AliceSettings"}]}

      PostKeyspaceBulkGetRequest

      Header Parameters
      Name Description Schema

      X-Accept-Part-Encoding
      optional

      If this header includes gzip then the part HTTP compression encoding will be done.

      String

      Accept-Encoding
      optional

      If this header includes gzip then the the HTTP response will be compressed. This takes priority over X-Accept-Part-Encoding. Only part compression will be done if X-Accept-Part-Encoding=gzip and the User-Agent is below 1.2 due to clients not being able to handle full compression.

      String

      Query Parameters
      Name Description Schema

      attachments
      optional

      This is for whether to include attachments in each of the documents returned or not.

      Default: false

      Boolean

      revs
      optional

      Include all the revisions for each document under the _revisions property.

      Boolean

      revs_limit
      optional

      The number of revisions to include in the response from the document history. This parameter only makes a different if the revs query parameter is set to true. The full revision history will be returned if revs is set but this is not.

      Integer

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Returned the requested docs as multipart/mixed response type

      400

      Bad Request

      404

      Resource could not be found

      HTTP_Error

      Purge a document

      POST /{keyspace}/_purge
      Description

      The purge command provides a way to remove a document from the database. The operation removes all revisions (active and tombstones) for the specified document(s). A common usage of this endpoint is to remove tombstone documents that are no longer needed, thus recovering storage space and reducing data replicated to clients. Other clients are not notified when a revision has been purged; so in order to purge a revision from the system it must be done from all databases (on Couchbase Lite and Sync Gateway).

      When enable_shared_bucket_access is enabled, this endpoint removes the document and its associated extended attributes.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      Purge request body

      Example: {"doc_id":["*"]}

      PostKeyspacePurgeRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Attempted documents purge. Check output to verify the documents that were purged. The document IDs will not be listed if they have not been purged (for example, due to no existing).

      post_keyspace__purge_200_response

      400

      Bad request. This could be due to the documents listed in the request body not having the [\"*\"] value for each document ID.

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Upsert a document

      PUT /{keyspace}/{docid}
      Description

      This will upsert a document meaning if it does not exist, then it will be created. Otherwise a new revision will be made for the existing document. A revision ID must be provided if targetting an existing document.

      A document ID must be specified for this endpoint. To let Sync Gateway generate the ID, use the POST /{db}/ endpoint.

      If a document does exist, then replace the document content with the request body. This means unspecified fields will be removed in the new revision.

      The maximum size for a document is 20MB.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The document ID to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      PostKeyspaceRequest

      Header Parameters
      Name Description Schema

      If-Match
      optional

      The revision ID to target.

      String

      Query Parameters
      Name Description Schema

      roundtrip
      optional

      Block until document has been received by change cache

      Boolean

      replicator2
      optional

      Returns the document with the required properties for replication. This is an enterprise-edition only feature.

      Boolean

      new_edits
      optional

      Setting this to false indicates that the request body is an already-existing revision that should be directly inserted into the database, instead of a modification to apply to the current document. This mode is used for replication. This option must be used in conjunction with the _revisions property in the request body.

      Default: true

      Boolean

      rev
      optional

      The document revision to target.

      String

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      201

      Created

      New_revision

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      409

      Resource already exists under that name

      HTTP_Error

      415

      Invalid content type

      HTTP_Error

      Create or update an attachment on a document

      PUT /{keyspace}/{docid}/{attach}
      Description

      This request adds or updates an attachment associated with the document. If the document does not exist, it will be created and the attachment will be added to it.

      If the attachment already exists, the data of the existing attachment will be replaced in the new revision.

      The maximum content size of an attachment is 20MB. The Content-Type header of the request specifies the content type of the attachment.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The document ID to run the operation against.

      String

      attach
      required

      The attachment name. This value must be URL encoded. For example, if the attachment name is blob_/avatar, the path component passed to the URL should be blob_%2Favatar (tested with URLEncoder).

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      The attachment data

      Example: body_example

      String

      Header Parameters
      Name Description Schema

      Content-Type
      optional

      The content type of the attachment.

      Default: application/octet-stream

      String

      If-Match
      optional

      An alternative way of specifying the document revision ID.

      String

      Query Parameters
      Name Description Schema

      rev
      optional

      The existing document revision ID to modify. Required only when modifying an existing document.

      String

      Produces
      • application/json

      Consumes
      • Attachment content type

      Responses
      HTTP Code Description Schema

      201

      Attachment added to new or existing document successfully

      New_revision

      404

      Resource could not be found

      HTTP_Error

      409

      Resource already exists under that name

      HTTP_Error

      Upsert a local document

      PUT /{keyspace}/_local/{docid}
      Description

      This request creates or updates a local document. Updating a local document requires that the revision ID be put in the body under _rev.

      Local document IDs are given a _local/ prefix. Local documents are not replicated or indexed, don't support attachments, and don't save revision histories. In practice they are almost only used by the client's replicator, as a place to store replication checkpoint data.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The name of the local document ID excluding the _local/ prefix.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      The body of the document

      PutKeyspaceLocalDocidRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      201

      Document successfully written. The document ID will be prefixed with _local/.

      New_revision

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      409

      A revision ID conflict would result from updating this document revision.

      Metrics

      Get Sync Gateway statistics

      Get all Sync Gateway statistics

      GET /_expvar
      Description

      This returns a snapshot of all metrics in Sync Gateway for debugging and monitoring purposes.

      This includes per database stats, replication stats, and server stats.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Dev Ops
      • External Stats Reader
      Produces
      • application/javascript

      Responses
      HTTP Code Description Schema

      200

      Returned statistics

      get__expvar_200_response

      Get memory statistics

      GET /_stats
      Description

      This will return the current Sync Gateway nodes memory statistics such as current memory usage.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Dev Ops
      • External Stats Reader
      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Returned memory usage statistics

      get__stats_200_response

      Profiling

      Generate information to help debug and fine-tune Sync Gateway

      Get fgprof profile

      GET /_debug/fgprof
      Description

      A sampling Go profiler that allows you to analyze On-CPU as well as Off-CPU (e.g. I/O) time together.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      The amount of seconds to run the profiler for.

      Default: 30
      Minimum: 0

      Integer

      Produces
      • application/x-gzip

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get block profile

      GET /_debug/pprof/block
      Description

      Returns stack traces that led to blocking on synchronization primitives.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      The amount of seconds to run the profiler for.

      Default: 30
      Minimum: 0

      Integer

      Produces
      • application/octet-stream

      • application/json

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      403

      Forbidden

      HTTP_Error

      Get passed in command line parameters

      GET /_debug/pprof/cmdline
      Description

      Gets the command line parameters that was passed in to Sync Gateway which will include the binary, flags (if any) and startup configuration.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Produces
      • text/plain

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get goroutine profile

      GET /_debug/pprof/goroutine
      Description

      Stack traces of all current goroutines.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      If set, collect a delta profile for the given duration, instead of a snapshot.

      Integer

      Produces
      • application/octet-stream

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get the heap pprof debug file

      GET /_debug/pprof/heap
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      If set, collect a delta profile for the given duration, instead of a snapshot.

      Integer

      Produces
      • application/octet-stream

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get mutex profile

      GET /_debug/pprof/mutex
      Description

      Returns stack traces of holders of contended mutexes.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      The amount of seconds to run the profiler for.

      Default: 30
      Minimum: 0

      Integer

      Produces
      • application/octet-stream

      • application/json

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      403

      Forbidden

      HTTP_Error

      Get the profile pprof debug file

      GET /_debug/pprof/profile
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      If set, collect a delta profile for the given duration, instead of a snapshot.

      Integer

      Produces
      • application/octet-stream

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get symbol pprof debug information

      GET /_debug/pprof/symbol
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Produces
      • text/plain

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get the threadcreate pprof debug file

      GET /_debug/pprof/threadcreate
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Produces
      • application/octet-stream

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get trace profile

      GET /_debug/pprof/trace
      Description

      Responds with the execution trace in binary form.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      Default: 1

      Integer

      Produces
      • application/octet-stream

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get fgprof profile

      POST /_debug/fgprof
      Description

      A sampling Go profiler that allows you to analyze On-CPU as well as Off-CPU (e.g. I/O) time together.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      The amount of seconds to run the profiler for.

      Default: 30
      Minimum: 0

      Integer

      Produces
      • application/x-gzip

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get block profile

      POST /_debug/pprof/block
      Description

      Returns stack traces that led to blocking on synchronization primitives.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      The amount of seconds to run the profiler for.

      Default: 30
      Minimum: 0

      Integer

      Produces
      • application/octet-stream

      • application/json

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      403

      Forbidden

      HTTP_Error

      Get passed in command line parameters

      POST /_debug/pprof/cmdline
      Description

      Gets the command line parameters that was passed in to Sync Gateway which will include the binary, flags (if any) and startup configuration.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Produces
      • text/plain

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get goroutine profile

      POST /_debug/pprof/goroutine
      Description

      Stack traces of all current goroutines.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      If set, collect a delta profile for the given duration, instead of a snapshot.

      Integer

      Produces
      • application/octet-stream

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get the heap pprof debug file

      POST /_debug/pprof/heap
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      If set, collect a delta profile for the given duration, instead of a snapshot.

      Integer

      Produces
      • application/octet-stream

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get mutex profile

      POST /_debug/pprof/mutex
      Description

      Returns stack traces of holders of contended mutexes.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      The amount of seconds to run the profiler for.

      Default: 30
      Minimum: 0

      Integer

      Produces
      • application/octet-stream

      • application/json

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      403

      Forbidden

      HTTP_Error

      Get the profile pprof debug file

      POST /_debug/pprof/profile
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      If set, collect a delta profile for the given duration, instead of a snapshot.

      Integer

      Produces
      • application/octet-stream

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get symbol pprof debug information

      POST /_debug/pprof/symbol
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Produces
      • text/plain

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get the threadcreate pprof debug file

      POST /_debug/pprof/threadcreate
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Produces
      • application/octet-stream

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Get trace profile

      POST /_debug/pprof/trace
      Description

      Responds with the execution trace in binary form.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      seconds
      optional

      Default: 1

      Integer

      Produces
      • application/octet-stream

      Responses
      HTTP Code Description Schema

      200

      OK

      String

      Dump heap profile

      POST /_heap
      Description

      This endpoint will dump a pprof heap profile.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Body Parameter
      Name Description Schema

      Body
      optional

      PostProfileProfilenameRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully dumped heap profile

      400

      There was a problem with your request

      HTTP_Error

      Start or Stop continuous CPU profiling

      POST /_profile
      Description

      This endpoint allows you to start and stop continuous CPU profiling.

      To start profiling the CPU, call this endpoint and supply a file to output the pprof file to.

      To stop profiling, call this endpoint but don't supply the file in the body.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Body Parameter
      Name Description Schema

      Body
      optional

      PostProfileProfilenameRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully started or stopped CPU profiling

      400

      There was a problem with your request

      HTTP_Error

      Create point-in-time profile

      POST /_profile/{profilename}
      Description

      This endpoint allows you to create a pprof snapshot of the given type.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Path Parameters
      Name Description Schema

      profilename
      required

      The handler to use for profiling.

      Values: heap, block, threadcreate, mutex, goroutine

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      PostProfileProfilenameRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully created profile

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Replication

      Create and manage inter-Sync Gateway replications

      Stop and delete a replication

      DELETE /{db}/_replication/{replicationid}
      Description

      This will delete a replication causing it to stop and no longer exist.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Replicator
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      replicationid
      required

      What replication to target based on its replication ID.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Replication successfully deleted

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Handle incoming BLIP Sync web socket request

      GET /{db}/_blipsync
      Description

      This handles incoming BLIP Sync requests from either Couchbase Lite or another Sync Gateway node. The connection has to be upgradable to a websocket connection or else the request will fail.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      client
      optional

      This is the client type that is making the BLIP Sync request. Used to control client-type specific replication behaviour.

      Values: cbl2, sgr2
      Default: cbl2

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      101

      Upgraded to a web socket connection

      404

      Resource could not be found

      HTTP_Error

      426

      Cannot upgrade connection to a web socket connection

      HTTP_Error

      Get all replication configurations

      GET /{db}/_replication/
      Description

      This will retrieve all database replication definitions.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Replicator
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Retrieved replication configurations successfully. The assigned_node fields will end with (local) or (non-local) depending on if the replication is running on this Sync Gateway node.

      All_replications

      404

      Resource could not be found

      HTTP_Error

      Get a replication configuration

      GET /{db}/_replication/{replicationid}
      Description

      Retrieve a replication configuration from the database.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Replicator
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      replicationid
      required

      What replication to target based on its replication ID.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully retrieved the replication configuration

      Replication_1

      404

      Resource could not be found

      HTTP_Error

      Get all replication statuses

      GET /{db}/_replicationStatus/
      Description

      Retrieve all the replication statuses in the Sync Gateway node.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Replicator
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Query Parameters
      Name Description Schema

      activeOnly
      optional

      Only return replications that are actively running (state=running).

      Default: false

      Boolean

      localOnly
      optional

      Only return replications that were started on the current Sync Gateway node.

      Default: false

      Boolean

      includeError
      optional

      Include replications that have stopped due to an error (state=error).

      Default: true

      Boolean

      includeConfig
      optional

      Include the replication configuration with each replicator status in the response.

      Default: false

      Boolean

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully retrieved all replication statuses.

      List

      400

      There was a problem with your request

      HTTP_Error

      Get replication status

      GET /{db}/_replicationStatus/{replicationid}
      Description

      Retrieve the status of a replication.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Replicator
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      replicationid
      required

      What replication to target based on its replication ID.

      String

      Query Parameters
      Name Description Schema

      activeOnly
      optional

      Only return replications that are actively running (state=running).

      Default: false

      Boolean

      localOnly
      optional

      Only return replications that were started on the current Sync Gateway node.

      Default: false

      Boolean

      includeError
      optional

      Include replications that have stopped due to an error (state=error).

      Default: true

      Boolean

      includeConfig
      optional

      Include the replication configuration with each replicator status in the response.

      Default: false

      Boolean

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully retrieved replication status

      Replication_status

      400

      There was a problem with your request

      HTTP_Error

      404

      Could not find replication

      HTTP_Error

      /{db}/_replication/

      HEAD /{db}/_replication/
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Replicator
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Responses
      HTTP Code Description Schema

      200

      OK

      404

      Not Found

      Check if a replication exists

      HEAD /{db}/_replication/{replicationid}
      Description

      Check if a replication exists.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Replicator
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      replicationid
      required

      What replication to target based on its replication ID.

      String

      Responses
      HTTP Code Description Schema

      200

      Replication exists

      404

      Replication does not exist

      /{db}/_replicationStatus/

      HEAD /{db}/_replicationStatus/
      Description

      Required Sync Gateway RBAC roles:

      • Sync Gateway Replicator
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Responses
      HTTP Code Description Schema

      200

      OK

      400

      Bad Request

      Check if replication exists

      HEAD /{db}/_replicationStatus/{replicationid}
      Description

      Check if a replication exists.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Replicator
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      replicationid
      required

      What replication to target based on its replication ID.

      String

      Query Parameters
      Name Description Schema

      activeOnly
      optional

      Only return replications that are actively running (state=running).

      Default: false

      Boolean

      localOnly
      optional

      Only return replications that were started on the current Sync Gateway node.

      Default: false

      Boolean

      includeError
      optional

      Include replications that have stopped due to an error (state=error).

      Default: true

      Boolean

      includeConfig
      optional

      Include the replication configuration with each replicator status in the response.

      Default: false

      Boolean

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Replication exists

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Upsert a replication

      POST /{db}/_replication/
      Description

      Create or update a replication in the database.

      If an existing replication is being updated, that replication must be stopped first.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Replicator
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      If the replication_id matches an existing replication then the existing configuration will be updated. Only the specified fields in the request will be used to update the existing configuration. Unspecified fields will remain untouched.

      UserConfigurableReplicationProperties

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Updated existing configuration successfully

      201

      Created new replication successfully

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Upsert a replication

      PUT /{db}/_replication/{replicationid}
      Description

      Create or update a replication in the database.

      The replication ID does not need to be set in the request body.

      If an existing replication is being updated, that replication must be stopped first and, if the replication_id is specified in the request body, it must match the replication ID in the URI.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Replicator
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      replicationid
      required

      What replication to target based on its replication ID.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      If the replication_id matches an existing replication then the existing configuration will be updated. Only the specified fields in the request will be used to update the existing configuration. Unspecified fields will remain untouched.

      UserConfigurableReplicationProperties

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Updated existing configuration successfully

      201

      Created new replication successfully

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Control a replication state

      PUT /{db}/_replicationStatus/{replicationid}
      Description

      Control the replication by changing its state.

      This is done through the action query parameter, which has 3 valid values:

      • start - starts a stopped replication
      • stop - stops an active replication
      • reset - resets the replication checkpoint to 0. For bidirectional replication, both push and pull checkpoints are reset to 0. The replication must be stopped to use this.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Replicator
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      replicationid
      required

      What replication to target based on its replication ID.

      String

      Query Parameters
      Name Description Schema

      action
      required

      The target state to put the replicator into.

      Values: start, stop, reset

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully changed target state of replicator

      Replication_status

      400

      There was a problem with your request

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Server

      Manage server activities

      Cancel the Sync Gateway Collect Info job

      DELETE /_sgcollect_info
      Description

      This endpoint is used to cancel a current Sync Gateway Collect Info (sgcollect_info) job that is running.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Job cancelled successfully

      delete__sgcollect_info_200_response

      400

      There was a problem with your request

      HTTP_Error

      Get server information

      GET /
      Description

      Returns information about the Sync Gateway node.

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Returned server information

      get___200_response

      Get server configuration

      GET /_config
      Description

      This will return the configuration that the Sync Gateway node was initially started up with, or the currently config if include_runtime is set.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      redact
      optional

      No longer supported field.

      Default: true

      Boolean

      include_runtime
      optional

      Whether to include the values set after starting (at runtime), default values, and all loaded databases.

      Default: false

      Boolean

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully returned server configuration

      Startup_config

      400

      There was a problem with your request

      HTTP_Error

      Get console logging settings

      GET /_logging
      Description

      Deprecated in favour of GET /_config This will return a map of the log keys being used for the console logging.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Returned map of console log keys

      Map

      Check if API is available

      GET /_ping
      Description

      Returns OK status if API is available.

      Produces
      • text/plain

      Responses
      HTTP Code Description Schema

      200

      Returned status

      String

      Get the status of the Sync Gateway Collect Info

      GET /_sgcollect_info
      Description

      This will return the status of whether Sync Gateway Collect Info (sgcollect_info) is currently running or not.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Returned sgcollect_info status

      get__sgcollect_info_200_response

      Get the server status

      GET /_status
      Description

      This will retrieve the status of each database and the overall server status.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Returned the status successfully

      Status_1

      400

      There was a problem with your request

      HTTP_Error

      Check if server online

      HEAD /
      Description

      Check if the server is online by checking the status code of response.

      Responses
      HTTP Code Description Schema

      200

      Server is online

      Check if API is available

      HEAD /_ping
      Description

      Returns OK status if API is available.

      Responses
      HTTP Code Description Schema

      200

      Server is available

      Update console logging settings

      POST /_logging
      Description

      Deprecated in favour of PUT /_config This is for enabling the log keys provided and optionally changing the console log level.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Body Parameter
      Name Description Schema

      Body
      optional

      The console log keys to upsert.

      Boolean Map

      Query Parameters
      Name Description Schema

      logLevel
      optional

      The is what to set the console log level too.

      Values: none, error, warn, info, debug, trace

      String

      level
      optional

      Deprecated: use log level instead.

      This sets the console log level depending on the value provide. 1 sets to info, 2 sets to warn, and 3 sets to error.'

      Minimum: 1
      Maximum: 3

      Integer

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Log keys successfully updated.

      400

      There was a problem with your request

      HTTP_Error

      Run the post upgrade process on all databases

      POST /_post_upgrade
      Description

      The post upgrade process involves removing obsolete design documents and indexes when they are no longer needed.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Query Parameters
      Name Description Schema

      preview
      optional

      If set, a dry-run will be done to return what would be removed.

      Default: false

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Returned results

      post__post_upgrade_200_response

      Start Sync Gateway Collect Info

      POST /_sgcollect_info
      Description

      This endpoint is used to start a Sync Gateway Collect Info (sgcollect_info) job so that Sync Gateway diagnostic data can be outputted to a file.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Body Parameter
      Name Description Schema

      Body
      optional

      sgcollect_info options

      PostSgcollectInfoRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully started sgcollect_info

      post__sgcollect_info_200_response

      400

      There was a problem with your request

      HTTP_Error

      500

      An error occurred while trying to run sgcollect_info

      HTTP_Error

      Set runtime configuration

      PUT /_config
      Description

      This endpoint is used to dynamically set runtime options, like logging without needing a restart.

      These options are not persisted, and will not survive a restart of Sync Gateway.

      The endpoint only accepts a limited number of options that can be changed at runtime. See request body schema for allowable options.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Body Parameter
      Name Description Schema

      Body
      optional

      RuntimeConfig

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully set runtime options

      400

      There was a problem with your request

      HTTP_Error

      Set console logging settings

      PUT /_logging
      Description

      Deprecated in favour of PUT /_config Enable or disable console log keys and optionally change the console log level.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Body Parameter
      Name Description Schema

      Body
      optional

      The map of log keys to use for console logging.

      Boolean Map

      Query Parameters
      Name Description Schema

      logLevel
      optional

      The is what to set the console log level too.

      Values: none, error, warn, info, debug, trace

      String

      level
      optional

      Deprecated: use log level instead.

      This sets the console log level depending on the value provide. 1 sets to info, 2 sets to warn, and 3 sets to error.'

      Minimum: 1
      Maximum: 3

      Integer

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Log keys successfully replaced.

      400

      There was a problem with your request

      HTTP_Error

      Session

      Manage user sessions

      Remove session

      DELETE /{db}/_session/{sessionid}
      Description

      Invalidates the session provided so that anyone using it is logged out and is prevented from future use.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      sessionid
      required

      The ID of the session to target.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully removed the user session

      404

      Resource could not be found

      HTTP_Error

      Remove all of a users sessions

      DELETE /{db}/_user/{name}/_session
      Description

      Invalidates all the sessions that a user has.

      Will still return a 200 status code if the user has no sessions.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      name
      required

      The name of the user.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      User now has no sessions

      404

      Resource could not be found

      HTTP_Error

      Remove session with user validation

      DELETE /{db}/_user/{name}/_session/{sessionid}
      Description

      Invalidates the session only if it belongs to the user.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      name
      required

      The name of the user.

      String

      sessionid
      required

      The ID of the session to target.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Session has been successfully removed as the user was associated with the session

      404

      Resource could not be found

      HTTP_Error

      Get information about the current user

      GET /{db}/_session
      Description

      This will get the information about the current user.

      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Properties associated with a user session

      User_Session_Information

      404

      Resource could not be found

      HTTP_Error

      Get session information

      GET /{db}/_session/{sessionid}
      Description

      Retrieve session information such as the user the session belongs too and what channels that user can access.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      sessionid
      required

      The ID of the session to target.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Properties associated with a user session

      User_Session_Information

      404

      Resource could not be found

      HTTP_Error

      /{db}/_session

      HEAD /{db}/_session
      Description
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      OK

      404

      Resource could not be found

      HTTP_Error

      Create a new user session

      POST /{db}/_session
      Description

      Generates a login session for a user and returns the session ID and cookie name for that session. If no TTL is provided, then the default of 24 hours will be used.

      A session cannot be generated for an non-existent user or the GUEST user.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      The body can depend on if using the Public or Admin APIs.

      PostDbSessionRequest

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Session created successfully. Returned body is dependant on if using Public or Admin APIs.

      post_db__session_200_response

      400

      Origin is not in the approved list of allowed origins

      HTTP_Error

      404

      Resource could not be found

      HTTP_Error

      Unsupported

      Endpoints that are not supported by Sync Gateway

      Delete a design document | Unsupported

      DELETE /{db}/_design/{ddoc}
      Description

      This is unsupported

      Delete a design document.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      ddoc
      required

      The design document name.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Design document deleted successfully

      403

      Forbidden access possibly due to not using the Admin API or the design document is a built-in Sync Gateway one.

      404

      Resource could not be found

      HTTP_Error

      Get views of a design document | Unsupported

      GET /{db}/_design/{ddoc}
      Description

      This is unsupported

      Query a design document.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      ddoc
      required

      The design document name.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully returned design document.

      get_db__design_ddoc_200_response

      403

      Forbidden access possibly due to not using the Admin API or the design document is a built-in Sync Gateway one.

      404

      Resource could not be found

      HTTP_Error

      Query a view on a design document | Unsupported

      GET /{db}/_design/{ddoc}/_view/{view}
      Description

      This is unsupported

      Query a view on a design document.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      ddoc
      required

      The design document name.

      String

      view
      required

      The view to target.

      String

      Query Parameters
      Name Description Schema

      inclusive_end
      optional

      Indicates whether the specified end key should be included in the result.

      Boolean

      descending
      optional

      Return documents in descending order.

      Boolean

      include_docs
      optional

      Only works when using Couchbase Server 3.0 and earlier. Indicates whether to include the full content of the documents in the response.

      Boolean

      reduce
      optional

      Whether to execute a reduce function on the response or not.

      Boolean

      group
      optional

      Group the results using the reduce function to a group or single row.

      Boolean

      skip
      optional

      Skip the specified number of documents before starting to return results.

      Integer

      limit
      optional

      Return only the specified number of documents

      Integer

      group_level
      optional

      Specify the group level to be used.

      Integer

      startkey_docid
      optional

      Return documents starting with the specified document identifier.

      String

      endkey_docid
      optional

      Stop returning records when the specified document identifier is reached.

      String

      stale
      optional

      Allow the results from a stale view to be used, without triggering a rebuild of all views within the encompassing design document.

      Values: ok, update_after

      String

      startkey
      optional

      Return records starting with the specified key.

      String

      endkey
      optional

      Stop returning records when this key is reached.

      String

      key
      optional

      Return only the document that matches the specified key.

      String

      keys
      optional

      An array of document ID strings to filter by.

      String List

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Returned view successfully

      get_db__view_view_200_response

      403

      Forbidden

      404

      Resource could not be found

      HTTP_Error

      Dump a view | Unsupported

      GET /{db}/_dump/{view}
      Description

      This is unsupported

      This queries the view and outputs it as HTML.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      view
      required

      The view to target.

      String

      Produces
      • text/html

      • application/json

      Responses
      HTTP Code Description Schema

      200

      Retrieved view successfully

      String

      404

      Resource could not be found

      HTTP_Error

      500

      Internal Server Error

      HTTP_Error

      Query a view on the default design document | Unsupported

      GET /{db}/_view/{view}
      Description

      This is unsupported

      Query a view on the default Sync Gateway design document.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      view
      required

      The view to target.

      String

      Query Parameters
      Name Description Schema

      inclusive_end
      optional

      Indicates whether the specified end key should be included in the result.

      Boolean

      descending
      optional

      Return documents in descending order.

      Boolean

      include_docs
      optional

      Only works when using Couchbase Server 3.0 and earlier. Indicates whether to include the full content of the documents in the response.

      Boolean

      reduce
      optional

      Whether to execute a reduce function on the response or not.

      Boolean

      group
      optional

      Group the results using the reduce function to a group or single row.

      Boolean

      skip
      optional

      Skip the specified number of documents before starting to return results.

      Integer

      limit
      optional

      Return only the specified number of documents

      Integer

      group_level
      optional

      Specify the group level to be used.

      Integer

      startkey_docid
      optional

      Return documents starting with the specified document identifier.

      String

      endkey_docid
      optional

      Stop returning records when the specified document identifier is reached.

      String

      stale
      optional

      Allow the results from a stale view to be used, without triggering a rebuild of all views within the encompassing design document.

      Values: ok, update_after

      String

      startkey
      optional

      Return records starting with the specified key.

      String

      endkey
      optional

      Stop returning records when this key is reached.

      String

      key
      optional

      Return only the document that matches the specified key.

      String

      keys
      optional

      An array of document ID strings to filter by.

      String List

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Returned view successfully

      get_db__view_view_200_response

      403

      Forbidden

      404

      Resource could not be found

      HTTP_Error

      Dump all the documents in a channel | Unsupported

      GET /{keyspace}/_dumpchannel/{channel}
      Description

      This is unsupported

      This queries a channel and displays all the document IDs and revisions that are in that channel.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      channel
      required

      The channel to dump all the documents from.

      String

      Query Parameters
      Name Description Schema

      since
      optional

      Starts the results from the change immediately after the given sequence ID. Sequence IDs should be considered opaque; they come from the last_seq property of a prior response.

      String

      Produces
      • text/html

      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully got all documents in the channel

      String

      404

      Resource could not be found

      HTTP_Error

      Revision tree structure in Graphviz Dot format | Unsupported

      GET /{keyspace}/_revtree/{docid}
      Description

      This returns the Dot syntax of the revision tree for the document so that it can be rendered in to a PNG image using the Graphviz CLI tool.

      To use:

      1. Install the Graphviz tool. Using Brew, this can be done by calling brew install graphviz.
      2. Save the response text from this endpoint to a file (for example, revtree.dot).
      3. Render the PNG by calling dot -Tpng revtree.dot > revtree.png.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only

      Note: This endpoint is useful for debugging purposes only. It is not officially supported.

      Parameters
      Path Parameters
      Name Description Schema

      keyspace
      required

      The keyspace to run the operation against.

      A keyspace is a dot-separated string, comprised of a database name, and optionally a named scope and collection.

      String

      docid
      required

      The document ID to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Found document

      String

      404

      Resource could not be found

      HTTP_Error

      Check if view of design document exists | Unsupported

      HEAD /{db}/_design/{ddoc}
      Description

      This is unsupported

      Check if a design document can be queried.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      • Sync Gateway Application Read Only
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      ddoc
      required

      The design document name.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Design document exists

      403

      Forbidden access possibly due to not using the Admin API or the design document is a built-in Sync Gateway one.

      404

      Resource could not be found

      HTTP_Error

      Flush the entire database bucket | Unsupported

      POST /{db}/_flush
      Description

      This is unsupported

      This will purge all documents.

      The bucket will only be flushed if the unsupported database configuration option enable_couchbase_bucket_flush is set.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Dev Ops
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Produces
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Successfully flushed the bucket

      404

      Resource could not be found

      HTTP_Error

      503

      The bucket does not support flush or delete

      HTTP_Error

      Disabled endpoint

      POST /{db}/_repair
      Description

      This endpoint is disabled.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      Responses
      HTTP Code Description Schema

      500

      This endpoint is disabled

      Update views of a design document | Unsupported

      PUT /{db}/_design/{ddoc}
      Description

      This is unsupported

      Update the views of a design document.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Application
      Parameters
      Path Parameters
      Name Description Schema

      db
      required

      The name of the database to run the operation against.

      String

      ddoc
      required

      The design document name.

      String

      Body Parameter
      Name Description Schema

      Body
      optional

      GetDbDesignDdoc200Response

      Produces
      • application/json

      Consumes
      • application/json

      Responses
      HTTP Code Description Schema

      200

      Design document changes successfully

      403

      Forbidden access possibly due to not using the Admin API or the design document is a built-in Sync Gateway one.

      404

      Resource could not be found

      HTTP_Error

      Definitions

      This section describes the properties consumed and returned by this REST API.

      All replications

      Name Description Schema

      replication_id
      optional

      Properties of a replication

      Replication_1

      ChangesFeed

      Name Description Schema

      results
      optional

      get_keyspace__changes_200_response_results_inner Set

      last_seq
      optional

      The last change sequence number.

      String

      CollectionAccessConfig

      Name Description Schema

      admin_channels
      optional

      A list of channels to explicitly grant to the user.

      String List

      all_channels
      optional

      All the channels that the user has been granted access to.

      Access could have been granted through the sync function, roles, or explicitly on the user under the admin_channels property.

      String List

      jwt_channels
      optional

      The channels that the user has been granted access to through channels_claim.

      String List

      jwt_last_updated
      optional

      The last time that the user’s JWT roles/channels were updated.

      Date (date-time)

      Collection config

      Name Description Schema

      sync
      optional

      The Javascript function that newly created documents in this collection are ran through.

      Example: function(doc){channel("collection name");}

      String

      import_filter
      optional

      This is the function that all imported documents in this collection are ran through in order to filter out what to import and what not to import. This allows you to control what is made available to Couchbase Mobile clients. If it is not set, then no documents are filtered when imported.

      import_docs in the database config must be true to make this field applicable.

      String

      Compact-status

      Name Description Schema

      status
      required

      The status of the current operation.

      String

      start_time
      required

      The ISO-8601 date and time the compact operation was started.

      String

      last_error
      required

      The last error that occurred in the compact operation (if any).

      String

      docs_purged
      optional

      Applicable to tombstone compaction only

      This is the amount of documents that have been purged so far.

      String

      marked_attachments
      optional

      Applicable to attachment compaction only

      This is the number of references there are to legacy attachments.

      String

      purged_attachments
      optional

      Applicable to attachment compaction only

      This is the amount of attachments that have been purged so far.

      String

      compact_id
      optional

      Applicable to attachment compaction only

      This is the ID of the compaction.

      String

      phase
      optional

      Applicable to attachment compaction only

      This indicates the current phase of running attachment compact processes.

      For failed processes, this indicates the phase at which a compact_id restart will commence (where relevant).

      String

      dry_run
      optional

      Applicable to attachment compaction only

      Values: mark, sweep, cleanup

      String

      Console-logging-config

      Name Description Schema

      log_level
      optional

      Log Level for the console output

      Values: none, error, warn, info, debug, trace
      Default: info

      String

      log_keys
      optional

      Log Keys for the console output

      String List

      color_enabled
      optional

      Log with color for the console output

      Default: false

      Boolean

      file_output
      optional

      Override the default stderr output, and write to the file specified instead

      String

      enabled
      optional

      Toggle for this log output

      Default: false

      Boolean

      rotation
      optional

      Log_rotation_config

      collation_buffer_size
      optional

      The size of the log collation buffer. The default is 10 if the output is stderr, or 1000 if to a file.

      Default: 10

      Integer

      Credentials config

      Name Description Schema

      username
      optional

      Username for authenticating to the bucket

      String

      password
      optional

      Password for authenticating to the bucket. This value is always redacted.

      String

      x509_cert_path
      optional

      Cert path (public key) for X.509 bucket auth

      String

      x509_key_path
      optional

      Key path (private key) for X.509 bucket auth

      String

      Credentials config

      Name Description Schema

      username
      optional

      Username for authenticating to the bucket

      String

      password
      optional

      Password for authenticating to the bucket. This value is always redacted.

      String

      x509_cert_path
      optional

      Cert path (public key) for X.509 bucket auth

      String

      x509_key_path
      optional

      Key path (private key) for X.509 bucket auth

      String

      Database-config

      Name Description Schema

      server
      optional

      This is the Couchbase Server address or addresses that the database connect to.

      String

      pool
      optional

      This field is unsupported and ignored.

      Default: default

      String

      bucket
      optional

      The Couchbase Server backing bucket for the database.

      Default: The database name

      String

      username
      optional

      The username for authenticating to the server.

      String

      password
      optional

      The password for authenticating to the server.

      String

      certpath
      optional

      The cert path (public key) for X.509 bucket auth.

      String

      keypath
      optional

      The key path (private key) for X.509 bucket auth

      String

      cacertpath
      optional

      The root CA cert path for X.509 bucket authentication.

      String

      kv_tls_port
      optional

      The Memcached TLS port.

      Default: 11207

      Integer

      max_concurrent_query_ops
      optional

      The maximum amount of query operations that can be running at any one point.

      Default: 1000

      Integer

      scopes
      optional

      An object keyed by scope name containing config for the specific collection.

      Scopes_1 Map

      name
      optional

      The name of the database.

      String

      sync
      optional

      The Javascript function that newly created documents are ran through for the default scope and collection. If scopes parameter is set, this is ignored.

      Default: function(doc){channel(doc.channels);}

      String

      users
      optional

      User_2 Map

      roles
      optional

      Role_2 Map

      revs_limit
      optional

      The maximum depth a document’s revision tree can grow too.

      The minimum is 20 if conflicts are allowed and 0 if not. It is not recommended to go below 100 when conflicts are allowed.

      Minimum: 0

      BigDecimal

      import_docs
      optional

      If true, documents will be imported in to Sync Gateway from the bucket when requested. Documents will be ran through the set import_filter if any is set.

      The default value depends on the edition of Sync Gateway being used. If the edition is the community-edition, then this will default to false or else in the enterprise-edition, it will default to true.

      This can also be set to the string continuous which maps to true.

      Boolean

      import_partitions
      optional

      • This is an enterprise-edition feature only**

      This is how many import partitions should be used for import sharding.

      Partitions are distributed among all Sync Gateway nodes participating in import processing (import_docs=true), and each process a subset of the server’s vbuckets.

      Each partition is processed by an independent function that runs simultaneously to others, so import_partitions can be used to tune concurrency based on the number of Sync Gateway nodes, and the number of cores per node.

      Default: 16

      BigDecimal

      import_filter
      optional

      This is the function that all imported documents in the default scope and collection are ran through in order to filter out what to import and what not to import. This allows you to control what is made available to Couchbase Mobile clients. If it is not set, then no documents are filtered when imported.

      import_docs must be true to make this field applicable.

      If scopes parameter is set, this is ignored.

      String

      import_backup_old_rev
      optional

      This controls whether import should attempt to create a temporary backup of the previous revision body (if available) when the document is modified in the bucket.

      Default: false

      Boolean

      event_handlers
      optional

      These are the settings for webhooks.

      Database_config_event_handlers

      feed_type
      optional

      The type of feed to use to communicate with Couchbase Server. This will use DCP regardless of specification.

      Values: DCP
      Default: DCP

      String

      allow_empty_password
      optional

      This controls whether users that are created can have an empty password or not.

      Default: false

      Boolean

      cache
      optional

      Database_config_cache

      rev_cache_size
      optional

      Deprecated, please use the database setting cache.rev_cache.size instead

      The maximum number of revisions to store in the revision cache.

      BigDecimal

      offline
      optional

      Start the database in an offline state.

      Default: false

      Boolean

      unsupported
      optional

      These are unsupported options and therefore it is not recommended to use them.

      Database_config_unsupported

      local_jwt
      optional

      Configuration for Local JWT authentication.

      Database_config_local_jwt_value Map

      oidc
      optional

      Configuration for OpenID Connect authentication.

      Database_config_oidc

      old_rev_expiry_seconds
      optional

      The number of seconds before old revisions are removed from the Couchbase Server bucket.

      Default: 300

      BigDecimal

      view_query_timeout_secs
      optional

      The number of seconds before a view query should timeout.

      Default: 75

      Integer

      local_doc_expiry_secs
      optional

      The number of seconds before a _local document should expire.

      Default: 7776000

      Integer

      enable_shared_bucket_access
      optional

      Whether to use extended attributes to store Sync Gateway document (_sync) metadata.

      Default: true

      Boolean

      session_cookie_secure
      optional

      Override the session cookie secure flag. If set, the cookie will have the secure flag.

      This will default to true if startup config api.https.tls_cert_path is set otherwise it will default to false.

      Boolean

      session_cookie_name
      optional

      This can be used to define a custom per-database session cookie name.

      String

      session_cookie_http_only
      optional

      Make all session cookies for the database set the HttpOnly flag so they are inaccessible to JavaScript.

      Default: false

      Boolean

      allow_conflicts
      optional

      This controls whether to allow conflicting document revisions.

      Default: true

      Boolean

      num_index_replicas
      optional

      This is the number of Global Secondary Indexes (GSI) to use for core indexes.

      Default: 1

      BigDecimal

      use_views
      optional

      Force the use of views instead of GSI.

      Default: false

      Boolean

      send_www_authenticate_header
      optional

      Controls whether to send a WWW-Authenticate header in 401 Unauthorized HTTP responses.

      Default: true

      Boolean

      disable_password_auth
      optional

      Whether to disable username/password authentication and only allow OIDC and guest access.

      Default: false

      Boolean

      bucket_op_timeout_ms
      optional

      This is the amount of milliseconds should pass before a bucket operation times out. An error will be returned if the bucket operation times out saying: operation timed out.

      BigDecimal

      slow_query_warning_threshold
      optional

      The amount of milliseconds a N1QL query should run before logging a warning.

      Default: 500

      BigDecimal

      delta_sync
      optional

      Delta sync configuration settings. **This is an enterprise-edition feature only**

      Database_config_delta_sync

      compact_interval_days
      optional

      The interval between scheduled tombstone compaction runs (in days). This can be a floating point number.

      If set to 0, compaction will not run automatically.

      Default: 1

      BigDecimal

      sgreplicate_enabled
      optional

      Whether the node should accept assign replications (true) or not (false).

      Default: true

      Boolean

      sgreplicate_websocket_heartbeat_secs
      optional

      Use a custom heartbeat interval (in seconds) for websocket ping frames.

      Default: 300

      Integer

      replications
      optional

      Database_config_replications

      serve_insecure_attachment_types
      optional

      If set, always serve attachments with the Content-Type header set to the type of the attachment.

      When serving an attachment, usually the Content-Type header is set to the type of the attachment but the Content-Disposition response header will be set instead if the content type is vulnerable to a phishing attack, causing the browser to download the file instead of display it. This option will override that behaviour and always set the Content-Type header.

      Default: false

      Boolean

      query_pagination_limit
      optional

      The query limit to be used during pagination of large queries.

      Default: 5000

      Integer

      user_xattr_key
      optional

      The key to use for the user xattr that will be accessible from the sync function. IF empty, the feature will be disabled.

      String

      client_partition_window_secs
      optional

      How long (in seconds) clients can remain offline for without losing replication metadata.

      Defaults to 30 days (in seconds)

      Default: 2592000

      Integer

      guest
      optional

      Properties associated with a user

      User_1

      javascript_timeout_secs
      optional

      The maximum number of seconds the sync, import filter, and custom conflict resolver JavaScript functions are allowed to run for before timing out. Set to 0 to allow the JS functions to run uncapped.

      Default: 60

      BigDecimal

      suspendable
      optional

      Set to true to allow the database to be suspended.

      Defaults to true when running in serverless mode otherwise defaults to false.

      Default: false

      Boolean

      cors
      optional

      CORS configuration for this database; if present, overrides server's config.

      Database_config_cors

      logging
      optional

      Per-database logging configuration.

      Database_config_logging

      Database-config

      Name Description Schema

      server
      optional

      This is the Couchbase Server address or addresses that the database connect to.

      String

      pool
      optional

      This field is unsupported and ignored.

      Default: default

      String

      bucket
      optional

      The Couchbase Server backing bucket for the database.

      Default: The database name

      String

      username
      optional

      The username for authenticating to the server.

      String

      password
      optional

      The password for authenticating to the server.

      String

      certpath
      optional

      The cert path (public key) for X.509 bucket auth.

      String

      keypath
      optional

      The key path (private key) for X.509 bucket auth

      String

      cacertpath
      optional

      The root CA cert path for X.509 bucket authentication.

      String

      kv_tls_port
      optional

      The Memcached TLS port.

      Default: 11207

      Integer

      max_concurrent_query_ops
      optional

      The maximum amount of query operations that can be running at any one point.

      Default: 1000

      Integer

      scopes
      optional

      An object keyed by scope name containing config for the specific collection.

      Scopes_1 Map

      name
      optional

      The name of the database.

      String

      sync
      optional

      The Javascript function that newly created documents are ran through for the default scope and collection. If scopes parameter is set, this is ignored.

      Default: function(doc){channel(doc.channels);}

      String

      users
      optional

      User_2 Map

      roles
      optional

      Role_2 Map

      revs_limit
      optional

      The maximum depth a document’s revision tree can grow too.

      The minimum is 20 if conflicts are allowed and 0 if not. It is not recommended to go below 100 when conflicts are allowed.

      Minimum: 0

      BigDecimal

      import_docs
      optional

      If true, documents will be imported in to Sync Gateway from the bucket when requested. Documents will be ran through the set import_filter if any is set.

      The default value depends on the edition of Sync Gateway being used. If the edition is the community-edition, then this will default to false or else in the enterprise-edition, it will default to true.

      This can also be set to the string continuous which maps to true.

      Boolean

      import_partitions
      optional

      • This is an enterprise-edition feature only**

      This is how many import partitions should be used for import sharding.

      Partitions are distributed among all Sync Gateway nodes participating in import processing (import_docs=true), and each process a subset of the server’s vbuckets.

      Each partition is processed by an independent function that runs simultaneously to others, so import_partitions can be used to tune concurrency based on the number of Sync Gateway nodes, and the number of cores per node.

      Default: 16

      BigDecimal

      import_filter
      optional

      This is the function that all imported documents in the default scope and collection are ran through in order to filter out what to import and what not to import. This allows you to control what is made available to Couchbase Mobile clients. If it is not set, then no documents are filtered when imported.

      import_docs must be true to make this field applicable.

      If scopes parameter is set, this is ignored.

      String

      import_backup_old_rev
      optional

      This controls whether import should attempt to create a temporary backup of the previous revision body (if available) when the document is modified in the bucket.

      Default: false

      Boolean

      event_handlers
      optional

      These are the settings for webhooks.

      Database_config_event_handlers

      feed_type
      optional

      The type of feed to use to communicate with Couchbase Server. This will use DCP regardless of specification.

      Values: DCP
      Default: DCP

      String

      allow_empty_password
      optional

      This controls whether users that are created can have an empty password or not.

      Default: false

      Boolean

      cache
      optional

      Database_config_cache

      rev_cache_size
      optional

      Deprecated, please use the database setting cache.rev_cache.size instead

      The maximum number of revisions to store in the revision cache.

      BigDecimal

      offline
      optional

      Start the database in an offline state.

      Default: false

      Boolean

      unsupported
      optional

      These are unsupported options and therefore it is not recommended to use them.

      Database_config_unsupported

      local_jwt
      optional

      Configuration for Local JWT authentication.

      Database_config_local_jwt_value Map

      oidc
      optional

      Configuration for OpenID Connect authentication.

      Database_config_oidc

      old_rev_expiry_seconds
      optional

      The number of seconds before old revisions are removed from the Couchbase Server bucket.

      Default: 300

      BigDecimal

      view_query_timeout_secs
      optional

      The number of seconds before a view query should timeout.

      Default: 75

      Integer

      local_doc_expiry_secs
      optional

      The number of seconds before a _local document should expire.

      Default: 7776000

      Integer

      enable_shared_bucket_access
      optional

      Whether to use extended attributes to store Sync Gateway document (_sync) metadata.

      Default: true

      Boolean

      session_cookie_secure
      optional

      Override the session cookie secure flag. If set, the cookie will have the secure flag.

      This will default to true if startup config api.https.tls_cert_path is set otherwise it will default to false.

      Boolean

      session_cookie_name
      optional

      This can be used to define a custom per-database session cookie name.

      String

      session_cookie_http_only
      optional

      Make all session cookies for the database set the HttpOnly flag so they are inaccessible to JavaScript.

      Default: false

      Boolean

      allow_conflicts
      optional

      This controls whether to allow conflicting document revisions.

      Default: true

      Boolean

      num_index_replicas
      optional

      This is the number of Global Secondary Indexes (GSI) to use for core indexes.

      Default: 1

      BigDecimal

      use_views
      optional

      Force the use of views instead of GSI.

      Default: false

      Boolean

      send_www_authenticate_header
      optional

      Controls whether to send a WWW-Authenticate header in 401 Unauthorized HTTP responses.

      Default: true

      Boolean

      disable_password_auth
      optional

      Whether to disable username/password authentication and only allow OIDC and guest access.

      Default: false

      Boolean

      bucket_op_timeout_ms
      optional

      This is the amount of milliseconds should pass before a bucket operation times out. An error will be returned if the bucket operation times out saying: operation timed out.

      BigDecimal

      slow_query_warning_threshold
      optional

      The amount of milliseconds a N1QL query should run before logging a warning.

      Default: 500

      BigDecimal

      delta_sync
      optional

      Delta sync configuration settings. **This is an enterprise-edition feature only**

      Database_config_delta_sync

      compact_interval_days
      optional

      The interval between scheduled tombstone compaction runs (in days). This can be a floating point number.

      If set to 0, compaction will not run automatically.

      Default: 1

      BigDecimal

      sgreplicate_enabled
      optional

      Whether the node should accept assign replications (true) or not (false).

      Default: true

      Boolean

      sgreplicate_websocket_heartbeat_secs
      optional

      Use a custom heartbeat interval (in seconds) for websocket ping frames.

      Default: 300

      Integer

      replications
      optional

      Database_config_replications

      serve_insecure_attachment_types
      optional

      If set, always serve attachments with the Content-Type header set to the type of the attachment.

      When serving an attachment, usually the Content-Type header is set to the type of the attachment but the Content-Disposition response header will be set instead if the content type is vulnerable to a phishing attack, causing the browser to download the file instead of display it. This option will override that behaviour and always set the Content-Type header.

      Default: false

      Boolean

      query_pagination_limit
      optional

      The query limit to be used during pagination of large queries.

      Default: 5000

      Integer

      user_xattr_key
      optional

      The key to use for the user xattr that will be accessible from the sync function. IF empty, the feature will be disabled.

      String

      client_partition_window_secs
      optional

      How long (in seconds) clients can remain offline for without losing replication metadata.

      Defaults to 30 days (in seconds)

      Default: 2592000

      Integer

      guest
      optional

      Properties associated with a user

      User_1

      javascript_timeout_secs
      optional

      The maximum number of seconds the sync, import filter, and custom conflict resolver JavaScript functions are allowed to run for before timing out. Set to 0 to allow the JS functions to run uncapped.

      Default: 60

      BigDecimal

      suspendable
      optional

      Set to true to allow the database to be suspended.

      Defaults to true when running in serverless mode otherwise defaults to false.

      Default: false

      Boolean

      cors
      optional

      CORS configuration for this database; if present, overrides server's config.

      Database_config_cors

      logging
      optional

      Per-database logging configuration.

      Database_config_logging

      DatabaseConfigCache

      Name Description Schema

      rev_cache
      optional

      The revision cache config settings.

      Database_config_cache_rev_cache

      channel_cache
      optional

      The channel cache config settings.

      Database_config_cache_channel_cache

      max_wait_pending
      optional

      Deprecated, please use the database setting cache.channel_cache.max_wait_pending instead

      The maximum time (in milliseconds) for waiting for a pending sequence before skipping it.

      BigDecimal

      max_wait_skipped
      optional

      Deprecated, please use the database setting cache.channel_cache.max_wait_skipped instead

      The maximum time (in milliseconds) for waiting for pending sequences before skipping.

      BigDecimal

      enable_star_channel
      optional

      Deprecated, please use the database setting cache.channel_cache.enable_star_channel instead

      Used to control whether Sync Gateway should use the all documents (*) channel.

      Boolean

      channel_cache_max_length
      optional

      Deprecated, please use the database setting cache.channel_cache.max_length instead

      The maximum number of entries maintained in cache per channel.

      BigDecimal

      channel_cache_min_length
      optional

      Deprecated, please use the database setting cache.channel_cache.min_length instead

      The minimum number of entries maintained in cache per channel.

      Integer

      channel_cache_expiry
      optional

      Deprecated, please use the database setting cache.channel_cache.expiry_seconds instead

      The time (seconds) to keep entries in cache beyond the minimum retained.

      Integer

      max_num_pending
      optional

      Deprecated, please use the database setting cache.channel_cache.max_num_pending instead

      The max number of pending sequences before skipping.

      Integer

      DatabaseConfigCacheChannelCache

      Name Description Schema

      max_number
      optional

      The maximum number of channel caches which can exist at any one point.

      Default: 50000

      Integer

      compact_high_watermark_pct
      optional

      The trigger value for starting the channel cache eviction process.

      Specify this as a percentage which will be the percentage used on `max_number).

      When the cache size, determined by max_number, reaches the high watermark, the eviction process iterates through the cache, removing inactive channels.

      Default: 80

      Integer

      compact_low_watermark_pct
      optional

      The trigger value for stopping the channel cache eviction process.

      Specify this as a percentage which will be the percentage used on `max_number).

      When the cache size, determined by max_number returns to a value lower than the percentage of it set here, the cache eviction process is stopped.

      Default: 60

      Integer

      max_wait_pending
      optional

      The maximum time (in milliseconds) for waiting for a pending sequence before skipping it.

      Default: 5000

      BigDecimal

      max_num_pending
      optional

      The maximum number of pending sequences before skipping sequences.

      Default: 10000

      Integer

      max_wait_skipped
      optional

      The maximum amount of time (in milliseconds) to wait for a skipped sequence before abandoning it.

      Default: 3600000

      BigDecimal

      enable_star_channel
      optional

      Used to control whether Sync Gateway should use the all documents (*) channel.

      Default: true

      Boolean

      max_length
      optional

      The maximum number of entries to maintain in the cache per channel.

      Default: 500

      Integer

      min_length
      optional

      The minimum number of entries to maintain in the cache per channel.

      Default: 50

      Integer

      expiry_seconds
      optional

      The amount of time (in seconds) to keep entries in the cache beyond the minimum retained.

      Default: 60

      Integer

      query_limit
      optional

      Deprecated in favour of the database setting query_pagination_limit

      The limit used for channel queries.

      Default: 5000

      Integer

      DatabaseConfigCacheRevCache

      Name Description Schema

      size
      optional

      The maximum number of revisions that can be stored in the revision cache.

      Default: 5000

      String

      shard_count
      optional

      The number of shards the revision cache should be split into.

      Default: 16

      String

      DatabaseConfigCors

      Name Description Schema

      origin
      optional

      List of allowed origins, use ['*'] to allow access from everywhere

      String List

      login_origin
      optional

      List of allowed login origins

      String List

      headers
      optional

      List of allowed headers

      String List

      DatabaseConfigDeltaSync

      Name Description Schema

      enabled
      optional

      Whether delta sync is enabled.

      This is an enterprise-edition feature only

      Default: false

      Boolean

      rev_max_age_seconds
      optional

      The number of seconds deltas for old revisions are available for.

      This defaults to 24 hours (in seconds).

      Default: 86400

      BigDecimal

      DatabaseConfigEventHandlers

      Name Description Schema

      max_processes
      optional

      The maximum amount of concurrent event handling independent functions that can be running at the same time.

      String

      wait_for_process
      optional

      The maximum amount of time (in milliseconds) to wait when the even queue is full.

      String

      document_changed
      optional

      Event_config

      db_state_changed
      optional

      Event_config

      DatabaseConfigLocalJwtValue

      Name Description Schema

      issuer
      required

      The value to match against the "iss" claim of JWTs.

      String

      register
      optional

      If to register a new Sync Gateway user account when a user logs in with a JWT.

      Boolean

      client_id
      required

      The value to match against the "aud" claim of JWTs. Set to an empty string to disable audience validation.

      String

      algorithms
      required

      The JWT signing algorithms to accept for authentication.

      String List

      keys
      required

      The JSON Web Keys to use to validate JWTs.

      Database_config_local_jwt_value_keys_inner List

      disable_session
      optional

      Disable Sync Gateway session creation on successful JWT authentication.

      Boolean

      user_prefix
      optional

      This is the username prefix for all users created through this provider.

      String

      username_claim
      optional

      Allows a different OpenID Connect field to be specified instead of the Subject (sub).

      The field name to use can be specified here.

      String

      roles_claim
      optional

      If set, the value(s) of the given JSON Web Token claim will be added to the user’s roles.

      The value of this claim must be either a string or an array of strings, any other type will result in an error.

      String

      channels_claim
      optional

      If set, the value(s) of the given JSON Web Token claim will be added to the user’s channels.

      The value of this claim must be either a string or an array of strings, any other type will result in an error.

      String

      DatabaseConfigLocalJwtValueKeysInner

      Name Description Schema

      kty
      optional

      The cryptographic algorithm family used with the key, such as "RSA" or "EC"

      Values: RSA, EC

      String

      use
      optional

      The intended use of the public key. Only 'sig' is accepted.

      Values: sig

      String

      alg
      optional

      The algorithm intended for use with the key.

      String

      kid
      optional

      The Key ID, used to identify the key to use.

      String

      crv
      optional

      For Elliptic Curve keys, the name of the curve to use.

      Values: P-256, P-384, P-521

      String

      x
      optional

      For Elliptic Curve keys, the X coordinate of the point, as a base64url string.

      String

      y
      optional

      For Elliptic Curve keys, the Y coordinate of the point, as a base64url string.

      String

      n
      optional

      For RSA keys, the modulus value of the key, as a Base64urlUInt-encoded value.

      String

      e
      optional

      For RSA keys, the exponent of the public key, as a Base64urlUInt-encoded value.

      String

      DatabaseConfigLogging

      Name Description Schema

      console
      optional

      Console logging configuration.

      Database_config_logging_console

      DatabaseConfigLoggingConsole

      Name Description Schema

      log_level
      optional

      Log Level for the console output

      Values: none, error, warn, info, debug, trace
      Example: debug

      String

      log_keys
      optional

      Log Keys for the console output

      Example: ["CRUD","HTTP","Query"]

      String List

      DatabaseConfigOidc

      Name Description Schema

      providers
      optional

      List of OpenID Connect issuers.

      Database_config_oidc_providers_value Map

      default_provider
      optional

      The default provider to use when the provider is not specified in the client.

      String

      DatabaseConfigOidcProvidersValue

      Name Description Schema

      issuer
      optional

      The URL for the OpenID Connect issuer.

      String

      register
      optional

      If to register a new Sync Gateway user account when a user logs in with OpenID Connect.

      Boolean

      client_id
      optional

      The OpenID Connect provider client ID.

      String

      validation_key
      optional

      The OpenID Connect provider client secret.

      String

      callback_url
      optional

      The URL that the OpenID Connect will redirect to after authentication.

      If not provided, a callback URL will be generated.

      String

      disable_session
      optional

      Disable Sync Gateway session creation on successful OpenID Connect authentication.

      Boolean

      scope
      optional

      The scope sent for the OpenID Connect request.

      String List

      include_access
      optional

      This is whether the _oidc_callback response should include the OpenID Connect access token and associated fields (such as token_type, and expires_in).

      Boolean

      user_prefix
      optional

      This is the username prefix for all users created through this provider.

      String

      discovery_url
      optional

      The non-standard discovery endpoint.

      String

      disable_cfg_validation
      optional

      This bypasses the configuration validation based on the OpenID Connect specifications. This may be required for some OpenID providers that don’t strictly adhere to the specifications.

      Default: false

      Boolean

      disable_callback_state
      optional

      Controls whether to maintain state between the auth request and callback endpoints (/_oidc and /_oidc_callback).

      This is not recommended as it would cause OpenID Connect authentication to be vulnerable to Cross-Site Request Forgery (CSRF, XSRF).

      Default: false

      Boolean

      username_claim
      optional

      Allows a different OpenID Connect field to be specified instead of the Subject (sub).

      The field name to use can be specified here.

      String

      roles_claim
      optional

      If set, the value(s) of the given OpenID Connect authentication token claim will be added to the user’s roles.

      The value of this claim must be either a string or an array of strings, any other type will result in an error.

      String

      channels_claim
      optional

      If set, the value(s) of the given OpenID Connect authentication token claim will be added to the user’s channels.

      The value of this claim must be either a string or an array of strings, any other type will result in an error.

      String

      allow_unsigned_provider_tokens
      optional

      Allows users accept unsigned tokens from providers.

      Boolean

      IsDefault
      optional

      Indicates if this is the default OpenID Connect provider.

      Boolean

      Name
      optional

      The name of the OpenID Connect Provider.

      String

      InsecureSkipVerify
      optional

      Determines whether the TLS certificate verification should be disabled for this provider.

      Default: false

      Boolean

      DatabaseConfigReplications

      Name Description Schema

      replication_id
      optional

      Properties of a replication

      User_configurable_replication_properties

      DatabaseConfigUnsupported

      Name Description Schema

      user_views
      optional

      Database_config_unsupported_user_views

      oidc_test_provider
      optional

      Database_config_unsupported_oidc_test_provider

      api_endpoints
      optional

      Database_config_unsupported_api_endpoints

      warning_thresholds
      optional

      Database_config_unsupported_warning_thresholds

      oidc_tls_skip_verify
      optional

      Enable self-signed certificates for OIDC testing.

      Boolean

      sgr_tls_skip_verify
      optional

      Enable self-signed certificates for SG-replicate testing.

      Boolean

      remote_config_tls_skip_verify
      optional

      Enable self-signed certificates for external JavaScript load.

      Boolean

      guest_read_only
      optional

      Restrict GUEST document access to read-only.

      Boolean

      force_api_forbidden_errors
      optional

      Force REST API errors to return forbidden

      Boolean

      dcp_read_buffer
      optional

      Set the dcp feed to use a different read buffer size.

      BigDecimal

      kv_buffer
      optional

      Set the kv pool to use a different buffer size.

      BigDecimal

      DatabaseConfigUnsupportedApiEndpoints

      Name Description Schema

      enable_couchbase_bucket_flush
      optional

      Setting for test purposes only

      Whether Couchbase buckets can be flushed via Admin REST API.

      Boolean

      DatabaseConfigUnsupportedOidcTestProvider

      Name Description Schema

      enabled
      optional

      Whether the oidc_test_provider endpoints should be exposed on the public API.

      Boolean

      DatabaseConfigUnsupportedUserViews

      Name Description Schema

      enabled
      optional

      Whether pass-through view query is supported through public API.

      Boolean

      DatabaseConfigUnsupportedWarningThresholds

      Name Description Schema

      xattr_size_bytes
      optional

      The number of bytes to be used as a threshold for xattr size limit warnings.

      BigDecimal

      channels_per_doc
      optional

      The number of channels per document to be used as a threshold for the channel count warnings.

      BigDecimal

      access_and_role_grants_per_doc
      optional

      The number of access and role grants per document to be used as a threshold for grant count warnings.

      BigDecimal

      channels_per_user
      optional

      The number of channels per user to be used as a threshold for channel count warnings.

      BigDecimal

      channel_name_size
      optional

      The number of channel name characters to be used as a threshold for channel name warnings.

      BigDecimal

      DeleteSgcollectInfo200Response

      Name Description Schema

      status
      optional

      The new status of sgcollect_info.

      Default: cancelled

      String

      DesignDoc

      Name Description Schema

      language
      optional

      String

      views
      optional

      get_db__design_ddoc_200_response_views_value Map

      options
      optional

      get_db__design_ddoc_200_response_options

      Document

      Name Description Schema

      _id
      optional

      The ID of the document.

      String

      _rev
      optional

      The revision of the document.

      String

      _exp
      optional

      Expiry time after which the document will be purged. The expiration time is set and managed on the Couchbase Server document. The value can be specified in two ways; in ISO-8601 format, for example the 6th of July 2022 at 17:00 in the BST timezone would be 2016-07-06T17:00:00+01:00; it can also be specified as a numeric Couchbase Server expiry value. Couchbase Server expiry values are specified as Unix time, and if the desired TTL is below 30 days then it can also represent an interval in seconds from the current time (for example, a value of 5 will remove the document 5 seconds after it is written to Couchbase Server). The document expiration time is returned in the response of GET /{db}/{doc} ` when `show_exp=true is included in the query.

      As with the existing explicit purge mechanism, this applies only to the local database; it has nothing to do with replication. This expiration time is not propagated when the document is replicated. The purge of the document does not cause it to be deleted on any other database.

      String

      _deleted
      optional

      Whether the document is a tombstone or not. If true, it is a tombstone.

      Boolean

      _revisions
      optional

      post_keyspace__request__revisions

      _attachments
      optional

      post_keyspace__request__attachments_value Map

      Event-config

      Name Description Schema

      handler
      optional

      The handler type.

      Values: webhook

      String

      url
      optional

      The URL of the webhook.

      String

      filter
      optional

      The Javascript function to use to filter the webhook events.

      String

      timeout
      optional

      The amount of time (in seconds) to attempt connect to the webhook before giving up.

      BigDecimal

      options
      optional

      The options for the event.

      oas_any_type_not_mapped Map

      ExpVars

      Name Description Schema

      cmdline
      optional

      Built-in variables from the Go runtime, lists the command-line arguments

      Object

      memstats
      optional

      Dumps a large amount of information about the memory heap and garbage collector

      Object

      cb
      optional

      Variables reported by the Couchbase SDK (go_couchbase package)

      Object

      mc
      optional

      Variables reported by the low-level memcached API (gomemcached package)

      Object

      syncGateway_changeCache
      optional

      get__expvar_200_response_syncGateway_changeCache

      syncGateway_db
      optional

      get__expvar_200_response_syncGateway_db

      syncgateway
      optional

      Monitoring stats

      get__expvar_200_response_syncgateway

      Get200Response

      Name Description Schema

      ADMIN
      optional

      true if the request is from the Admin API - otherwise omitted.

      Example: true

      Boolean

      couchdb
      required

      CouchDB welcome

      Example: Welcome

      String

      vendor
      required

      Product vendor

      get___200_response_vendor

      version
      optional

      Product version, including the build number and edition (i.e. EE or CE) Omitted if api.hide_product_version=true

      Example: Couchbase Sync Gateway/3.1.0(1;a765231) EE

      String

      persistent_config
      optional

      Indication for whether sync gateway is running in persistent config mode or legacy config mode. true if the sync gateway node is running in persistent config mode.

      Example: true

      Boolean

      Get200ResponseVendor

      Name Description Schema

      name
      required

      Product name

      Example: Couchbase Sync Gateway

      String

      version
      optional

      API version. Omitted if api.hide_product_version=true

      Example: 3.1

      String

      GetAllDbs200Response

      One of the following:

      GetAllDbs200ResponseOneOfInner

      Name Description Schema

      db_name
      optional

      The name of the database.

      String

      bucket
      optional

      The Couchbase Server backing bucket for the database.

      String

      state
      optional

      The database state.

      Values: Online, Offline, Starting, Stopping, Resyncing

      String

      require_resync
      optional

      Indicates whether the database requires resync before it can be brought online.

      Example: true

      Boolean

      init_in_progress
      optional

      Indicates whether database initialization is in progress.

      Example: true

      Boolean

      GetDb200Response

      Name Description Schema

      db_name
      optional

      Database name

      Example: db

      String

      update_seq
      optional

      The last sequence number that was committed to the database.

      Will return 0 if the database is offline.

      Example: 123456

      Integer

      committed_update_seq
      optional

      The last sequence number that was committed to the database.

      Will return 0 if the database is offline.

      Example: 123456

      Integer

      instance_start_time
      optional

      Timestamp of when the database opened, in microseconds since the Unix epoch.

      Example: 1644600082279583

      Integer

      compact_running
      optional

      Indicates whether database compaction is currently taking place or not.

      Boolean

      purge_seq
      optional

      Unused field.

      Default: 0

      BigDecimal

      disk_format_version
      optional

      Unused field.

      Default: 0

      BigDecimal

      state
      optional

      The database state. Change using the /{db}/_offline and /{db}/_online endpoints.

      Values: Online, Offline

      String

      server_uuid
      optional

      Unique server identifier.

      Example: 995618a6a6cc9ac79731bd13240e19b5

      String

      init_in_progress
      optional

      Indicates whether database initialization is in progress.

      Boolean

      GetDbDesignDdoc200Response

      Name Description Schema

      language
      optional

      String

      views
      optional

      get_db__design_ddoc_200_response_views_value Map

      options
      optional

      get_db__design_ddoc_200_response_options

      GetDbDesignDdoc200ResponseOptions

      Name Description Schema

      local_seq
      optional

      String

      include_design
      optional

      String

      raw
      optional

      String

      index_xattr_on_deleted_docs
      optional

      String

      GetDbDesignDdoc200ResponseViewsValue

      Name Description Schema

      map
      optional

      String

      reduce
      optional

      String

      GetDbOidcTestingCerts200Response

      Name Description Schema

      keys
      required

      get_db__oidc_testing_certs_200_response_keys_inner List

      GetDbOidcTestingCerts200ResponseKeysInner

      Name Description Schema

      Key
      required

      Object

      KeyID
      required

      String

      Use
      required

      String

      Certificates
      optional

      Object List

      Algorithm
      optional

      String

      GetDbOidcTestingWellKnownOpenidConfiguration200Response

      Name Description Schema

      issuer
      optional

      String

      authorization_endpoint
      optional

      String

      token_endpoint
      optional

      String

      jwks_uri
      optional

      String

      userinfo_endpoint
      optional

      String

      id_token_signing_alg_values_supported
      optional

      String

      response_types_supported
      optional

      String

      subject_types_supported
      optional

      String

      scopes_supported
      optional

      String

      claims_supported
      optional

      String

      token_endpoint_auth_methods_supported
      optional

      String

      GetDbViewView200Response

      Name Description Schema

      total_rows
      required

      Integer

      rows
      required

      get_db__view_view_200_response_rows_inner List

      errors
      optional

      get_db__view_view_200_response_errors_inner List

      GetDbViewView200ResponseErrorsInner

      Name Description Schema

      From
      optional

      String

      Reason
      optional

      String

      GetDbViewView200ResponseRowsInner

      Name Description Schema

      id
      optional

      String

      key
      optional

      Object

      value
      optional

      Object

      doc
      optional

      Object

      GetExpvar200Response

      Name Description Schema

      cmdline
      optional

      Built-in variables from the Go runtime, lists the command-line arguments

      Object

      memstats
      optional

      Dumps a large amount of information about the memory heap and garbage collector

      Object

      cb
      optional

      Variables reported by the Couchbase SDK (go_couchbase package)

      Object

      mc
      optional

      Variables reported by the low-level memcached API (gomemcached package)

      Object

      syncGateway_changeCache
      optional

      get__expvar_200_response_syncGateway_changeCache

      syncGateway_db
      optional

      get__expvar_200_response_syncGateway_db

      syncgateway
      optional

      Monitoring stats

      get__expvar_200_response_syncgateway

      GetExpvar200ResponseSyncGatewayChangeCache

      Name Description Schema

      maxPending
      optional

      Max number of sequences waiting on a missing earlier sequence number

      Object

      lag-tap-0000ms
      optional

      Histogram of delay from doc save till it shows up in Tap feed

      Object

      lag-queue-0000ms
      optional

      Histogram of delay from Tap feed till doc is posted to changes feed

      Object

      lag-total-0000ms
      optional

      Histogram of total delay from doc save till posted to changes feed

      Object

      outOfOrder
      optional

      Number of out-of-order sequences posted

      Object

      view_queries
      optional

      Number of queries to channels view

      Object

      GetExpvar200ResponseSyncGatewayDb

      Name Description Schema

      channelChangesFeeds
      optional

      Number of calls to db.changesFeed, i.e. generating a changes feed for a single channel.

      Object

      channelLogAdds
      optional

      Number of entries added to channel logs

      Object

      channelLogAppends
      optional

      Number of times entries were written to channel logs using an APPEND operation

      Object

      channelLogCacheHits
      optional

      Number of requests for channel-logs that were fulfilled from the in-memory cache

      Object

      channelLogRewrites
      optional

      Number of times entries were written to channel logs using a SET operation (rewriting the entire log)

      Object

      channelLogRewriteCollisions
      optional

      Number of collisions while attempting to rewrite channel logs using SET

      Object

      document_gets
      optional

      Number of times a document was read from the database

      Object

      revisionCache_adds
      optional

      Number of revisions added to the revision cache

      Object

      revisionCache_hits
      optional

      Number of times a revision-cache lookup succeeded

      Object

      revisionCache_misses
      optional

      Number of times a revision-cache lookup failed

      Object

      revs_added
      optional

      Number of revisions added to the database (including deletions)

      Object

      sequence_gets
      optional

      Number of times the database’s lastSequence was read

      Object

      sequence_reserves
      optional

      Number of times the database’s lastSequence was incremented

      Object

      GetExpvar200ResponseSyncgateway

      Name Description Schema

      global
      optional

      Global Sync Gateway stats

      get__expvar_200_response_syncgateway_global

      per_db
      optional

      This array contains stats for all databases declared in the config file — see the [Sync Gateway Statistics Schema](./../stats-monitoring.html) for more details on the metrics collected and reported by Sync Gateway. The statistics for each {$db_name} database are grouped into: - cache related statistics - collections statistics - cbl_replication_push - cbl_replication_pull - database_related_statistics - delta_sync - gsi_views - security_related_statistics - shared_bucket_import - per_replication statistics for each replication_id

      get__expvar_200_response_syncgateway_per_db_inner List

      per_replication
      optional

      An array of stats for each replication declared in the config file Deprecated @ 2.8: used only by inter-sync-gateway replications version 1.

      get__expvar_200_response_syncgateway_per_replication_inner List

      GetExpvar200ResponseSyncgatewayGlobal

      Name Description Schema

      resource_utilization
      optional

      Resource utilization stats

      get__expvar_200_response_syncgateway_global_resource_utilization

      GetExpvar200ResponseSyncgatewayGlobalResourceUtilization

      Name Description Schema

      admin_net_bytes_recv
      optional

      The total number of bytes received (since node start-up) on the network interface to which the Sync Gateway api.admin_interface is bound.

      Integer

      admin_net_bytes_sent
      optional

      The total number of bytes sent (since node start-up) on the network interface to which the Sync Gateway api.admin_interface is bound.

      Integer

      error_count
      optional

      The total number of errors logged.

      Integer

      go_memstats_heapalloc
      optional

      HeapAlloc is bytes of allocated heap objects. Allocated heap objects include all reachable objects, as well as unreachable objects that the garbage collector has not yet freed. Specifically, HeapAlloc increases as heap objects are allocated and decreases as the heap is swept and unreachable objects are freed. Sweeping occurs incrementally between GC cycles, so these two processes occur simultaneously, and as a result HeapAlloc tends to change smoothly (in contrast with the sawtooth that is typical of stop-the-world garbage collectors).

      Integer

      go_memstats_heapidle
      optional

      HeapIdle is bytes in idle (unused) spans. Idle spans have no objects in them. These spans could be (and may already have been) returned to the OS, or they can be reused for heap allocations, or they can be reused as stack memory. HeapIdle minus HeapReleased estimates the amount of memory that could be returned to the OS, but is being retained by the runtime so it can grow the heap without requesting more memory from the OS. If this difference is significantly larger than the heap size, it indicates there was a recent transient spike in live heap size.

      Integer

      go_memstats_heapinuse
      optional

      HeapInuse is bytes in in-use spans. In-use spans have at least one object in them. These spans an only be used for other objects of roughly the same size. HeapInuse minus HeapAlloc estimates the amount of memory that has been dedicated to particular size classes, but is not currently being used. This is an upper bound on fragmentation, but in general this memory can be reused efficiently.

      Integer

      go_memstats_heapreleased
      optional

      HeapReleased is bytes of physical memory returned to the OS. This counts heap memory from idle spans that was returned to the OS and has not yet been reacquired for the heap.

      Integer

      go_memstats_pausetotalns
      optional

      PauseTotalNs is the cumulative nanoseconds in GC stop-the-world pauses since the program started. During a stop-the-world pause, all goroutines are paused and only the garbage collector can run.

      Integer

      go_memstats_stackinuse
      optional

      StackInuse is bytes in stack spans. In-use stack spans have at least one stack in them. These spans can only be used for other stacks of the same size. There is no StackIdle because unused stack spans are returned to the heap (and hence counted toward HeapIdle).

      Integer

      go_memstats_stacksys
      optional

      StackSys is bytes of stack memory obtained from the OS. StackSys is StackInuse, plus any memory obtained directly from the OS for OS thread stacks (which should be minimal).

      Integer

      go_memstats_sys
      optional

      Sys is the total bytes of memory obtained from the OS. Sys is the sum of the XSys fields below. Sys measures the virtual address space reserved by the Go runtime for the heap, stacks, and other internal data structures. It’s likely that not all of the virtual address space is backed by physical memory at any given moment, though in general it all was at some point.

      Integer

      goroutines_high_watermark
      optional

      Peak number of go routines since process start.

      Integer

      num_goroutines
      optional

      The total number of goroutines.

      Integer

      num_idle_kv_ops
      optional

      The total number of idle kv operations.

      Integer

      process_cpu_percent_utilization
      optional

      The CPU utilization as percentage value * 10. The extra 10 multiplier is a mistake left for backwards compatibility. Please consider using node_cpu_percent_utilization as of version 3.2. The CPU usage calculation is performed based on user and system CPU time, but it does not include components such as iowait. The derivation means that the values of process_cpu_percent_utilization and %Cpu, returned when running the top command, will differ.

      Float (float)

      node_cpu_percent_utilization
      optional

      The node CPU utilization as percentage value, since the last time this stat was called. The CPU usage calculation is performed based on user and system CPU time, but it does not include components such as iowait.

      Float (float)

      process_memory_resident
      optional

      The memory utilization (Resident Set Size) for the process, in bytes.

      Integer

      pub_net_bytes_recv
      optional

      The total number of bytes received (since node start-up) on the network interface to which the Sync Gateway api.public_interface is bound. By default, that is the number of bytes received on 127.0.0.1:4984 since node start-up

      Integer

      pub_net_bytes_sent
      optional

      The total number of bytes sent (since node start-up) on the network interface to which Sync Gateway api.public_interface is bound. By default, that is the number of bytes sent on 127.0.0.1:4984 since node start-up.

      Integer

      system_memory_total
      optional

      The total memory available on the system in bytes.

      Integer

      warn_count
      optional

      The total number of warnings logged.

      Integer

      uptime
      optional

      The total uptime.

      Integer

      GetExpvar200ResponseSyncgatewayPerDbInner

      Name Description Schema

      cache
      optional

      Object

      database
      optional

      Object

      per_replication
      optional

      Object

      collections
      optional

      Object

      security
      optional

      Object

      GetExpvar200ResponseSyncgatewayPerReplicationInner

      Name Description Schema

      $replication_id
      optional

      get__expvar_200_response_syncgateway_per_replication_inner__replication_id

      GetExpvar200ResponseSyncgatewayPerReplicationInnerReplicationId

      Name Description Schema

      sgr_active
      optional

      Whether the replication is active at this time. Deprecated @ 2.8: used only by inter-sync-gateway replications version 1.

      Boolean

      sgr_docs_checked_sent
      optional

      The total number of documents checked for changes since replication started. This represents the number of potential change notifications pushed by Sync Gateway. Constraints This is not necessarily the number of documents pushed, as a given target might already have the change. Used by versions 1 and 2.

      Integer

      sgr_num_attachments_transferred
      optional

      The total number of attachments transferred since replication started. Deprecated @ 2.8: used only by inter-sync-gateway replications version 1.

      Integer

      sgr_num_attachment_bytes_transferred
      optional

      The total number of attachment bytes transferred since replication started. Deprecated @ 2.8: used only by inter-sync-gateway replications version 1.

      Integer

      sgr_num_docs_failed_to_push
      optional

      The total number of documents that failed to be pushed since replication started. Used by versions 1 and 2.

      Integer

      sgr_num_docs_pushed
      optional

      The total number of documents that were pushed since replication started. Used by versions 1 and 2.

      Integer

      GetKeyspaceAllDocs200Response

      Name Description Schema

      rows
      required

      get_keyspace__all_docs_200_response_rows_inner Set

      total_rows
      required

      BigDecimal

      update_seq
      required

      BigDecimal

      GetKeyspaceAllDocs200ResponseRowsInner

      Name Description Schema

      key
      optional

      String

      id
      optional

      String

      value
      optional

      get_keyspace__all_docs_200_response_rows_inner_value

      GetKeyspaceAllDocs200ResponseRowsInnerValue

      Name Description Schema

      rev
      optional

      String

      GetKeyspaceChanges200Response

      Name Description Schema

      results
      optional

      get_keyspace__changes_200_response_results_inner Set

      last_seq
      optional

      The last change sequence number.

      String

      GetKeyspaceChanges200ResponseResultsInner

      Name Description Schema

      seq
      optional

      The change sequence number.

      BigDecimal

      id
      optional

      The document ID the change happened on.

      String

      changes
      optional

      List of document leafs with each leaf containing only a rev field.

      get_keyspace__changes_200_response_results_inner_changes_inner Set

      GetKeyspaceChanges200ResponseResultsInnerChangesInner

      Name Description Schema

      rev
      optional

      The new revision that was caused by that change.

      String

      GetKeyspaceDocid200Response

      Name Description Schema

      _id
      optional

      The ID of the document.

      String

      _rev
      optional

      The revision ID of the document.

      String

      GetKeyspaceRawDocid200Response

      Name Description Schema

      _sync
      optional

      get_keyspace__raw_docid_200_response__sync

      GetKeyspaceRawDocid200ResponseSync

      Name Description Schema

      rev
      optional

      The current document revision ID.

      String

      sequence
      optional

      The most recent sequence number of the document.

      BigDecimal

      recent_sequences
      optional

      The previous sequence numbers of the document.

      BigDecimal List

      history
      optional

      get_keyspace__raw_docid_200_response__sync_history

      cas
      optional

      The document CAS (Concurrent Document Mutations) number used for document locking.

      String

      value_crc32c
      optional

      The documents CRC32 number.

      String

      channel_set
      optional

      The channels the document has been in.

      get_keyspace__raw_docid_200_response__sync_channel_set_inner List

      channel_set_history
      optional

      get_keyspace__raw_docid_200_response__sync_channel_set_history_inner List

      time_saved
      optional

      The time and date the document was most recently changed.

      String

      GetKeyspaceRawDocid200ResponseSyncChannelSetHistoryInner

      Name Description Schema

      name
      optional

      String

      start
      optional

      String

      end
      optional

      String

      GetKeyspaceRawDocid200ResponseSyncChannelSetInner

      Name Description Schema

      name
      optional

      The name of the channel.

      String

      start
      optional

      The sequence number that document was added to the channel.

      String

      end
      optional

      The sequence number the document was removed from the channel. Omitted if not removed.

      String

      GetKeyspaceRawDocid200ResponseSyncHistory

      Name Description Schema

      revs
      optional

      The past revision IDs.

      String List

      parents
      optional

      BigDecimal List

      channels
      optional

      The past channel history. Can contain string arrays, strings, or be null depending on if and how the channels where set.

      List List

      GetSgcollectInfo200Response

      Name Description Schema

      status
      required

      The status of sgcollect_info.

      Values: stopped, running

      String

      GetStats200Response

      Name Description Schema

      memstats
      optional

      A set of Go runtime memory statistics.

      oas_any_type_not_mapped Map

      HTTP-Error

      Name Description Schema

      error
      required

      The error name.

      String

      reason
      required

      The error description.

      String

      Log-rotation-config

      Name Description Schema

      max_size
      optional

      The maximum size in MB of the log file before it gets rotated.

      Default: 100

      Integer

      localtime
      optional

      If true, it uses the computer’s local time to format the backup timestamp.

      Default: false

      Boolean

      rotated_logs_size_limit
      optional

      Max Size (in mb) of log files before deletion

      Default: 1024

      Integer

      rotation_interval
      optional

      If set, the interval at which log files are rotated, even if max_size is not reached.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      Default: 0

      String

      max_age
      optional

      The maximum number of days to retain old log files. By default, there is no rotation, max_age=0.

      Default: 0

      Integer

      LoggingConfig

      Name Description Schema

      log_file_path
      optional

      Absolute or relative path on the filesystem to the log file directory. A relative path is from the directory that contains the Sync Gateway executable file.

      String

      redaction_level
      optional

      Redaction level to apply to log output.

      Values: none, partial, full, unset
      Default: partial

      String

      console
      optional

      Console_logging_config

      error
      optional

      Error logging configuration.

      Startup_config_logging_error

      warn
      optional

      Warning logging configuration.

      Startup_config_logging_warn

      info
      optional

      Info logging configuration.

      Startup_config_logging_info

      debug
      optional

      Debug logging configuration.

      Startup_config_logging_debug

      trace
      optional

      Trace logging configuration.

      Startup_config_logging_trace

      stats
      optional

      Trace logging configuration.

      Startup_config_logging_stats

      New-revision

      Name Description Schema

      id
      required

      The ID of the document.

      String

      ok
      required

      Whether the request completed successfully.

      Boolean

      rev
      required

      The revision of the document.

      String

      NodeInfo

      Name Description Schema

      ADMIN
      optional

      true if the request is from the Admin API - otherwise omitted.

      Example: true

      Boolean

      couchdb
      required

      CouchDB welcome

      Example: Welcome

      String

      vendor
      required

      Product vendor

      get___200_response_vendor

      version
      optional

      Product version, including the build number and edition (i.e. EE or CE) Omitted if api.hide_product_version=true

      Example: Couchbase Sync Gateway/3.1.0(1;a765231) EE

      String

      persistent_config
      optional

      Indication for whether sync gateway is running in persistent config mode or legacy config mode. true if the sync gateway node is running in persistent config mode.

      Example: true

      Boolean

      OpenID Connect callback properties

      Name Description Schema

      id_token
      optional

      The OpenID Connect ID token

      String

      refresh_token
      optional

      The OpenID Connect ID refresh token

      String

      session_id
      optional

      The Sync Gateway session token

      String

      name
      optional

      The Sync Gateway user

      String

      access_token
      optional

      The OpenID Connect access token

      String

      token_type
      optional

      The OpenID Connect ID token type

      String

      expires_in
      optional

      The time until the id_token expires (TTL).

      BigDecimal

      OIDCLoginPageHandler

      Name Description Schema

      username
      required

      String

      tokenttl
      required

      String

      identity-token-formats
      required

      String

      authenticated
      required

      String

      OIDC-token

      Name Description Schema

      access_token
      optional

      String

      token_type
      optional

      String

      refresh_token
      optional

      String

      expires_in
      optional

      String

      id_token
      optional

      String

      OpenID Connect callback properties

      Name Description Schema

      id_token
      optional

      The OpenID Connect ID token

      String

      refresh_token
      optional

      The OpenID Connect ID refresh token

      String

      session_id
      optional

      The Sync Gateway session token

      String

      name
      optional

      The Sync Gateway user

      String

      access_token
      optional

      The OpenID Connect access token

      String

      token_type
      optional

      The OpenID Connect ID token type

      String

      expires_in
      optional

      The time until the id_token expires (TTL).

      BigDecimal

      PostDbEnsureFullCommit201Response

      Name Description Schema

      instance_start_time
      optional

      Timestamp of when the database opened, in microseconds since the Unix epoch.

      Example: 1644600082279583

      Integer

      ok
      optional

      Default: true
      Example: true

      Boolean

      PostDbFacebook401Response

      Name Description Schema

      error
      optional

      String

      reason
      optional

      String

      PostDbFacebookRequest

      Name Description Schema

      access_token
      required

      Facebook access token to base the new session on.

      String

      PostDbGoogleRequest

      Name Description Schema

      id_token
      required

      Google ID token to base the new session on.

      String

      PostDbOidcTestingAuthenticateRequest

      Name Description Schema

      username
      required

      String

      tokenttl
      required

      String

      identity-token-formats
      required

      String

      authenticated
      required

      String

      PostDbOidcTestingTokenRequest

      Name Description Schema

      grant_type
      required

      The grant type of the token to request. Can either be an authorization_code or refresh_token.

      String

      code
      optional

      grant_type=authorization_code only: The OpenID Connect authentication token.

      String

      refresh_token
      optional

      grant_type=refresh_token only: The OpenID Connect refresh token.

      String

      PostDbOnlineRequest

      Name Description Schema

      delay
      optional

      The amount of seconds to delay bringing the database online.

      Default: 0

      Integer

      PostDbResyncRequest

      Name Description Schema

      scopes
      optional

      This controls for which collections resync will run

      Example: {"scopeName":{"collection1":null,"collection2":null}}

      List Map

      regenerate_sequences
      optional

      This can be used as an alternative to query param regenerate_sequences. If either query param or this is set to true, then the request will regenerate the sequence numbers for each document processed.

      Default: false

      Boolean

      PostDbSession200Response

      Name Description Schema

      session_id
      optional

      The ID of the session. This is the value that would be put in to the cookie to keep the user authenticated.

      String

      expires
      optional

      The date and time the cookie expires.

      String

      cookie_name
      optional

      The name of the cookie that would be used to store the users session.

      String

      PostDbSessionRequest

      Name Description Schema

      name
      optional

      User name to generate the session for.

      String

      ttl
      optional

      Time until the session expires. Uses default value of 24 hours if left blank.

      Integer

      PostKeyspaceAllDocsRequest

      Name Description Schema

      keys
      required

      List of the documents to retrieve.

      String List

      PostKeyspaceBulkDocs201ResponseInner

      Name Description Schema

      id
      required

      The ID of the document that the operation was performed on.

      String

      rev
      optional

      The new revision of the document if the operation was a success.

      String

      error
      optional

      The error type if the operation of the document failed.

      String

      reason
      optional

      The reason the operation failed.

      String

      status
      optional

      The HTTP status code for why the operation failed.

      Integer

      PostKeyspaceBulkDocsRequest

      Name Description Schema

      new_edits
      optional

      This controls whether to assign new revision identifiers to new edits (true) or use the existing ones (false).

      Default: true

      Boolean

      docs
      required

      post_keyspace__request List

      PostKeyspaceBulkGetRequest

      Name Description Schema

      docs
      required

      post_keyspace__bulk_get_request_docs_inner List

      PostKeyspaceBulkGetRequestDocsInner

      Name Description Schema

      id
      required

      ID of the document to retrieve.

      String

      PostKeyspaceChangesRequest

      Name Description Schema

      limit
      optional

      Maximum number of changes to return.

      String

      style
      optional

      Controls whether to return the current winning revision (main_only) or all the leaf revision including conflicts and deleted former conflicts (all_docs).

      String

      active_only
      optional

      Set true to exclude deleted documents and notifications for documents the user no longer has access to from the changes feed.

      String

      include_docs
      optional

      Include the body associated with each document.

      String

      revocations
      optional

      If true, revocation messages will be sent on the changes feed.

      String

      filter
      optional

      Set a filter to either filter by channels or document IDs.

      String

      channels
      optional

      A comma-separated list of channel names to filter the response to only the channels specified. To use this option, the filter query option must be set to sync_gateway/bychannels.

      String

      doc_ids
      optional

      A valid JSON array of document IDs to filter the documents in the response to only the documents specified. To use this option, the filter query option must be set to _doc_ids and the feed parameter must be normal.

      String

      heartbeat
      optional

      The interval (in milliseconds) to send an empty line (CRLF) in the response. This is to help prevent gateways from deciding the socket is idle and therefore closing it. This is only applicable to feed=longpoll or feed=continuous. This will override any timeouts to keep the feed alive indefinitely. Setting to 0 results in no heartbeat. The maximum heartbeat can be set in the server replication configuration.

      String

      timeout
      optional

      This is the maximum period (in milliseconds) to wait for a change before the response is sent, even if there are no results. This is only applicable for feed=longpoll or feed=continuous changes feeds. Setting to 0 results in no timeout.

      String

      feed
      optional

      The type of changes feed to use.

      String

      request_plus
      optional

      When true, ensures all valid documents written prior to the request being issued are included in the response. This is only applicable for non-continuous feeds.

      String

      PostKeyspacePurge200Response

      Name Description Schema

      purged
      required

      Values:

      List Map

      PostKeyspacePurgeRequest

      Name Description Schema

      doc_id
      optional

      The document ID to purge. The array must only be 1 element which is *.

      All revisions will be permanently removed for that document.

      Values:

      String List

      PostKeyspaceRequest

      Name Description Schema

      _id
      optional

      The ID of the document.

      String

      _rev
      optional

      The revision of the document.

      String

      _exp
      optional

      Expiry time after which the document will be purged. The expiration time is set and managed on the Couchbase Server document. The value can be specified in two ways; in ISO-8601 format, for example the 6th of July 2022 at 17:00 in the BST timezone would be 2016-07-06T17:00:00+01:00; it can also be specified as a numeric Couchbase Server expiry value. Couchbase Server expiry values are specified as Unix time, and if the desired TTL is below 30 days then it can also represent an interval in seconds from the current time (for example, a value of 5 will remove the document 5 seconds after it is written to Couchbase Server). The document expiration time is returned in the response of GET /{db}/{doc} ` when `show_exp=true is included in the query.

      As with the existing explicit purge mechanism, this applies only to the local database; it has nothing to do with replication. This expiration time is not propagated when the document is replicated. The purge of the document does not cause it to be deleted on any other database.

      String

      _deleted
      optional

      Whether the document is a tombstone or not. If true, it is a tombstone.

      Boolean

      _revisions
      optional

      post_keyspace__request__revisions

      _attachments
      optional

      post_keyspace__request__attachments_value Map

      PostKeyspaceRequestAttachmentsValue

      Name Description Schema

      content_type
      optional

      Content type of the attachment.

      String

      data
      optional

      The data in the attachment in base64.

      String

      PostKeyspaceRequestRevisions

      Name Description Schema

      start
      optional

      Prefix number for the latest revision.

      BigDecimal

      ids
      optional

      Array of valid revision IDs, in reverse order (latest first).

      String List

      PostKeyspaceRevsDiff200Response

      Name Description Schema

      docid
      optional

      The document ID.

      post_keyspace__revs_diff_200_response_docid

      PostKeyspaceRevsDiff200ResponseDocid

      Name Description Schema

      missing
      optional

      The revisions that are not in the database (and therefore missing).

      String List

      possible_ancestors
      optional

      An array of known revisions that might be the recent ancestors.

      String List

      PostKeyspaceRevsDiffRequest

      Name Description Schema

      docid
      optional

      The document ID with an array of revisions to use for the comparison.

      String List

      PostPostUpgrade200Response

      Name Description Schema

      post_upgrade_results
      required

      A map of databases.

      post__post_upgrade_200_response_post_upgrade_results_value Map

      preview
      optional

      If set, nothing in the database was changed as this was a dry-run. This can be controlled by the preview query parameter in the request.

      Boolean

      PostPostUpgrade200ResponsePostUpgradeResultsValue

      Name Description Schema

      removed_design_docs
      required

      The design documents that have or will be removed.

      String List

      removed_indexes
      required

      The indexes that have or will be removed.

      String List

      PostProfileProfilenameRequest

      Name Description Schema

      file
      optional

      This is the file to output the pprof profile at.

      String

      PostSgcollectInfo200Response

      Name Description Schema

      status
      optional

      The new sgcollect_info status.

      Default: started

      String

      PostSgcollectInfoRequest

      Name Description Schema

      redact_level
      optional

      The redaction level to use for redacting the collected logs.

      Values: partial, none
      Default: partial

      String

      redact_salt
      optional

      The salt to use for the log redactions.

      String

      output_dir
      optional

      The directory to output the collected logs zip file at.

      This overrides the configured default output directory configured in the startup config logging.log_file_path.

      Default: The configured path set in the startup config `logging.log_file_path`

      String

      upload
      optional

      If set, upload the logs to Couchbase Support.

      A customer name must be set if this is set.

      Boolean

      upload_host
      optional

      The host to send the logs too.

      String

      upload_proxy
      optional

      The proxy to use while uploading the logs.

      String

      customer
      optional

      The customer name to use when uploading the logs.

      String

      ticket
      optional

      The Zendesk ticket number to use when uploading logs.

      String

      PutKeyspaceLocalDocidRequest

      Name Description Schema

      _rev
      optional

      Revision to replace. Required if updating existing local document.

      Example: 2-5145e1086bb8d1d71a531e9f6b543c58

      String

      User configurable replication properties

      Name Description Schema

      replication_id
      optional

      This is the ID of the replication.

      When creating a new replication using a POST request, this will be set to a random UUID if not explicitly set.

      When the replication ID is specified in the URL, this must be set to the same replication ID if specifying it at all.

      String

      remote
      optional

      This is the endpoint of the database for the remote Sync Gateway that is the subject of this replication’s push, pull, or pushAndPull action.

      Typically this would include the URI, port, and database name. For example, http://localhost:4985/db.

      How this remote is used depends on the direction of the replication: * pull - this replicator pulls changes from the remote * push - this replicator pushes changes to this remote * pushAndPull - this replicator pushes changes to this remote, while also pulling receiving changes

      String

      username
      optional

      This has been deprecated in favour of remote_username.

      This is the username to use to authenticate with the remote.

      This can only be used for a pull replication.

      String

      password
      optional

      This has been deprecated in favour of remote_password.

      This is the password to use to authenticate with the remote.

      This password will be redacted in the replication config.

      This can only be used for a pull replication.

      String

      remote_username
      optional

      The username to use to authenticate with the remote.

      This can only be used for a pull replication.

      String

      remote_password
      optional

      The password to use to authenticate with the remote.

      This password will be redacted in the replication config.

      This can only be used for a pull replication.

      String

      direction
      required

      This specifies which direction the replication will be replicating with the remote replicator.

      The directions are: * pull - changes are pulled from the remote database * push - changes are pushed to the remote database * pushAndPull - changes are both push-to and pulled-from the remote database

      Replications created prior to Sync Gateway 2.8 derive their direction from the source/target URL of the replication.

      Values: push, pull, pushAndPull

      String

      conflict_resolution_type
      optional

      This defines what conflict resolution policy Sync Gateway should use to apply when resolving conflicting revisions.

      Changing this is an enterprise-edition only feature.

      Behaviour * default - In priority order, this will cause - Deletes to always win (the delete with the longest revision history wins if both revisions are deletes) - The revision with the longest revision history to win. This means the the revision with the most changes and therefore the highest revision ID will win. * localWins - This will result in local revisions always being the winner in any conflict. * remoteWins - This will result in remote revisions always being the winner in any conflict. * custom - This will result in conflicts going through your own custom conflict resolver. You must provide this logic as a Javascript function in the custom_conflict_resolver parameter. This is an enterprise-edition only feature.

      Note: replications created prior to Sync Gateway 2.8 will default to default.

      Values: default, remoteWins, localWins, custom
      Default: default

      String

      custom_conflict_resolver
      optional

      This specifies the Javascript function to use to resolve conflicts between conflicting revisions.

      This must be used when conflict_resolution_type=custom. This property will be ignored when conflict_resolution_type is not custom.

      The Javascript function to provide this property should be in backticks (like the sync function). The function takes 1 parameter which is a struct that represents the conflict. This struct has 2 properties: * LocalDocument - The local document. This contains the document ID under the _id key. * RemoteDocument - The remote document The function should return the new documents body. This can be the winning revision (for example, return conflict.LocalDocument), a new body, or nil to resolve as a delete.

      Example:

      "custom_conflict_resolver":\`
      	function(conflict) {
      		console.log("Doc ID: "+conflict.LocalDocument._id);
      		console.log("Full remote doc: "+JSON.stringify(conflict.RemoteDocument));
      		return conflict.RemoteDocument;
      	}
      \`

      Using complex custom_conflict_resolver functions can noticeably degrade performance. Use a built-in resolver whenever possible.

      This is an enterprise-edition only feature.

      Default: none

      String

      purge_on_removal
      optional

      Specifies whether to purge a document if the remote user loses access to all of the channels on the document when attempting to pull it from the remote.

      If false, documents will not be replicated and not be purged when the user loses access.

      Default: false

      Boolean

      enable_delta_sync
      optional

      This will turn on delta- sync for the replication. This works in conjunction with the database level setting delta_sync.enabled

      If set to true, delta-sync will be used as long as both databases involved in the replication have delta-sync enabled. If a database does not have delta-sync enabled, then the replication will run without delta-sync.

      Replications created prior to Sync Gateway 2.8 must have delta-sync disabled.

      Enabling this is an enterprise-edition only feature.

      Default: false

      Boolean

      max_backoff_time
      optional

      Specifies the maximum time-period (in minutes) that Sync Gateway will attempt to reconnect to a lost or unreachable remote.

      When a disconnection happens, Sync Gateway will do an exponential backoff up to this specified value. When this value is met, it will attempt to reconnect indefinitely every max_backoff_time minutes.

      If this is set to 0, Sync Gateway will do the normal exponential backoff after the disconnect happens but then attempting 10 minutes and stop the replication.

      Note: this defaults to 5 minutes for replications created prior to Sync Gateway 2.8.

      Default: 5

      Integer

      initial_state
      optional

      This is what state to start the replication in when creating a new replication.

      This allows you to control if the replication starts in a stopped start or running state.

      Replications prior to Sync Gateway 2.8 will run in the default state running.

      Values: running, stopped
      Default: running

      String

      continuous
      optional

      If true, changes will be immediately synced when they happen. This is known as a continuous replication.

      If false, all changes will be synced until they have been processed. The replication will then cease and not process any future changes (unless started again by the user). This is known as a one-shot replication.

      Default: false

      Boolean

      filter
      optional

      This defines whether to filter documents by their channels or not.

      If set to sync_gateway/bychannel then a pull replication will be limited to a specific set of channels specified by the query_params.channels property.

      This only can be used with pull replications.

      Values: sync_gateway/bychannel

      String

      query_params
      optional

      This is a set of key/value pairs used in the query string of the replication.

      If filters=sync_gateway/bychannel then this can be used to set the channels to filter by in a pull replication. To do this, set the channels key to a string array of the channels to filter by. For example:

      "filter":"sync_gateway/bychannel",
      "query_params": {
        "channels":["chanUser1"]
      },

      String List

      adhoc
      optional

      Set to true to run the replication as an adhoc replication instead of a persistent one.

      This means that the replication will only last the period of the replication until the status is changed to stopped and then it will be removed automatically. It will also be removed if Sync Gateway restarts or if removed due to user action.

      Default: false

      Boolean

      batch_size
      optional

      The amount of changes to be sent in one batch of replications. Changing this is an enterprise-edition only feature.

      Default: 200

      Integer

      run_as
      optional

      This is used if you want to specify a user to run the replication as. This means that the replication will only be able to replicate what the user access to what the user has access to.

      String

      collections_enabled
      optional

      If true, the replicator will run with collections, and will replicate all collections, unless otherwise limited by keyspace_map.

      If false, the replicator will only replicate the default collection.

      Default: false

      Boolean

      collections_local
      optional

      Limits the set of collections replicated to those listed in this array.

      The replication will use all collections defined on the database if this list is empty.

      Default: []
      Example: ["scope1.collection1","scope1.collection3","scope1.collection6"]

      String List

      collections_remote
      optional

      Remaps the local collection name to the one specified in this array when replicating with the remote.

      If only a subset of collections need remapping, elements in this array can be specified as null to preserve the local collection name.

      The same index is used for both collections_remote and collections_local, and both arrays must be the same length.

      Default: []
      Example: ["scope1.collectionA",null,"scope1.collectionF"]

      String List

      Replication

      Name Description Schema

      replication_id
      optional

      This is the ID of the replication.

      When creating a new replication using a POST request, this will be set to a random UUID if not explicitly set.

      When the replication ID is specified in the URL, this must be set to the same replication ID if specifying it at all.

      String

      remote
      optional

      This is the endpoint of the database for the remote Sync Gateway that is the subject of this replication’s push, pull, or pushAndPull action.

      Typically this would include the URI, port, and database name. For example, http://localhost:4985/db.

      How this remote is used depends on the direction of the replication: * pull - this replicator pulls changes from the remote * push - this replicator pushes changes to this remote * pushAndPull - this replicator pushes changes to this remote, while also pulling receiving changes

      String

      username
      optional

      This has been deprecated in favour of remote_username.

      This is the username to use to authenticate with the remote.

      This can only be used for a pull replication.

      String

      password
      optional

      This has been deprecated in favour of remote_password.

      This is the password to use to authenticate with the remote.

      This password will be redacted in the replication config.

      This can only be used for a pull replication.

      String

      remote_username
      optional

      The username to use to authenticate with the remote.

      This can only be used for a pull replication.

      String

      remote_password
      optional

      The password to use to authenticate with the remote.

      This password will be redacted in the replication config.

      This can only be used for a pull replication.

      String

      direction
      optional

      This specifies which direction the replication will be replicating with the remote replicator.

      The directions are: * pull - changes are pulled from the remote database * push - changes are pushed to the remote database * pushAndPull - changes are both push-to and pulled-from the remote database

      Replications created prior to Sync Gateway 2.8 derive their direction from the source/target URL of the replication.

      Values: push, pull, pushAndPull

      String

      conflict_resolution_type
      optional

      This defines what conflict resolution policy Sync Gateway should use to apply when resolving conflicting revisions.

      Changing this is an enterprise-edition only feature.

      Behaviour * default - In priority order, this will cause - Deletes to always win (the delete with the longest revision history wins if both revisions are deletes) - The revision with the longest revision history to win. This means the the revision with the most changes and therefore the highest revision ID will win. * localWins - This will result in local revisions always being the winner in any conflict. * remoteWins - This will result in remote revisions always being the winner in any conflict. * custom - This will result in conflicts going through your own custom conflict resolver. You must provide this logic as a Javascript function in the custom_conflict_resolver parameter. This is an enterprise-edition only feature.

      Note: replications created prior to Sync Gateway 2.8 will default to default.

      Values: default, remoteWins, localWins, custom
      Default: default

      String

      custom_conflict_resolver
      optional

      This specifies the Javascript function to use to resolve conflicts between conflicting revisions.

      This must be used when conflict_resolution_type=custom. This property will be ignored when conflict_resolution_type is not custom.

      The Javascript function to provide this property should be in backticks (like the sync function). The function takes 1 parameter which is a struct that represents the conflict. This struct has 2 properties: * LocalDocument - The local document. This contains the document ID under the _id key. * RemoteDocument - The remote document The function should return the new documents body. This can be the winning revision (for example, return conflict.LocalDocument), a new body, or nil to resolve as a delete.

      Example:

      "custom_conflict_resolver":\`
      	function(conflict) {
      		console.log("Doc ID: "+conflict.LocalDocument._id);
      		console.log("Full remote doc: "+JSON.stringify(conflict.RemoteDocument));
      		return conflict.RemoteDocument;
      	}
      \`

      Using complex custom_conflict_resolver functions can noticeably degrade performance. Use a built-in resolver whenever possible.

      This is an enterprise-edition only feature.

      Default: none

      String

      purge_on_removal
      optional

      Specifies whether to purge a document if the remote user loses access to all of the channels on the document when attempting to pull it from the remote.

      If false, documents will not be replicated and not be purged when the user loses access.

      Default: false

      Boolean

      enable_delta_sync
      optional

      This will turn on delta- sync for the replication. This works in conjunction with the database level setting delta_sync.enabled

      If set to true, delta-sync will be used as long as both databases involved in the replication have delta-sync enabled. If a database does not have delta-sync enabled, then the replication will run without delta-sync.

      Replications created prior to Sync Gateway 2.8 must have delta-sync disabled.

      Enabling this is an enterprise-edition only feature.

      Default: false

      Boolean

      max_backoff_time
      optional

      Specifies the maximum time-period (in minutes) that Sync Gateway will attempt to reconnect to a lost or unreachable remote.

      When a disconnection happens, Sync Gateway will do an exponential backoff up to this specified value. When this value is met, it will attempt to reconnect indefinitely every max_backoff_time minutes.

      If this is set to 0, Sync Gateway will do the normal exponential backoff after the disconnect happens but then attempting 10 minutes and stop the replication.

      Note: this defaults to 5 minutes for replications created prior to Sync Gateway 2.8.

      Default: 5

      Integer

      initial_state
      optional

      This is what state to start the replication in when creating a new replication.

      This allows you to control if the replication starts in a stopped start or running state.

      Replications prior to Sync Gateway 2.8 will run in the default state running.

      Values: running, stopped
      Default: running

      String

      continuous
      optional

      If true, changes will be immediately synced when they happen. This is known as a continuous replication.

      If false, all changes will be synced until they have been processed. The replication will then cease and not process any future changes (unless started again by the user). This is known as a one-shot replication.

      Default: false

      Boolean

      filter
      optional

      This defines whether to filter documents by their channels or not.

      If set to sync_gateway/bychannel then a pull replication will be limited to a specific set of channels specified by the query_params.channels property.

      This only can be used with pull replications.

      Values: sync_gateway/bychannel

      String

      query_params
      optional

      This is a set of key/value pairs used in the query string of the replication.

      If filters=sync_gateway/bychannel then this can be used to set the channels to filter by in a pull replication. To do this, set the channels key to a string array of the channels to filter by. For example:

      "filter":"sync_gateway/bychannel",
      "query_params": {
        "channels":["chanUser1"]
      },

      String List

      adhoc
      optional

      Set to true to run the replication as an adhoc replication instead of a persistent one.

      This means that the replication will only last the period of the replication until the status is changed to stopped and then it will be removed automatically. It will also be removed if Sync Gateway restarts or if removed due to user action.

      Default: false

      Boolean

      batch_size
      optional

      The amount of changes to be sent in one batch of replications. Changing this is an enterprise-edition only feature.

      Default: 200

      Integer

      run_as
      optional

      This is used if you want to specify a user to run the replication as. This means that the replication will only be able to replicate what the user access to what the user has access to.

      String

      collections_enabled
      optional

      If true, the replicator will run with collections, and will replicate all collections, unless otherwise limited by keyspace_map.

      If false, the replicator will only replicate the default collection.

      Default: false

      Boolean

      collections_local
      optional

      Limits the set of collections replicated to those listed in this array.

      The replication will use all collections defined on the database if this list is empty.

      Default: []
      Example: ["scope1.collection1","scope1.collection3","scope1.collection6"]

      String List

      collections_remote
      optional

      Remaps the local collection name to the one specified in this array when replicating with the remote.

      If only a subset of collections need remapping, elements in this array can be specified as null to preserve the local collection name.

      The same index is used for both collections_remote and collections_local, and both arrays must be the same length.

      Default: []
      Example: ["scope1.collectionA",null,"scope1.collectionF"]

      String List

      assigned_node
      optional

      The unique ID of the node assigned to the replication.

      String

      target_state
      optional

      This is the state that the replicator is in or that trying to transition in to.

      Values: running, stopped, resetting, error, starting, reconnecting

      String

      Replication-status

      Name Description Schema

      replication_id
      required

      The ID of the replication.

      String

      config
      optional

      Properties of a replication

      User_configurable_replication_properties

      status
      optional

      The status of the replication.

      Values: stopped, running, reconnecting, resetting, error, starting

      String

      error_message
      optional

      The error message of the replication if an error has occurred.

      String

      docs_read
      optional

      The number of documents that have been read (fetched) from the source database.

      Integer

      docs_checked_pull
      optional

      Integer

      docs_purged
      optional

      The number of documents that have been purged.

      Integer

      rejected_by_local
      optional

      The number of documents that were received by the local but did not get replicated due to getting rejected by the sync function on the local.

      Integer

      last_seq_pull
      optional

      The last changes sequence number that was pulled from the remote.

      String

      deltas_recv
      optional

      The number of deltas that have been received from the remote.

      Integer

      deltas_requested
      optional

      Integer

      docs_written
      optional

      The number of documents that have been wrote (pushed) to the target database.

      Integer

      docs_checked_push
      optional

      Integer

      docs_write_failures
      optional

      The number of documents that have failed to be wrote (pushed) to the target database. There will be no attempt to try to push these docs again.

      Integer

      docs_write_conflicts
      optional

      The number of documents that had a conflict.

      Integer

      rejected_by_remote
      optional

      The number of documents that were received by the remote but did not get replicated due to getting rejected by the sync function on the remote.

      Integer

      last_seq_push
      optional

      The last changes sequence number that was pushed to the remote.

      String

      deltas_sent
      optional

      The number of deltas that have been sent to the remote.

      Integer

      Resync-status

      Name Description Schema

      status
      required

      The status of the current operation.

      Values: running, completed, stopping, stopped, error

      String

      start_time
      required

      The ISO-8601 date and time the resync operation was started.

      String

      last_error
      required

      The last error that occurred in the resync operation (if any).

      String

      docs_changed
      required

      The amount of documents that have been changed as a result of the resync operation.

      Integer

      docs_processed
      required

      The amount of docs that have been processed so far in the resync operation.

      Integer

      collections_processing
      optional

      The collections that the resync operation is running on.

      Example: {"scopeName":{"collection1":null,"collection2":null}}

      List Map

      Replication

      Name Description Schema

      replication_id
      optional

      This is the ID of the replication.

      When creating a new replication using a POST request, this will be set to a random UUID if not explicitly set.

      When the replication ID is specified in the URL, this must be set to the same replication ID if specifying it at all.

      String

      remote
      optional

      This is the endpoint of the database for the remote Sync Gateway that is the subject of this replication’s push, pull, or pushAndPull action.

      Typically this would include the URI, port, and database name. For example, http://localhost:4985/db.

      How this remote is used depends on the direction of the replication: * pull - this replicator pulls changes from the remote * push - this replicator pushes changes to this remote * pushAndPull - this replicator pushes changes to this remote, while also pulling receiving changes

      String

      username
      optional

      This has been deprecated in favour of remote_username.

      This is the username to use to authenticate with the remote.

      This can only be used for a pull replication.

      String

      password
      optional

      This has been deprecated in favour of remote_password.

      This is the password to use to authenticate with the remote.

      This password will be redacted in the replication config.

      This can only be used for a pull replication.

      String

      remote_username
      optional

      The username to use to authenticate with the remote.

      This can only be used for a pull replication.

      String

      remote_password
      optional

      The password to use to authenticate with the remote.

      This password will be redacted in the replication config.

      This can only be used for a pull replication.

      String

      direction
      optional

      This specifies which direction the replication will be replicating with the remote replicator.

      The directions are: * pull - changes are pulled from the remote database * push - changes are pushed to the remote database * pushAndPull - changes are both push-to and pulled-from the remote database

      Replications created prior to Sync Gateway 2.8 derive their direction from the source/target URL of the replication.

      Values: push, pull, pushAndPull

      String

      conflict_resolution_type
      optional

      This defines what conflict resolution policy Sync Gateway should use to apply when resolving conflicting revisions.

      Changing this is an enterprise-edition only feature.

      Behaviour * default - In priority order, this will cause - Deletes to always win (the delete with the longest revision history wins if both revisions are deletes) - The revision with the longest revision history to win. This means the the revision with the most changes and therefore the highest revision ID will win. * localWins - This will result in local revisions always being the winner in any conflict. * remoteWins - This will result in remote revisions always being the winner in any conflict. * custom - This will result in conflicts going through your own custom conflict resolver. You must provide this logic as a Javascript function in the custom_conflict_resolver parameter. This is an enterprise-edition only feature.

      Note: replications created prior to Sync Gateway 2.8 will default to default.

      Values: default, remoteWins, localWins, custom
      Default: default

      String

      custom_conflict_resolver
      optional

      This specifies the Javascript function to use to resolve conflicts between conflicting revisions.

      This must be used when conflict_resolution_type=custom. This property will be ignored when conflict_resolution_type is not custom.

      The Javascript function to provide this property should be in backticks (like the sync function). The function takes 1 parameter which is a struct that represents the conflict. This struct has 2 properties: * LocalDocument - The local document. This contains the document ID under the _id key. * RemoteDocument - The remote document The function should return the new documents body. This can be the winning revision (for example, return conflict.LocalDocument), a new body, or nil to resolve as a delete.

      Example:

      "custom_conflict_resolver":\`
      	function(conflict) {
      		console.log("Doc ID: "+conflict.LocalDocument._id);
      		console.log("Full remote doc: "+JSON.stringify(conflict.RemoteDocument));
      		return conflict.RemoteDocument;
      	}
      \`

      Using complex custom_conflict_resolver functions can noticeably degrade performance. Use a built-in resolver whenever possible.

      This is an enterprise-edition only feature.

      Default: none

      String

      purge_on_removal
      optional

      Specifies whether to purge a document if the remote user loses access to all of the channels on the document when attempting to pull it from the remote.

      If false, documents will not be replicated and not be purged when the user loses access.

      Default: false

      Boolean

      enable_delta_sync
      optional

      This will turn on delta- sync for the replication. This works in conjunction with the database level setting delta_sync.enabled

      If set to true, delta-sync will be used as long as both databases involved in the replication have delta-sync enabled. If a database does not have delta-sync enabled, then the replication will run without delta-sync.

      Replications created prior to Sync Gateway 2.8 must have delta-sync disabled.

      Enabling this is an enterprise-edition only feature.

      Default: false

      Boolean

      max_backoff_time
      optional

      Specifies the maximum time-period (in minutes) that Sync Gateway will attempt to reconnect to a lost or unreachable remote.

      When a disconnection happens, Sync Gateway will do an exponential backoff up to this specified value. When this value is met, it will attempt to reconnect indefinitely every max_backoff_time minutes.

      If this is set to 0, Sync Gateway will do the normal exponential backoff after the disconnect happens but then attempting 10 minutes and stop the replication.

      Note: this defaults to 5 minutes for replications created prior to Sync Gateway 2.8.

      Default: 5

      Integer

      initial_state
      optional

      This is what state to start the replication in when creating a new replication.

      This allows you to control if the replication starts in a stopped start or running state.

      Replications prior to Sync Gateway 2.8 will run in the default state running.

      Values: running, stopped
      Default: running

      String

      continuous
      optional

      If true, changes will be immediately synced when they happen. This is known as a continuous replication.

      If false, all changes will be synced until they have been processed. The replication will then cease and not process any future changes (unless started again by the user). This is known as a one-shot replication.

      Default: false

      Boolean

      filter
      optional

      This defines whether to filter documents by their channels or not.

      If set to sync_gateway/bychannel then a pull replication will be limited to a specific set of channels specified by the query_params.channels property.

      This only can be used with pull replications.

      Values: sync_gateway/bychannel

      String

      query_params
      optional

      This is a set of key/value pairs used in the query string of the replication.

      If filters=sync_gateway/bychannel then this can be used to set the channels to filter by in a pull replication. To do this, set the channels key to a string array of the channels to filter by. For example:

      "filter":"sync_gateway/bychannel",
      "query_params": {
        "channels":["chanUser1"]
      },

      String List

      adhoc
      optional

      Set to true to run the replication as an adhoc replication instead of a persistent one.

      This means that the replication will only last the period of the replication until the status is changed to stopped and then it will be removed automatically. It will also be removed if Sync Gateway restarts or if removed due to user action.

      Default: false

      Boolean

      batch_size
      optional

      The amount of changes to be sent in one batch of replications. Changing this is an enterprise-edition only feature.

      Default: 200

      Integer

      run_as
      optional

      This is used if you want to specify a user to run the replication as. This means that the replication will only be able to replicate what the user access to what the user has access to.

      String

      collections_enabled
      optional

      If true, the replicator will run with collections, and will replicate all collections, unless otherwise limited by keyspace_map.

      If false, the replicator will only replicate the default collection.

      Default: false

      Boolean

      collections_local
      optional

      Limits the set of collections replicated to those listed in this array.

      The replication will use all collections defined on the database if this list is empty.

      Default: []
      Example: ["scope1.collection1","scope1.collection3","scope1.collection6"]

      String List

      collections_remote
      optional

      Remaps the local collection name to the one specified in this array when replicating with the remote.

      If only a subset of collections need remapping, elements in this array can be specified as null to preserve the local collection name.

      The same index is used for both collections_remote and collections_local, and both arrays must be the same length.

      Default: []
      Example: ["scope1.collectionA",null,"scope1.collectionF"]

      String List

      assigned_node
      optional

      The unique ID of the node assigned to the replication.

      String

      target_state
      optional

      This is the state that the replicator is in or that trying to transition in to.

      Values: running, stopped, resetting, error, starting, reconnecting

      String

      Role

      Name Description Schema

      name
      optional

      The name of the role.

      Role names can only have alphanumeric ASCII characters and underscores.

      String

      admin_channels
      optional

      The channels that users in the role are able to access for the default collection.

      String List

      all_channels
      optional

      The channels that the role grants access to for the default collection.

      These channels could have been assigned by the Sync function or using the admin_channels property.

      String List

      collection_access
      optional

      A set of access grants by scope and collection.

      Map Map

      Role

      Name Description Schema

      name
      optional

      The name of the role.

      Role names can only have alphanumeric ASCII characters and underscores.

      String

      admin_channels
      optional

      The channels that users in the role are able to access for the default collection.

      String List

      all_channels
      optional

      The channels that the role grants access to for the default collection.

      These channels could have been assigned by the Sync function or using the admin_channels property.

      String List

      collection_access
      optional

      A set of access grants by scope and collection.

      Map Map

      Role

      Name Description Schema

      name
      optional

      The name of the role.

      Role names can only have alphanumeric ASCII characters and underscores.

      String

      admin_channels
      optional

      The channels that users in the role are able to access for the default collection.

      String List

      all_channels
      optional

      The channels that the role grants access to for the default collection.

      These channels could have been assigned by the Sync function or using the admin_channels property.

      String List

      collection_access
      optional

      A set of access grants by scope and collection.

      Map Map

      Runtime-config

      Name Description Schema

      logging
      optional

      Runtime_config_logging

      max_concurrent_replications
      optional

      Maximum number of concurrent replication connections allowed. If set to 0 this limit will be ignored.

      Default: 0

      Integer

      RuntimeConfigLogging

      Name Description Schema

      log_file_path
      optional

      Absolute or relative path on the filesystem to the log file directory. A relative path is from the directory that contains the Sync Gateway executable file.

      String

      redaction_level
      optional

      Redaction level to apply to log output.

      Values: none, partial, full, unset
      Default: partial

      String

      console
      optional

      Console_logging_config

      error
      optional

      Error logging configuration.

      Startup_config_logging_error

      warn
      optional

      Warning logging configuration.

      Startup_config_logging_warn

      info
      optional

      Info logging configuration.

      Startup_config_logging_info

      debug
      optional

      Debug logging configuration.

      Startup_config_logging_debug

      trace
      optional

      Trace logging configuration.

      Startup_config_logging_trace

      stats
      optional

      Trace logging configuration.

      Startup_config_logging_stats

      Scopes

      Name Description Schema

      collections
      optional

      An object keyed by collection name containing config for the specific collection.

      Collection_config Map

      Scopes

      Name Description Schema

      collections
      optional

      An object keyed by collection name containing config for the specific collection.

      Collection_config Map

      Serverless

      Name Description Schema

      enabled
      optional

      Run SG in to serverless mode

      Boolean

      min_config_fetch_interval
      optional

      How long database configs should be kept for in Sync Gateway before refreshing. Set to 0 to fetch configs everytime. This is used for requested databases that SG does not know about.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      Default: 1s

      String

      Startup-config

      Name Description Schema

      bootstrap
      optional

      Configuration settings for interacting with Couchbase Server.

      Startup_config_bootstrap

      api
      optional

      Configuration settings for modifying how the REST API is interacted with.

      Startup_config_api

      logging
      optional

      The configuration settings for modifying Sync Gateway logging.

      Startup_config_logging

      auth
      optional

      Startup_config_auth

      replicator
      optional

      Startup_config_replicator

      unsupported
      optional

      Settings that are not officially supported. It is highly recommended these are **not** used.

      Startup_config_unsupported

      database_credentials
      optional

      A map of database name to credentials, that can be used instead of the bootstrap ones.

      Credentials_config Map

      bucket_credentials
      optional

      A map of bucket names to credentials, that can be used instead of the bootstrap ones.

      Credentials_config_1 Map

      max_file_descriptors
      optional

      Max of open file descriptors (RLIMIT_NOFILE)

      Default: 5000
      Minimum: 0

      BigDecimal

      couchbase_keepalive_interval
      optional

      TCP keep-alive interval between SG and Couchbase server. This is unused.

      Integer

      heap_profile_collection_threshold
      optional

      Threshold in bytes for automatic collection of heap profiles. If not specified, defaults to 85% of the lesser of cgroup or system memory.

      Integer

      heap_profile_disable_collection
      optional

      Disables automatic heap profile collection.

      Default: false

      Boolean

      StartupConfigApi

      Name Description Schema

      public_interface
      optional

      Network interface to bind public API to

      Default: :4984

      String

      admin_interface
      optional

      Network interface to bind admin API to.

      By default, this will only be accessible to the localhost.

      Default: 127.0.0.1:4985

      String

      metrics_interface
      optional

      Network interface to bind metrics API to.

      By default, this will only be accessible to the localhost.

      Default: 127.0.0.1:4986

      String

      profile_interface
      optional

      Network interface to bind profiling API to

      String

      admin_interface_authentication
      optional

      Whether the admin API requires authentication

      Default: true

      Boolean

      metrics_interface_authentication
      optional

      Whether the metrics API requires authentication

      Default: true

      Boolean

      enable_advanced_auth_dp
      optional

      Whether to enable the DP permissions check feature of admin auth.

      Defaults to true if using enterprise-edition or false if using community-edition.

      Boolean

      server_read_timeout
      optional

      Maximum duration before timing out read of the HTTP(S) request.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      String

      server_write_timeout
      optional

      Maximum duration before timing out write of the HTTP(S) response.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      String

      read_header_timeout
      optional

      The amount of time allowed to read request headers.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      Default: 5s

      String

      idle_timeout
      optional

      The maximum amount of time to wait for the next request when keep-alives are enabled.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      Default: 90s

      String

      pretty
      optional

      Pretty-print JSON responses. This property is deprecated.

      Boolean

      max_connections
      optional

      Max of incoming HTTP connections to accept

      Default: 0

      BigDecimal

      compress_responses
      optional

      If false, disables compression of HTTP responses

      Default: true

      Boolean

      hide_product_version
      optional

      Whether product versions removed from Server headers and REST API responses

      Boolean

      https
      optional

      Startup_config_api_https

      cors
      optional

      Startup_config_api_cors

      StartupConfigApiCors

      Name Description Schema

      origin
      optional

      List of allowed origins, use ['*'] to allow access from everywhere

      String List

      login_origin
      optional

      List of allowed login origins

      String List

      headers
      optional

      List of allowed headers

      String List

      max_age
      optional

      Maximum age of the CORS Options request

      Integer

      StartupConfigApiHttps

      Name Description Schema

      tls_minimum_version
      optional

      The minimum allowable TLS version for the REST APIs

      Default: tlsv1.2

      String

      tls_cert_path
      optional

      The TLS cert file to use for the REST APIs

      String

      tls_key_path
      optional

      The TLS key file to use for the REST APIs

      String

      StartupConfigAuth

      Name Description Schema

      bcrypt_cost
      optional

      Cost to use for bcrypt password hashes

      Default: 10
      Minimum: 10
      Maximum: 31

      Integer

      StartupConfigBootstrap

      Name Description Schema

      group_id
      optional

      The config group ID to use when discovering databases. Allows for non-homogenous configuration.

      Default: default

      String

      config_update_frequency
      optional

      How often to poll Couchbase Server for new config changes.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      Default: 10s

      String

      server
      required

      Couchbase Server connection string/URL.

      String

      username
      required

      Username for authenticating to server.

      String

      password
      required

      Password for authenticating to server

      String

      ca_cert_path
      optional

      Root CA cert path for TLS connection

      String

      server_tls_skip_verify
      optional

      Allow empty server CA Cert Path without attempting to use system root pool

      Default: false

      Boolean

      x509_cert_path
      optional

      Cert path (public key) for X.509 bucket auth

      String

      x509_key_path
      optional

      Key path (private key) for X.509 bucket auth

      String

      use_tls_server
      optional

      Enforces a secure or non-secure server scheme

      Default: true

      Boolean

      StartupConfigLogging

      Name Description Schema

      log_file_path
      optional

      Absolute or relative path on the filesystem to the log file directory. A relative path is from the directory that contains the Sync Gateway executable file.

      String

      redaction_level
      optional

      Redaction level to apply to log output.

      Values: none, partial, full, unset
      Default: partial

      String

      console
      optional

      Console_logging_config

      error
      optional

      Error logging configuration.

      Startup_config_logging_error

      warn
      optional

      Warning logging configuration.

      Startup_config_logging_warn

      info
      optional

      Info logging configuration.

      Startup_config_logging_info

      debug
      optional

      Debug logging configuration.

      Startup_config_logging_debug

      trace
      optional

      Trace logging configuration.

      Startup_config_logging_trace

      stats
      optional

      Trace logging configuration.

      Startup_config_logging_stats

      StartupConfigLoggingDebug

      Name Description Schema

      enabled
      optional

      Toggle for this log output

      Default: false

      Boolean

      rotation
      optional

      Startup_config_logging_debug_rotation

      collation_buffer_size
      optional

      The size of the log collation buffer

      Default: 1000

      Integer

      StartupConfigLoggingDebugRotation

      Name Description Schema

      max_size
      optional

      The maximum size in MB of the log file before it gets rotated.

      Default: 100

      Integer

      localtime
      optional

      If true, it uses the computer’s local time to format the backup timestamp.

      Default: false

      Boolean

      rotated_logs_size_limit
      optional

      Max Size (in mb) of log files before deletion

      Default: 1024

      Integer

      rotation_interval
      optional

      If set, the interval at which log files are rotated, even if max_size is not reached.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      Default: 0

      String

      max_age
      optional

      The maximum number of days to retain old log files.

      Default: 2

      Integer

      StartupConfigLoggingError

      Name Description Schema

      enabled
      optional

      Toggle for this log output

      Default: true

      Boolean

      rotation
      optional

      Startup_config_logging_error_rotation

      collation_buffer_size
      optional

      The size of the log collation buffer.

      Default: 0

      Integer

      StartupConfigLoggingErrorRotation

      Name Description Schema

      max_size
      optional

      The maximum size in MB of the log file before it gets rotated.

      Default: 100

      Integer

      localtime
      optional

      If true, it uses the computer’s local time to format the backup timestamp.

      Default: false

      Boolean

      rotated_logs_size_limit
      optional

      Max Size (in mb) of log files before deletion

      Default: 1024

      Integer

      rotation_interval
      optional

      If set, the interval at which log files are rotated, even if max_size is not reached.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      Default: 0

      String

      max_age
      optional

      The maximum number of days to retain old log files.

      Default: 360

      Integer

      StartupConfigLoggingInfo

      Name Description Schema

      enabled
      optional

      Toggle for this log output

      Default: true

      Boolean

      rotation
      optional

      Startup_config_logging_info_rotation

      collation_buffer_size
      optional

      The size of the log collation buffer

      Default: 0

      Integer

      StartupConfigLoggingInfoRotation

      Name Description Schema

      max_size
      optional

      The maximum size in MB of the log file before it gets rotated.

      Default: 100

      Integer

      localtime
      optional

      If true, it uses the computer’s local time to format the backup timestamp.

      Default: false

      Boolean

      rotated_logs_size_limit
      optional

      Max Size (in mb) of log files before deletion

      Default: 1024

      Integer

      rotation_interval
      optional

      If set, the interval at which log files are rotated, even if max_size is not reached.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      Default: 0

      String

      max_age
      optional

      The maximum number of days to retain old log files.

      Default: 6

      Integer

      StartupConfigLoggingStats

      Name Description Schema

      enabled
      optional

      Toggle for this log output

      Default: true

      Boolean

      rotation
      optional

      Startup_config_logging_info_rotation

      collation_buffer_size
      optional

      The size of the log collation buffer

      Default: 0

      Integer

      StartupConfigLoggingTrace

      Name Description Schema

      enabled
      optional

      Toggle for this log output

      Default: false

      Boolean

      rotation
      optional

      Startup_config_logging_debug_rotation

      collation_buffer_size
      optional

      The size of the log collation buffer

      Default: 1000

      Integer

      StartupConfigLoggingWarn

      Name Description Schema

      enabled
      optional

      Toggle for this log output

      Default: true

      Boolean

      rotation
      optional

      Startup_config_logging_warn_rotation

      collation_buffer_size
      optional

      The size of the log collation buffer

      Default: 0

      Integer

      StartupConfigLoggingWarnRotation

      Name Description Schema

      max_size
      optional

      The maximum size in MB of the log file before it gets rotated.

      Default: 100

      Integer

      localtime
      optional

      If true, it uses the computer’s local time to format the backup timestamp.

      Default: false

      Boolean

      rotated_logs_size_limit
      optional

      Max Size (in mb) of log files before deletion

      Default: 1024

      Integer

      rotation_interval
      optional

      If set, the interval at which log files are rotated, even if max_size is not reached.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      Default: 0

      String

      max_age
      optional

      The maximum number of days to retain old log files.

      Default: 180

      Integer

      StartupConfigReplicator

      Name Description Schema

      max_heartbeat
      optional

      Max heartbeat value for _changes request.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      String

      blip_compression
      optional

      BLIP data compression level (0-9)

      Minimum: 0
      Maximum: 9

      Integer

      max_concurrent_replications
      optional

      Maximum number of concurrent replication connections allowed. If set to 0 this limit will be ignored.

      Integer

      max_concurrent_changes_batches
      optional

      Maximum number of changes batches to process concurrently per replication (1-5)"

      Default: 2
      Minimum: 1
      Maximum: 5

      Integer

      max_concurrent_revs
      optional

      Maximum number of revs to process concurrently per replication (5-200)

      Default: 5
      Minimum: 5
      Maximum: 200

      Integer

      StartupConfigUnsupported

      Name Description Schema

      serverless
      optional

      Configuration for when SG is running in serverless mode

      Startup_config_unsupported_serverless

      use_xattr_config
      optional

      Store database configurations in system xattrs

      Default: false

      Boolean

      stats_log_frequency
      optional

      How often should stats be written to stats logs.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      Default: 1m

      String

      use_stdlib_json
      optional

      Bypass the jsoniter package and use Go’s stdlib instead

      Default: false

      Boolean

      http2
      optional

      Startup_config_unsupported_http2

      allow_dbconfig_env_vars
      optional

      Can be set to false to skip environment variable expansion in database configs

      Default: true

      Boolean

      StartupConfigUnsupportedHttp2

      Name Description Schema

      enabled
      optional

      Whether HTTP2 support is enabled

      Default: false

      Boolean

      StartupConfigUnsupportedServerless

      Name Description Schema

      enabled
      optional

      Run SG in to serverless mode

      Boolean

      min_config_fetch_interval
      optional

      How long database configs should be kept for in Sync Gateway before refreshing. Set to 0 to fetch configs everytime. This is used for requested databases that SG does not know about.

      This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be 5h20m30s.

      Default: 1s

      String

      Status

      Name Description Schema

      databases
      optional

      Contains a map of all the databases in the node along with their status.

      Status_1_databases_value Map

      version
      optional

      The product version including the build number and edition (ie. EE or CE).

      Blank if api.hide_product_version=true in the startup configuration.

      String

      Status

      Name Description Schema

      databases
      optional

      Contains a map of all the databases in the node along with their status.

      Status_1_databases_value Map

      version
      optional

      The product version including the build number and edition (ie. EE or CE).

      Blank if api.hide_product_version=true in the startup configuration.

      String

      Status1DatabasesValue

      Name Description Schema

      seq
      optional

      The latest sequence number in the database.

      Minimum: 0

      BigDecimal

      server_uuid
      optional

      The server unique identifier.

      String

      state
      optional

      Whether the database is online or offline.

      Values: Online, Offline, Starting, Stopping, Resyncing

      String

      replication_status
      optional

      Replication_status List

      cluster
      optional

      Status_1_databases_value_cluster

      Status1DatabasesValueCluster

      Name Description Schema

      replication
      optional

      Map of replication configs defined for the cluster.

      Status_1_databases_value_cluster_replication

      nodes
      optional

      Map of all Sync Gateway nodes in the cluster.

      Status_1_databases_value_cluster_nodes

      Status1DatabasesValueClusterNodes

      Name Description Schema

      node_uuid
      optional

      The nodes unique identifier.

      Status_1_databases_value_cluster_nodes_node_uuid

      Status1DatabasesValueClusterNodesNodeUuid

      Name Description Schema

      uuid
      optional

      The nodes unique identifier.

      String

      host
      optional

      The nodes host name.

      String

      Status1DatabasesValueClusterReplication

      Name Description Schema

      replication_id
      optional

      Properties of a replication

      Replication_1

      User

      Name Description Schema

      name
      optional

      The name of the user.

      User names can only have alphanumeric ASCII characters and underscores.

      String

      password
      optional

      The password of the user.

      Mandatory. unless allow_empty_password is true in the database configs.

      String

      admin_channels
      optional

      A list of channels to explicitly grant to the user for the default collection.

      String List

      all_channels
      optional

      All the channels that the user has been granted access to for the default collection.

      Access could have been granted through the sync function, roles, or explicitly on the user under the admin_channels property.

      String List

      collection_access
      optional

      A set of access grants by scope and collection.

      Map Map

      email
      optional

      The email address of the user.

      String

      disabled
      optional

      If true, the user will not be able to login to the account as it is disabled.

      Boolean

      admin_roles
      optional

      A list of roles to explicitly grant to the user.

      String List

      roles
      optional

      All the roles that the user has been granted access to.

      Access could have been granted through the sync function, roles_claim, or explicitly on the user under the admin_roles property.

      String List

      jwt_roles
      optional

      The roles that the user has been added to through roles_claim.

      String List

      jwt_channels
      optional

      The channels that the user has been granted access to through channels_claim.

      String List

      jwt_issuer
      optional

      The issuer of the last JSON Web Token that the user last used to sign in.

      String

      jwt_last_updated
      optional

      The last time that the user’s JWT roles/channels were updated.

      Date (date-time)

      User

      Name Description Schema

      name
      optional

      The name of the user.

      User names can only have alphanumeric ASCII characters and underscores.

      String

      password
      optional

      The password of the user.

      Mandatory. unless allow_empty_password is true in the database configs.

      String

      admin_channels
      optional

      A list of channels to explicitly grant to the user for the default collection.

      String List

      all_channels
      optional

      All the channels that the user has been granted access to for the default collection.

      Access could have been granted through the sync function, roles, or explicitly on the user under the admin_channels property.

      String List

      collection_access
      optional

      A set of access grants by scope and collection.

      Map Map

      email
      optional

      The email address of the user.

      String

      disabled
      optional

      If true, the user will not be able to login to the account as it is disabled.

      Boolean

      admin_roles
      optional

      A list of roles to explicitly grant to the user.

      String List

      roles
      optional

      All the roles that the user has been granted access to.

      Access could have been granted through the sync function, roles_claim, or explicitly on the user under the admin_roles property.

      String List

      jwt_roles
      optional

      The roles that the user has been added to through roles_claim.

      String List

      jwt_channels
      optional

      The channels that the user has been granted access to through channels_claim.

      String List

      jwt_issuer
      optional

      The issuer of the last JSON Web Token that the user last used to sign in.

      String

      jwt_last_updated
      optional

      The last time that the user’s JWT roles/channels were updated.

      Date (date-time)

      User1CollectionAccessValueValue

      Name Description Schema

      admin_channels
      optional

      A list of channels to explicitly grant to the user.

      String List

      all_channels
      optional

      All the channels that the user has been granted access to.

      Access could have been granted through the sync function, roles, or explicitly on the user under the admin_channels property.

      String List

      jwt_channels
      optional

      The channels that the user has been granted access to through channels_claim.

      String List

      jwt_last_updated
      optional

      The last time that the user’s JWT roles/channels were updated.

      Date (date-time)

      User

      Name Description Schema

      name
      optional

      The name of the user.

      User names can only have alphanumeric ASCII characters and underscores.

      String

      password
      optional

      The password of the user.

      Mandatory. unless allow_empty_password is true in the database configs.

      String

      admin_channels
      optional

      A list of channels to explicitly grant to the user for the default collection.

      String List

      all_channels
      optional

      All the channels that the user has been granted access to for the default collection.

      Access could have been granted through the sync function, roles, or explicitly on the user under the admin_channels property.

      String List

      collection_access
      optional

      A set of access grants by scope and collection.

      Map Map

      email
      optional

      The email address of the user.

      String

      disabled
      optional

      If true, the user will not be able to login to the account as it is disabled.

      Boolean

      admin_roles
      optional

      A list of roles to explicitly grant to the user.

      String List

      roles
      optional

      All the roles that the user has been granted access to.

      Access could have been granted through the sync function, roles_claim, or explicitly on the user under the admin_roles property.

      String List

      jwt_roles
      optional

      The roles that the user has been added to through roles_claim.

      String List

      jwt_channels
      optional

      The channels that the user has been granted access to through channels_claim.

      String List

      jwt_issuer
      optional

      The issuer of the last JSON Web Token that the user last used to sign in.

      String

      jwt_last_updated
      optional

      The last time that the user’s JWT roles/channels were updated.

      Date (date-time)

      User configurable replication properties

      Name Description Schema

      replication_id
      optional

      This is the ID of the replication.

      When creating a new replication using a POST request, this will be set to a random UUID if not explicitly set.

      When the replication ID is specified in the URL, this must be set to the same replication ID if specifying it at all.

      String

      remote
      optional

      This is the endpoint of the database for the remote Sync Gateway that is the subject of this replication’s push, pull, or pushAndPull action.

      Typically this would include the URI, port, and database name. For example, http://localhost:4985/db.

      How this remote is used depends on the direction of the replication: * pull - this replicator pulls changes from the remote * push - this replicator pushes changes to this remote * pushAndPull - this replicator pushes changes to this remote, while also pulling receiving changes

      String

      username
      optional

      This has been deprecated in favour of remote_username.

      This is the username to use to authenticate with the remote.

      This can only be used for a pull replication.

      String

      password
      optional

      This has been deprecated in favour of remote_password.

      This is the password to use to authenticate with the remote.

      This password will be redacted in the replication config.

      This can only be used for a pull replication.

      String

      remote_username
      optional

      The username to use to authenticate with the remote.

      This can only be used for a pull replication.

      String

      remote_password
      optional

      The password to use to authenticate with the remote.

      This password will be redacted in the replication config.

      This can only be used for a pull replication.

      String

      direction
      required

      This specifies which direction the replication will be replicating with the remote replicator.

      The directions are: * pull - changes are pulled from the remote database * push - changes are pushed to the remote database * pushAndPull - changes are both push-to and pulled-from the remote database

      Replications created prior to Sync Gateway 2.8 derive their direction from the source/target URL of the replication.

      Values: push, pull, pushAndPull

      String

      conflict_resolution_type
      optional

      This defines what conflict resolution policy Sync Gateway should use to apply when resolving conflicting revisions.

      Changing this is an enterprise-edition only feature.

      Behaviour * default - In priority order, this will cause - Deletes to always win (the delete with the longest revision history wins if both revisions are deletes) - The revision with the longest revision history to win. This means the the revision with the most changes and therefore the highest revision ID will win. * localWins - This will result in local revisions always being the winner in any conflict. * remoteWins - This will result in remote revisions always being the winner in any conflict. * custom - This will result in conflicts going through your own custom conflict resolver. You must provide this logic as a Javascript function in the custom_conflict_resolver parameter. This is an enterprise-edition only feature.

      Note: replications created prior to Sync Gateway 2.8 will default to default.

      Values: default, remoteWins, localWins, custom
      Default: default

      String

      custom_conflict_resolver
      optional

      This specifies the Javascript function to use to resolve conflicts between conflicting revisions.

      This must be used when conflict_resolution_type=custom. This property will be ignored when conflict_resolution_type is not custom.

      The Javascript function to provide this property should be in backticks (like the sync function). The function takes 1 parameter which is a struct that represents the conflict. This struct has 2 properties: * LocalDocument - The local document. This contains the document ID under the _id key. * RemoteDocument - The remote document The function should return the new documents body. This can be the winning revision (for example, return conflict.LocalDocument), a new body, or nil to resolve as a delete.

      Example:

      "custom_conflict_resolver":\`
      	function(conflict) {
      		console.log("Doc ID: "+conflict.LocalDocument._id);
      		console.log("Full remote doc: "+JSON.stringify(conflict.RemoteDocument));
      		return conflict.RemoteDocument;
      	}
      \`

      Using complex custom_conflict_resolver functions can noticeably degrade performance. Use a built-in resolver whenever possible.

      This is an enterprise-edition only feature.

      Default: none

      String

      purge_on_removal
      optional

      Specifies whether to purge a document if the remote user loses access to all of the channels on the document when attempting to pull it from the remote.

      If false, documents will not be replicated and not be purged when the user loses access.

      Default: false

      Boolean

      enable_delta_sync
      optional

      This will turn on delta- sync for the replication. This works in conjunction with the database level setting delta_sync.enabled

      If set to true, delta-sync will be used as long as both databases involved in the replication have delta-sync enabled. If a database does not have delta-sync enabled, then the replication will run without delta-sync.

      Replications created prior to Sync Gateway 2.8 must have delta-sync disabled.

      Enabling this is an enterprise-edition only feature.

      Default: false

      Boolean

      max_backoff_time
      optional

      Specifies the maximum time-period (in minutes) that Sync Gateway will attempt to reconnect to a lost or unreachable remote.

      When a disconnection happens, Sync Gateway will do an exponential backoff up to this specified value. When this value is met, it will attempt to reconnect indefinitely every max_backoff_time minutes.

      If this is set to 0, Sync Gateway will do the normal exponential backoff after the disconnect happens but then attempting 10 minutes and stop the replication.

      Note: this defaults to 5 minutes for replications created prior to Sync Gateway 2.8.

      Default: 5

      Integer

      initial_state
      optional

      This is what state to start the replication in when creating a new replication.

      This allows you to control if the replication starts in a stopped start or running state.

      Replications prior to Sync Gateway 2.8 will run in the default state running.

      Values: running, stopped
      Default: running

      String

      continuous
      optional

      If true, changes will be immediately synced when they happen. This is known as a continuous replication.

      If false, all changes will be synced until they have been processed. The replication will then cease and not process any future changes (unless started again by the user). This is known as a one-shot replication.

      Default: false

      Boolean

      filter
      optional

      This defines whether to filter documents by their channels or not.

      If set to sync_gateway/bychannel then a pull replication will be limited to a specific set of channels specified by the query_params.channels property.

      This only can be used with pull replications.

      Values: sync_gateway/bychannel

      String

      query_params
      optional

      This is a set of key/value pairs used in the query string of the replication.

      If filters=sync_gateway/bychannel then this can be used to set the channels to filter by in a pull replication. To do this, set the channels key to a string array of the channels to filter by. For example:

      "filter":"sync_gateway/bychannel",
      "query_params": {
        "channels":["chanUser1"]
      },

      String List

      adhoc
      optional

      Set to true to run the replication as an adhoc replication instead of a persistent one.

      This means that the replication will only last the period of the replication until the status is changed to stopped and then it will be removed automatically. It will also be removed if Sync Gateway restarts or if removed due to user action.

      Default: false

      Boolean

      batch_size
      optional

      The amount of changes to be sent in one batch of replications. Changing this is an enterprise-edition only feature.

      Default: 200

      Integer

      run_as
      optional

      This is used if you want to specify a user to run the replication as. This means that the replication will only be able to replicate what the user access to what the user has access to.

      String

      collections_enabled
      optional

      If true, the replicator will run with collections, and will replicate all collections, unless otherwise limited by keyspace_map.

      If false, the replicator will only replicate the default collection.

      Default: false

      Boolean

      collections_local
      optional

      Limits the set of collections replicated to those listed in this array.

      The replication will use all collections defined on the database if this list is empty.

      Default: []
      Example: ["scope1.collection1","scope1.collection3","scope1.collection6"]

      String List

      collections_remote
      optional

      Remaps the local collection name to the one specified in this array when replicating with the remote.

      If only a subset of collections need remapping, elements in this array can be specified as null to preserve the local collection name.

      The same index is used for both collections_remote and collections_local, and both arrays must be the same length.

      Default: []
      Example: ["scope1.collectionA",null,"scope1.collectionF"]

      String List

      User Session Information

      Name Description Schema

      authentication_handlers
      optional

      The ways authentication can be established to authenticate as the user.

      String List

      ok
      optional

      Boolean

      userCtx
      optional

      User_Session_Information_userCtx

      UserSessionInformationUserCtx

      Name Description Schema

      channels
      optional

      A map of the channels the user has access to and the sequence number each channel was created at.

      The key is the channel name and the value is the sequence number.

      Object

      name
      optional

      The name of the user.

      String