openapi: 3.0.3
info:
  title: Sync Gateway Admin REST API
  description: >-
    # Introduction


    The Sync Gateway Admin REST API is used to administer user accounts and
    roles, and to run administrative tasks in superuser mode.
  version: '4.0'
  license:
    name: Business Source License 1.1 (BSL)
    url: 'https://github.com/couchbase/sync_gateway/blob/master/LICENSE'
servers:
  - url: '{protocol}://{hostname}:4985'
    description: Admin API
    variables:
      protocol:
        description: The protocol to use (HTTP or HTTPS)
        default: http
        enum:
          - http
          - https
      hostname:
        description: The hostname to use
        default: localhost
tags:
  - name: Authentication
    description: Manage authentication
  - name: Server
    description: Manage server activities
  - name: Database Management
    description: Create and manage Sync Gateway databases
  - name: Database Configuration
    description: Configure Sync Gateway databases
  - name: Database Security
    description: Create and manage database users and roles
  - name: Session
    description: Manage user sessions
  - name: Document
    description: Create and manage documents and attachments
  - name: Replication
    description: Create and manage inter-Sync Gateway replications
  - name: Metrics
    description: Get Sync Gateway statistics
  - name: Profiling
    description: Generate information to help debug and fine-tune Sync Gateway
  - name: Unsupported
    description: Endpoints that are not supported by Sync Gateway
externalDocs:
  description: ⬆️ Admin REST API Overview
  url: rest-api-admin.html
paths:
  '/{db}/_session':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: Get information about the current user
      operationId: get_db-_session
      tags:
        - Session
      description: This will get the information about the current user.
      responses:
        '200':
          description: Properties associated with a user session
          content:
            application/json:
              schema:
                type: object
                properties:
                  authentication_handlers:
                    description: >-
                      The ways authentication can be established to authenticate
                      as a user. Used for CouchDB compatibility. Always contains
                      "default" and "cookie".
                    type: array
                    enum:
                      - - default
                        - cookie
                    default:
                      - default
                      - cookie
                  ok:
                    description: Used for CouchDB compatibility. Always true.
                    type: boolean
                    enum:
                      - true
                  userCtx:
                    type: object
                    properties:
                      channels:
                        description: >-
                          A map of the channels in the default collection that
                          the user is in along with the sequence number the user
                          was granted access. This does not include inherited
                          channels through roles.
                        type: object
                        additionalProperties:
                          x-additionalPropertiesName: channelName
                          type: number
                          minimum: 1
                          description: The sequence number the user was granted access.
                          title: sequence number
                        example:
                          '!': 1
                          channelA: 2
                      name:
                        description: The name of the user.
                        type: string
                        minLength: 1
                    required:
                      - channels
                      - name
                required:
                  - authentication_handlers
                  - ok
                  - userCtx
                title: User Session Information
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    post:
      summary: Create a new user 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
      requestBody:
        description: The body can depend on if using the Public or Admin APIs.
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  description: User name to generate the session for.
                  type: string
                ttl:
                  description: >-
                    Time until the session expires. Uses default value of 24
                    hours if left blank. This value must be greater or equal to
                    1.
                  type: integer
      operationId: post_db-_session
      tags:
        - Session
      responses:
        '200':
          description: >-
            Session created successfully. Returned body is dependant on if using
            Public or Admin APIs.
          content:
            application/json:
              schema:
                type: object
                properties:
                  session_id:
                    description: >-
                      The ID of the session. This is the value that would be put
                      in to the cookie to keep the user authenticated.
                    type: string
                  expires:
                    description: The date and time the cookie expires.
                    type: string
                  cookie_name:
                    description: >-
                      The name of the cookie that would be used to store the
                      users session.
                    type: string
              examples:
                Example:
                  value:
                    session_id: c5af80a039db4ed9d2b6865576b6999935282689
                    expires: '2022-01-21T15:24:44Z'
                    cookie_name: SyncGatewaySession
        '401':
          description: 'User does not have access to resource, or resource does not exist'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Return if database does not exist
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_session/{sessionid}':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
      - name: sessionid
        in: path
        required: true
        schema:
          type: string
        description: The ID of the session to target.
    get:
      summary: Get session information
      operationId: get_db-_session-sessionid
      tags:
        - Session
      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
      responses:
        '200':
          description: Properties associated with a user session
          content:
            application/json:
              schema:
                type: object
                properties:
                  authentication_handlers:
                    description: >-
                      The ways authentication can be established to authenticate
                      as a user. Used for CouchDB compatibility. Always contains
                      "default" and "cookie".
                    type: array
                    enum:
                      - - default
                        - cookie
                    default:
                      - default
                      - cookie
                  ok:
                    description: Used for CouchDB compatibility. Always true.
                    type: boolean
                    enum:
                      - true
                  userCtx:
                    type: object
                    properties:
                      channels:
                        description: >-
                          A map of the channels in the default collection that
                          the user is in along with the sequence number the user
                          was granted access. This does not include inherited
                          channels through roles.
                        type: object
                        additionalProperties:
                          x-additionalPropertiesName: channelName
                          type: number
                          minimum: 1
                          description: The sequence number the user was granted access.
                          title: sequence number
                        example:
                          '!': 1
                          channelA: 2
                      name:
                        description: The name of the user.
                        type: string
                        minLength: 1
                    required:
                      - channels
                      - name
                required:
                  - authentication_handlers
                  - ok
                  - userCtx
                title: User Session Information
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    delete:
      summary: Remove session
      operationId: delete_db-_session-sessionid
      tags:
        - Session
      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
      responses:
        '200':
          description: Successfully removed the user session
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{keyspace}/_raw/{docid}':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
      - name: docid
        in: path
        required: true
        schema:
          type: string
        example: doc1
        description: The document ID to run the operation against.
    get:
      summary: Get a document with the corresponding metadata
      operationId: get_keyspace-_raw-docid
      tags:
        - Document
      description: >-
        Returns a document's latest revision with its metadata as stored.


        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:
        - name: include_doc
          in: query
          required: false
          schema:
            type: string
          description: Include the body associated with the document.
        - name: redact
          in: query
          description: >-
            This redacts sensitive parts of the response. Cannot be used when
            `include_doc=true`
          schema:
            type: boolean
        - name: salt
          in: query
          description: >-
            Whether to apply redaction with a custom salt - the intention here
            is to allow consistent hashing with a log collection. If this value
            is not set, a random salt will be used.
          schema:
            type: string
      responses:
        '200':
          description: Document found successfully
          content:
            application/json:
              schema:
                type: object
                example:
                  channels:
                    - a
                    - ecWZjZjcpg
                  myblob:
                    length: 11
                    content_type: text/plain
                    digest: sha1-Kq5sNclPz7QV2+lfQIuc6R7oRu0=
                    '@type': blob
                  _xattrs:
                    _sync:
                      cas: '0x000097d3e4e45418'
                      channel_set:
                        - name: a
                          start: 3128
                        - name: ecWZjZjcpg
                          start: 3128
                      channel_set_history: null
                      channels:
                        a: null
                        ecWZjZjcpg: null
                      cluster_uuid: ba2606db6dccedbcf4a6d3f66e242b8b
                      history:
                        channels:
                          - - a
                            - ecWZjZjcpg
                        parents:
                          - -1
                        revs:
                          - 1-525e04f141fbd0394d693531593105b88dbe0b25
                      recent_sequences:
                        - 3128
                      rev:
                        rev: 1-525e04f141fbd0394d693531593105b88dbe0b25
                        src: zTWkmBiYZgNQo7BHVZrB/Q
                        ver: '0x000097d3e4e45418'
                      sequence: 3128
                      time_saved: '2025-07-23T14:37:06.407392+01:00'
                      value_crc32c: '0x38db3c8c'
                    _globalSync:
                      attachments_meta:
                        blob_/myblob:
                          content_type: text/plain
                          digest: sha1-Kq5sNclPz7QV2+lfQIuc6R7oRu0=
                          length: 11
                          revpos: 1
                          stub: true
                          ver: 2
                    _mou: null
                    _vv:
                      cvCas: '0x000097d3e4e45418'
                      src: zTWkmBiYZgNQo7BHVZrB/Q
                      ver: '0x000097d3e4e45418'
                additionalProperties: true
                properties:
                  _xattrs:
                    description: >-
                      The extended attributes of the document, which can include
                      Sync Gateway metadata, such as revision history, channel
                      information, and other sync-related data. This is
                      non-exhaustive and only includes xattrs that are relevant
                      to Sync Gateway. Any `null` values indicate the xattr is
                      not present on the document.
                    type: object
                    properties:
                      _sync:
                        description: Sync Gateway metadata for the document.
                        type: object
                        nullable: true
                        additionalProperties: true
                      _globalSync:
                        description: >-
                          Globally replicated Sync Gateway metadata for the
                          document.
                        type: object
                        nullable: true
                        additionalProperties: true
                      _mou:
                        description: Metadata-only update information.
                        type: object
                        nullable: true
                        additionalProperties: true
                      _vv:
                        description: Version Vector for the document.
                        type: object
                        nullable: true
                        additionalProperties: true
                      $document:
                        description: Document virtual xattrs.
                        type: object
                        nullable: true
                        additionalProperties: true
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{keyspace}/_revtree/{docid}':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
      - name: docid
        in: path
        required: true
        schema:
          type: string
        example: doc1
        description: The document ID to run the operation against.
    get:
      summary: Revision tree structure in Graphviz Dot format | Unsupported
      operationId: get_keyspace-_revtree-docid
      tags:
        - Unsupported
      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](https://www.graphviz.org/).


        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.**
      responses:
        '200':
          description: Found document
          content:
            application/json:
              schema:
                type: string
              example: >-
                digraph graphname{"1-d4d949b7feafc8c31215684baa45b6cd" ->
                "2-4f3f24143ea43d85a9a340ac016fdfc4"; }
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: Get database information
      operationId: get_db-
      tags:
        - Database Management
      description: |-
        Retrieve information about the database.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      responses:
        '200':
          description: Successfully returned database information
          content:
            application/json:
              schema:
                type: object
                properties:
                  db_name:
                    description: Database name
                    type: string
                    example: db
                  update_seq:
                    description: >-
                      The last sequence number that was committed to the
                      database.


                      Will return 0 if the database is offline.
                    type: integer
                    example: 123456
                  committed_update_seq:
                    description: >-
                      The last sequence number that was committed to the
                      database.


                      Will return 0 if the database is offline.
                    type: integer
                    example: 123456
                  instance_start_time:
                    description: >-
                      Timestamp of when the database opened, in microseconds
                      since the Unix epoch.
                    type: integer
                    example: 1644600082279583
                  compact_running:
                    description: >-
                      Indicates whether database compaction is currently taking
                      place or not.
                    type: boolean
                  purge_seq:
                    description: Unused field.
                    type: number
                    default: 0
                  disk_format_version:
                    description: Unused field.
                    type: number
                    default: 0
                  state:
                    allOf:
                      - description: The state of the database.
                        type: string
                        enum:
                          - Online
                          - Offline
                          - Starting
                          - Stopping
                          - Resyncing
                        x-enumDescriptions:
                          Online: The database is online and available for use.
                          Offline: >-
                            The database is offline, resync and other offline
                            only endpoints are allowed.
                          Starting: The database is in the process of going online.
                          Stopping: >-
                            The database is no longer accepting connections and
                            is being taken offline or deleted.
                          Resyncing: >-
                            The database is offline and performing a resync
                            operation.
                  server_uuid:
                    description: Unique server identifier.
                    type: string
                    example: 995618a6a6cc9ac79731bd13240e19b5
                  require_resync:
                    description: >-
                      Indicates whether the database requires resync before it
                      can be brought online.
                    type: boolean
                  init_in_progress:
                    description: Indicates whether database initialization is in progress.
                    type: boolean
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    delete:
      summary: Remove a database
      operationId: delete_db-
      tags:
        - Database Management
      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
      responses:
        '200':
          description: Successfully removed the database
          content:
            application/json:
              schema:
                type: object
                properties: {}
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '500':
          description: Cannot remove database from bucket
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
    head:
      summary: Check if database exists
      operationId: head_db-
      tags:
        - Database Management
      description: |-
        Check if a database exists by using the response status code.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      responses:
        '200':
          description: Database exists
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    put:
      summary: Create a new Sync Gateway database
      operationId: put_db-
      tags:
        - Database Management
      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:
        - name: disable_oidc_validation
          in: query
          required: false
          description: >-
            If set, will not attempt to validate the configured OpenID Connect
            providers are reachable.
          schema:
            type: boolean
            default: false
      requestBody:
        description: The configuration to use for the new database
        content:
          application/json:
            schema:
              description: The properties of a database configuration.
              type: object
              x-requirePropertiesSorted: true
              properties:
                allow_empty_password:
                  description: >-
                    This controls whether users that are created can have an
                    empty password or not.
                  type: boolean
                  default: false
                bucket:
                  description: The Couchbase Server backing bucket for the database.
                  type: string
                  default: The database name
                bucket_op_timeout_ms:
                  description: >-
                    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`.
                  type: number
                cacertpath:
                  description: The root CA cert path for X.509 bucket authentication.
                  type: string
                cache:
                  type: object
                  x-requirePropertiesSorted: true
                  properties:
                    channel_cache:
                      description: The channel cache config settings.
                      x-requirePropertiesSorted: true
                      type: object
                      properties:
                        compact_high_watermark_pct:
                          description: >-
                            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.
                          type: integer
                          default: 80
                        compact_low_watermark_pct:
                          description: >-
                            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.
                          type: integer
                          default: 60
                        expiry_seconds:
                          description: >-
                            The amount of time (in seconds) to keep entries in
                            the cache beyond the minimum retained.
                          type: integer
                          default: 60
                        max_length:
                          description: >-
                            The maximum number of entries to maintain in the
                            cache per channel.
                          type: integer
                          default: 500
                        max_num_pending:
                          description: >-
                            The maximum number of pending sequences before
                            skipping sequences.
                          type: integer
                          default: 10000
                        max_number:
                          description: >-
                            The maximum number of channel caches which can exist
                            at any one point.
                          type: integer
                          default: 50000
                        max_wait_pending:
                          description: >-
                            The maximum time (in milliseconds) for waiting for a
                            pending sequence before skipping it.
                          type: number
                          default: 5000
                        max_wait_skipped:
                          description: >-
                            The maximum amount of time (in milliseconds) to wait
                            for a skipped sequence before abandoning it.
                          type: number
                          default: 3600000
                        min_length:
                          description: >-
                            The minimum number of entries to maintain in the
                            cache per channel.
                          type: integer
                          default: 50
                        enable_star_channel:
                          description: >-
                            Since Sync Gateway 4.0, this option no longer has an
                            effect, the star channel is always enabled.

                            If this value is set to false, a database can only
                            exist in the offline state until this configuration
                            is modified.
                          type: boolean
                          default: true
                          deprecated: true
                        query_limit:
                          description: >-
                            **Deprecated in favour of the database setting
                            `query_pagination_limit`**


                            The limit used for channel queries.
                          type: integer
                          default: 5000
                          deprecated: true
                    rev_cache:
                      description: The revision cache config settings.
                      type: object
                      properties:
                        max_memory_count_mb:
                          description: >-
                            The maximum amount of memory the revision cache
                            should take up in MB, setting to 0 will disable any
                            eviction based on memory at rev cache.

                            There is a minimum value of 50 (50MB) for this
                            config option.

                            When set this memory limit will work in in hand with
                            revision cache size parameter. So you will
                            potentially get eviction at revision cache both
                            based off memory footprint and number of items in
                            the cache.

                            **This is an Enterprise Edition feature only**
                          type: integer
                          default: 0
                        shard_count:
                          description: >-
                            The number of shards the revision cache should be
                            split into.
                          type: integer
                          default: 16
                        size:
                          description: >-
                            The maximum number of revisions that can be stored
                            in the revision cache.

                            Note when running with greater than 1 shard count we
                            add 10% capacity overall to avoid early eviction
                            when some shards fill up before others, so

                            you may find that the capacity stat
                            (revision_cache_num_items) will climb to the defined
                            rev cache size + 10%.
                          type: integer
                          default: 5000
                    channel_cache_expiry:
                      description: >-
                        **Deprecated, please use the database setting
                        `cache.channel_cache.expiry_seconds` instead**


                        The time (seconds) to keep entries in cache beyond the
                        minimum retained.
                      type: integer
                      deprecated: true
                    channel_cache_max_length:
                      description: >-
                        **Deprecated, please use the database setting
                        `cache.channel_cache.max_length` instead**


                        The maximum number of entries maintained in cache per
                        channel.
                      type: number
                      deprecated: true
                    channel_cache_min_length:
                      description: >-
                        **Deprecated, please use the database setting
                        `cache.channel_cache.min_length` instead**


                        The minimum number of entries maintained in cache per
                        channel.
                      type: integer
                      deprecated: true
                    enable_star_channel:
                      description: >-
                        **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.
                      type: boolean
                      deprecated: true
                    max_num_pending:
                      description: >-
                        **Deprecated, please use the database setting
                        `cache.channel_cache.max_num_pending` instead**


                        The max number of pending sequences before skipping.
                      type: integer
                      deprecated: true
                    max_wait_pending:
                      description: >-
                        **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.
                      type: number
                      deprecated: true
                    max_wait_skipped:
                      description: >-
                        **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.
                      type: number
                      deprecated: true
                certpath:
                  description: The cert path (public key) for X.509 bucket auth.
                  type: string
                changes_request_plus:
                  type: boolean
                  default: false
                  description: >-
                    Sets the default value of `request_plus` for
                    one-shot/non-continuous changes feeds, which when true,
                    ensures all valid documents written prior to the request
                    being issued are included in the response. Setting this
                    option at the database level is required to ensure Couchbase
                    Lite utilizes this changes feed mode.


                    This also sets the default value of query param
                    `request_plus` for [GET
                    /{keyspace}/_changes](#operation/get_keyspace-_changes) or
                    `request_plus` for [POST
                    /{keyspace}/_changes](#operation/post_keyspace-_changes).
                client_partition_window_secs:
                  description: >-
                    How long (in seconds) clients can remain offline for without
                    losing replication metadata.


                    Defaults to 30 days (in seconds)
                  type: integer
                  default: 2592000
                compact_interval_days:
                  description: >-
                    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.
                  type: number
                  default: 1
                cors:
                  allOf:
                    - type: object
                      properties:
                        headers:
                          description: >-
                            List of allowed headers. These headers will be added
                            the `Access-Control-Allow-Headers` response to a
                            valid CORS request.


                            A recommended minimum set of values should be
                            `["Accept-Encoding", "Authorization",
                            "Content-Type", "If-Match"]`.
                          type: array
                          items:
                            type: string
                          example:
                            - Accept-Encoding
                            - Authorization
                            - Content-Type
                            - If-Match
                        login_origin:
                          description: >-
                            List of allowed origins to apply to public
                            `/{db}/_session` API.


                            To use cors on `/{db}/_session`, the domain must be
                            present in both `login_origin` and `origin`.


                            If configured, `Authorization` must be included in
                            headers.
                          type: array
                          items:
                            type: string
                          example:
                            - 'https://example.com'
                        max_age:
                          description: >-
                            Value for `Access-Control-Maximum-Age`. Uses 0 by
                            default.
                          type: integer
                          default: 0
                        origin:
                          description: >-
                            List of allowed origins for the public API. The
                            request `Origin` header is checked against these
                            values. If successful the `Origin` header is
                            returned in the HTTP response header as
                            `Access-Control-Allow-Origin`.
                          type: array
                          items:
                            type: string
                          example:
                            - 'https://example.com'
                      title: Cors Configuration
                    - type: object
                      description: >-
                        CORS configuration for this database; if present,
                        overrides server's config.
                delta_sync:
                  description: |-
                    Delta sync configuration settings.

                    **This is an Enterprise Edition feature only**
                  type: object
                  properties:
                    enabled:
                      description: |-
                        Whether delta sync is enabled.

                        **This is an Enterprise Edition feature only**
                      type: boolean
                      default: false
                    rev_max_age_seconds:
                      description: >-
                        The number of seconds deltas for old revisions are
                        available for.


                        This defaults to 24 hours (in seconds).
                      type: number
                      default: 86400
                disable_password_auth:
                  description: >-
                    Whether to disable username/password authentication and only
                    allow OIDC and guest access.
                  type: boolean
                  default: false
                disable_public_all_docs:
                  description: >-
                    This controls whether the [GET
                    /{keyspace}/_all_docs](#operation/get_keyspace-_all_docs)
                    REST API endpoint is publicly accessible or not.

                    Disabling this endpoint is recommended for larger datasets
                    or production workloads.

                    [GET /{keyspace}/_changes](#operation/get_keyspace-_changes)
                    or [POST
                    /{keyspace}/_bulk_get](#operation/post_keyspace-_bulk_get)
                    have more efficient implementations and should be used
                    instead.


                    If set to `true`, the endpoint will not be publicly
                    accessible, and will only be available on the Admin API.

                    Setting this to `false`, or leaving it as the default value
                    is deprecated, and may default to `true` in a future
                    release.
                  type: boolean
                  default: false
                event_handlers:
                  description: These are the settings for webhooks.
                  type: object
                  properties:
                    db_state_changed:
                      type: object
                      properties:
                        handler:
                          description: The handler type.
                          type: string
                          enum:
                            - webhook
                        url:
                          description: The URL of the webhook.
                          type: string
                        filter:
                          description: >-
                            The Javascript function to use to filter the webhook
                            events.
                          type: string
                        timeout:
                          description: >-
                            The amount of time (in seconds) to attempt connect
                            to the webhook before giving up.
                          type: number
                      title: Event-config
                    document_changed:
                      allOf:
                        - type: object
                          properties:
                            handler:
                              description: The handler type.
                              type: string
                              enum:
                                - webhook
                            url:
                              description: The URL of the webhook.
                              type: string
                            filter:
                              description: >-
                                The Javascript function to use to filter the
                                webhook events.
                              type: string
                            timeout:
                              description: >-
                                The amount of time (in seconds) to attempt
                                connect to the webhook before giving up.
                              type: number
                          title: Event-config
                        - type: object
                          properties:
                            options:
                              description: Options for the document changed event.
                              type: object
                              properties:
                                winning_rev_only:
                                  description: >-
                                    If true, only the winning revision of the
                                    document will be sent to the webhook.
                                  type: boolean
                                  default: false
                    max_processes:
                      description: >-
                        The maximum amount of concurrent event handling
                        independent functions that can be running at the same
                        time.
                      type: string
                    wait_for_process:
                      description: >-
                        The maximum amount of time (in milliseconds) to wait
                        when the even queue is full.
                      type: string
                guest:
                  description: Properties associated with a user
                  type: object
                  properties:
                    name:
                      description: >-
                        The name of the user.


                        User names can only have alphanumeric ASCII characters
                        and underscores.
                      type: string
                    password:
                      description: >-
                        The password of the user.


                        Mandatory. unless `allow_empty_password` is `true` in
                        the database configs.
                      type: string
                    admin_channels:
                      description: >-
                        A list of channels to explicitly grant to the user for
                        the default collection.

                        See `collection_access` for channels in named
                        collections.
                      type: array
                      items:
                        type: string
                    all_channels:
                      description: >-
                        All the channels that the user has been granted access
                        to for the default collection.

                        See `collection_access` for channels in named
                        collections.


                        Access could have been granted through the sync
                        function, roles, or explicitly on the user under the
                        `admin_channels` property.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    email:
                      description: The email address of the user.
                      type: string
                    disabled:
                      description: >-
                        If true, the user will not be able to login to the
                        account as it is disabled.
                      type: boolean
                      default: false
                    admin_roles:
                      description: A list of roles to explicitly grant to the user.
                      type: array
                      items:
                        type: string
                    roles:
                      description: >-
                        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.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    jwt_roles:
                      description: >-
                        The roles that the user has been added to through
                        roles_claim.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    jwt_channels:
                      description: >-
                        The channels that the user has been granted access to
                        through channels_claim for the default collection.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    jwt_issuer:
                      description: >-
                        The issuer of the last JSON Web Token that the user last
                        used to sign in.
                      type: string
                      readOnly: true
                    jwt_last_updated:
                      description: >-
                        The last time that the user's JWT roles/channels were
                        updated.
                      type: string
                      format: date-time
                      readOnly: true
                    collection_access:
                      description: >-
                        A set of access grants by scope and collection for a
                        specific collection.
                      type: object
                      additionalProperties:
                        maxProperties: 1
                        description: >-
                          An object keyed by scope, containing a set of
                          collections.
                        type: object
                        x-additionalPropertiesName: scopename
                        additionalProperties:
                          description: >-
                            An object keyed by collection name, defines access
                            collections in this scope.
                          type: object
                          x-additionalPropertiesName: collectionname
                          properties:
                            admin_channels:
                              description: >-
                                A list of channels to explicitly grant to the
                                user in this collection.
                              type: array
                              items:
                                type: string
                            all_channels:
                              description: >-
                                All the channels that the user has been granted
                                access to in this collection.


                                Access could have been granted through the sync
                                function, roles, or explicitly on the user under
                                the `admin_channels` property.
                              type: array
                              items:
                                type: string
                              readOnly: true
                            jwt_channels:
                              description: >-
                                The channels that the user has been granted
                                access to through channels_claim for this
                                collection.
                              type: array
                              items:
                                type: string
                              readOnly: true
                            jwt_last_updated:
                              description: >-
                                The last time that the user's JWT channels were
                                updated for this collection.
                              type: string
                              format: date-time
                              readOnly: true
                  title: User
                import_backup_old_rev:
                  description: >-
                    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.
                  type: boolean
                  default: false
                import_docs:
                  description: >-
                    If true, documents will be imported in to Sync Gateway from
                    the bucket in the background. 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 value requires
                    `enable_shared_bucket_access=true`.


                    This can also be set to the string `continuous` which maps
                    to true.
                  type: boolean
                import_filter:
                  description: >-
                    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.
                  type: string
                  example: >-
                    function(doc) { if (doc.type != 'mobile') { return false; }
                    return true; }
                import_partitions:
                  description: >-
                    ** 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.
                  type: number
                  default: 16
                  minimum: 1
                  maximum: 1024
                index:
                  description: Global Secondary Index Settings
                  properties:
                    num_partitions:
                      description: >-
                        The number of partitions to use for the large indexes
                        created by Sync Gateway. It is not recommended to set
                        this unless you require additional horizontal
                        scalability for individual indexes and have
                        appropriately scaled your Query nodes to handle the
                        increased query parallelism. If set, the recommended
                        number is 8 and does not need to be directly related to
                        the number of your Query nodes. Ensure documentation is
                        read to understand the performance tradeoffs and
                        instructions for migration if you have previously run
                        with only one partition. See
                        [/{db}/_index_init](#operation/post_db-_index_init) for
                        more information.


                        If not specified or 1, all indexes will be non
                        partitioned.
                      type: number
                      default: 1
                      title: Number of Index Partitions
                    num_replicas:
                      description: >-
                        This is the number of Global Secondary Indexes (GSI) to
                        use for core indexes.
                      type: number
                      default: 1
                javascript_timeout_secs:
                  description: >-
                    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.
                  type: number
                  default: 60
                keypath:
                  description: The key path (private key) for X.509 bucket auth
                  type: string
                kv_tls_port:
                  description: The Memcached TLS port.
                  type: integer
                  default: 11207
                local_doc_expiry_secs:
                  description: >-
                    The number of seconds before a `_local` document should
                    expire.
                  type: integer
                  default: 7776000
                local_jwt:
                  description: Configuration for Local JWT authentication.
                  type: object
                  additionalProperties:
                    x-additionalPropertiesName: providername
                    description: The providers name.
                    type: object
                    required:
                      - issuer
                      - client_id
                      - algorithms
                      - keys
                    properties:
                      algorithms:
                        description: >-
                          The JWT signing algorithms to accept for
                          authentication.
                        type: array
                        items:
                          type: string
                      channels_claim:
                        description: >-
                          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.
                        type: string
                      client_id:
                        description: >-
                          The value to match against the "aud" claim of JWTs.
                          Set to an empty string to disable audience validation.
                        type: string
                      disable_session:
                        description: >-
                          Disable Sync Gateway session creation on successful
                          JWT authentication.
                        type: boolean
                      issuer:
                        description: The value to match against the "iss" claim of JWTs.
                        type: string
                      keys:
                        description: The JSON Web Keys to use to validate JWTs.
                        type: array
                        items:
                          type: object
                          properties:
                            alg:
                              type: string
                              description: The algorithm intended for use with the key.
                            crv:
                              type: string
                              description: >-
                                For Elliptic Curve keys, the name of the curve
                                to use.
                              enum:
                                - P-256
                                - P-384
                                - P-521
                            e:
                              type: string
                              description: >-
                                For RSA keys, the exponent of the public key, as
                                a Base64urlUInt-encoded value.
                            kid:
                              type: string
                              description: 'The Key ID, used to identify the key to use.'
                            kty:
                              type: string
                              description: >-
                                The cryptographic algorithm family used with the
                                key, such as "RSA" or "EC"
                              enum:
                                - RSA
                                - EC
                            'n':
                              type: string
                              description: >-
                                For RSA keys, the modulus value of the key, as a
                                Base64urlUInt-encoded value.
                            use:
                              type: string
                              description: >-
                                The intended use of the public key. Only 'sig'
                                is accepted.
                              enum:
                                - sig
                            x:
                              type: string
                              description: >-
                                For Elliptic Curve keys, the X coordinate of the
                                point, as a base64url string.
                            'y':
                              type: string
                              description: >-
                                For Elliptic Curve keys, the Y coordinate of the
                                point, as a base64url string.
                      register:
                        description: >-
                          If to register a new Sync Gateway user account when a
                          user logs in with a JWT.
                        type: boolean
                      roles_claim:
                        description: >-
                          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.
                        type: string
                      user_prefix:
                        description: >-
                          This is the username prefix for all users created
                          through this provider.
                        type: string
                      username_claim:
                        description: >-
                          Allows a different OpenID Connect field to be
                          specified instead of the Subject (`sub`).


                          The field name to use can be specified here.
                        type: string
                logging:
                  description: Per-database logging configuration.
                  type: object
                  properties:
                    audit:
                      description: Audit logging configuration.
                      type: object
                      properties:
                        disabled_roles:
                          description: >-
                            List of roles for which audit logging is disabled.
                            Either cbs or sgw.
                          type: array
                          items:
                            type: object
                            properties:
                              domain:
                                description: >
                                  The domain of the role for which audit logging
                                  is disabled.
                                enum:
                                  - cbs
                                  - sgw
                                x-enumDescription:
                                  cbs: Couchbase Server RBAC
                                  sgw: Sync Gateway Role
                                type: string
                              name:
                                description: >-
                                  The name of the role for which audit logging
                                  is disabled.
                                type: string
                        disabled_users:
                          description: List of users for which audit logging is disabled.
                          type: array
                          items:
                            type: object
                            properties:
                              domain:
                                description: >
                                  The domain of the user for which audit logging
                                  is disabled.
                                type: string
                                enum:
                                  - cbs
                                  - sgw
                                x-enumDescription:
                                  cbs: Couchbase Server User
                                  sgw: Sync Gateway User
                              name:
                                description: >-
                                  The name of the user for which audit logging
                                  is disabled.
                                type: string
                        enabled:
                          description: Whether audit logging is enabled.
                          type: boolean
                          default: false
                        enabled_events:
                          description: List of enabled audit events for this database.
                          type: array
                          items:
                            type: number
                            example:
                              - 1234
                              - 5678
                    console:
                      description: Console logging configuration.
                      type: object
                      properties:
                        log_keys:
                          description: Log Keys for the console output
                          type: array
                          items:
                            type: string
                          example:
                            - CRUD
                            - HTTP
                            - Query
                        log_level:
                          description: Log Level for the console output
                          type: string
                          enum:
                            - none
                            - error
                            - warn
                            - info
                            - debug
                            - trace
                          example: debug
                max_concurrent_query_ops:
                  description: >-
                    The maximum amount of query operations that can be running
                    at any one point.
                  type: integer
                  default: 1000
                name:
                  description: The name of the database.
                  type: string
                offline:
                  description: Start the database in an offline state.
                  type: boolean
                  default: false
                oidc:
                  description: Configuration for OpenID Connect authentication.
                  type: object
                  properties:
                    default_provider:
                      description: >-
                        The default provider to use when the provider is not
                        specified in the client.
                      type: string
                    providers:
                      description: List of OpenID Connect issuers.
                      type: object
                      additionalProperties:
                        x-additionalPropertiesName: providername
                        description: The providers name.
                        type: object
                        properties:
                          InsecureSkipVerify:
                            description: >-
                              Determines whether the TLS certificate
                              verification should be disabled for this
                              provider. 
                            type: boolean
                            default: false
                          IsDefault:
                            description: >-
                              Indicates if this is the default OpenID Connect
                              provider.
                            type: boolean
                          Name:
                            description: The name of the OpenID Connect Provider.
                            type: string
                          allow_unsigned_provider_tokens:
                            description: >-
                              Allows users accept unsigned tokens from
                              providers.
                            type: boolean
                          callback_url:
                            description: >-
                              The URL that the OpenID Connect will redirect to
                              after authentication.


                              If not provided, a callback URL will be generated.
                            type: string
                          channels_claim:
                            description: >-
                              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.
                            type: string
                          client_id:
                            description: The OpenID Connect provider client ID.
                            type: string
                          disable_callback_state:
                            description: >-
                              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).**
                            type: boolean
                            default: false
                          disable_cfg_validation:
                            description: >-
                              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.
                            type: boolean
                            default: false
                          disable_session:
                            description: >-
                              Disable Sync Gateway session creation on
                              successful OpenID Connect authentication.
                            type: boolean
                          discovery_url:
                            description: The non-standard discovery endpoint.
                            type: string
                          include_access:
                            description: >-
                              This is whether the `_oidc_callback` response
                              should include the OpenID Connect access token and
                              associated fields (such as `token_type`, and
                              `expires_in`).
                            type: boolean
                          issuer:
                            description: The URL for the OpenID Connect issuer.
                            type: string
                          register:
                            description: >-
                              If to register a new Sync Gateway user account
                              when a user logs in with OpenID Connect.
                            type: boolean
                          roles_claim:
                            description: >-
                              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.
                            type: string
                          scope:
                            description: The scope sent for the OpenID Connect request.
                            type: array
                            items:
                              type: string
                          user_prefix:
                            description: >-
                              This is the username prefix for all users created
                              through this provider.
                            type: string
                          username_claim:
                            description: >-
                              Allows a different OpenID Connect field to be
                              specified instead of the Subject (`sub`).


                              The field name to use can be specified here.
                            type: string
                          validation_key:
                            description: The OpenID Connect provider client secret.
                            type: string
                old_rev_expiry_seconds:
                  description: >-
                    The number of seconds before old revisions are removed from
                    the Couchbase Server bucket.
                  type: number
                  default: 300
                password:
                  description: The password for authenticating to the server.
                  type: string
                query_pagination_limit:
                  description: >-
                    The query limit to be used during pagination of large
                    queries.
                  type: integer
                  default: 5000
                replications:
                  type: object
                  properties:
                    replication_id:
                      description: Properties of a replication
                      type: object
                      x-requirePropertiesSorted: true
                      properties:
                        adhoc:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        batch_size:
                          description: >-
                            The amount of changes to be sent in one batch of
                            replications. Changing this is an Enterprise Edition
                            only feature.
                          type: integer
                          default: 200
                        collections_enabled:
                          description: >-
                            If true, the replicator will run with collections,
                            and will replicate all collections, unless otherwise
                            limited by `collections_local`.


                            If false, the replicator will only replicate the
                            default collection.
                          type: boolean
                          default: false
                        collections_local:
                          description: >-
                            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.
                          type: array
                          items:
                            type: string
                          example:
                            - scope1.collection1
                            - scope1.collection3
                            - scope1.collection6
                          default: []
                        collections_remote:
                          description: >-
                            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.
                          type: array
                          items:
                            type: string
                            nullable: true
                          example:
                            - scope1.collectionA
                            - null
                            - scope1.collectionF
                          default: []
                        conflict_resolution_type:
                          description: >-
                            This defines what conflict resolution policy Sync
                            Gateway should use to apply when resolving
                            conflicting revisions.


                            Changing this is an Enterprise Edition only feature.
                          type: string
                          default: default
                          enum:
                            - default
                            - remoteWins
                            - localWins
                            - custom
                          x-enumDescriptions:
                            default: |-
                              This will use:
                                - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                                - The revision with the most recent timestamp wins.
                                - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                            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.
                        continuous:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        custom_conflict_resolver:
                          description: >-
                            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 document's body.
                            This can be the winning revision (for example,
                            `return conflict.LocalDocument`), a new body, or
                            `nil` to resolve as a delete.


                            Example:


                            ```javascript

                            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.


                            If a document merge is being done, the `_rev` and
                            `_cv` properties should not be included in the
                            returned document body as Sync Gateway will generate
                            new values for these.


                            This is an Enterprise Edition only feature.
                          type: string
                          default: ''
                        direction:
                          description: >-
                            This specifies which direction the replication will
                            be replicating with the `remote` replicator.
                          type: string
                          enum:
                            - push
                            - pull
                            - pushAndPull
                          x-enumDescriptions:
                            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
                        enable_delta_sync:
                          description: >-
                            This will turn on delta-sync for the replication. In
                            order to enable delta-sync for a replication, the
                            database level setting `delta_sync.enabled` must
                            also be set to true.


                            Using delta-sync is an Enterprise Edition only
                            feature.
                          type: boolean
                          default: false
                        filter:
                          description: This defines whether to filter documents.
                          type: string
                          enum:
                            - sync_gateway/bychannel
                            - ''
                          x-enumDescriptions:
                            '': Do not filter any documents.
                            sync_gateway/bychannel: >-
                              If set, a pull replication will be limited to a
                              specific set of channels specified by the
                              `query_param.channels` property.
                        initial_state:
                          description: >-
                            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`.
                          type: string
                          default: running
                          enum:
                            - running
                            - stopped
                          x-enumDescriptions:
                            running: The replication will immediately start running.
                            stopped: >-
                              The replication configuration will be created but
                              the replication will not start running until the
                              user explicitly starts it.
                        max_backoff_time:
                          description: >-
                            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.
                          type: integer
                          default: 5
                        purge_on_removal:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        query_params:
                          description: >-
                            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:

                            ```json

                            "filter":"sync_gateway/bychannel",

                            "query_params": {
                              "channels":["chanUser1"]
                            },

                            ```
                          type: array
                          items:
                            type: string
                        remote:
                          description: >-
                            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,
                            `https://localhost:4985/db`.
                          type: string
                        remote_password:
                          description: >-
                            The password to use to authenticate with the remote.
                            This password will be redacted in the replication
                            config.
                          type: string
                        remote_username:
                          description: The username to use to authenticate with the remote.
                          type: string
                        replication_id:
                          description: >-
                            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.
                          type: string
                          maximum: 160
                        run_as:
                          description: >-
                            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.
                          type: string
                        password:
                          description: >-
                            **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.
                          type: string
                          deprecated: true
                        username:
                          description: >-
                            **This has been deprecated in favour of
                            `remote_username`.**


                            This is the username to use to authenticate with the
                            remote.
                          type: string
                          deprecated: true
                      required:
                        - direction
                      title: User configurable replication properties
                revs_limit:
                  description: The maximum depth a document's revision tree can grow to.
                  type: number
                  default: 50
                  minimum: 0
                roles:
                  additionalProperties:
                    x-additionalPropertiesName: rolename
                    description: Properties associated with a role
                    type: object
                    properties:
                      name:
                        description: >-
                          The name of the role.


                          Role names can only have alphanumeric ASCII characters
                          and underscores.
                        type: string
                      admin_channels:
                        description: >-
                          A list of channels to explicitly grant to the role for
                          the default collection.

                          See `collection_access` for channels in named
                          collections.
                        type: array
                        items:
                          type: string
                      all_channels:
                        description: >-
                          All the channels that the role has been granted access
                          to for the default collection.


                          These channels could have been assigned by the Sync
                          function or using the `admin_channels` property.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      collection_access:
                        description: >-
                          A set of access grants by scope and collection for a
                          specific collection.
                        type: object
                        additionalProperties:
                          maxProperties: 1
                          description: >-
                            An object keyed by scope, containing a set of
                            collections.
                          type: object
                          x-additionalPropertiesName: scopename
                          additionalProperties:
                            description: >-
                              An object keyed by collection name, defines access
                              collections in this scope.
                            type: object
                            x-additionalPropertiesName: collectionname
                            properties:
                              admin_channels:
                                description: >-
                                  A list of channels to explicitly grant to the
                                  user in this collection.
                                type: array
                                items:
                                  type: string
                              all_channels:
                                description: >-
                                  All the channels that the user has been
                                  granted access to in this collection.


                                  Access could have been granted through the
                                  sync function, roles, or explicitly on the
                                  user under the `admin_channels` property.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_channels:
                                description: >-
                                  The channels that the user has been granted
                                  access to through channels_claim for this
                                  collection.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_last_updated:
                                description: >-
                                  The last time that the user's JWT channels
                                  were updated for this collection.
                                type: string
                                format: date-time
                                readOnly: true
                    title: Role
                scopes:
                  description: >-
                    An object keyed by scope name containing config for the
                    specific collection.
                  type: object
                  additionalProperties:
                    x-additionalPropertiesName: scopename
                    description: Scope-specific configuration.
                    type: object
                    properties:
                      collections:
                        description: >-
                          An object keyed by collection name containing config
                          for the specific collection.
                        type: object
                        additionalProperties:
                          x-additionalPropertiesName: collectionname
                          description: Collection-specific configuration.
                          type: object
                          properties:
                            sync:
                              description: >-
                                The Javascript function that newly created
                                documents in this collection are ran through.
                              type: string
                              example: 'function(doc){channel("collection name");}'
                            import_filter:
                              description: >-
                                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.
                              type: string
                              example: >-
                                function(doc) { if (doc.type != 'mobile') {
                                return false; } return true; }
                          title: Collection config
                    title: Scopes
                  maxProperties: 1
                  example:
                    scopename:
                      collections:
                        collectionname1:
                          sync: 'function(doc){channel("collection name");}'
                          import_filter: >-
                            function(doc) { if (doc.type != 'mobile') { return
                            false; } return true; }
                        collectionname2:
                          sync: 'function(doc){channel("collection name");}'
                          import_filter: >-
                            function(doc) { if (doc.type != 'mobile') { return
                            false; } return true; }
                send_www_authenticate_header:
                  description: >-
                    Controls whether to send a `WWW-Authenticate` header in `401
                    Unauthorized` HTTP responses.
                  type: boolean
                  default: true
                serve_insecure_attachment_types:
                  description: >
                    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.
                  type: boolean
                  default: false
                server:
                  description: >-
                    This is the Couchbase Server address or addresses that the
                    database connect to. 
                  type: string
                session_cookie_http_only:
                  description: >-
                    Make all session cookies for the database set the `HttpOnly`
                    flag so they are inaccessible to JavaScript.
                  type: boolean
                  default: false
                session_cookie_name:
                  description: >-
                    This can be used to define a custom per-database session
                    cookie name.
                  type: string
                session_cookie_secure:
                  description: >-
                    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`.
                  type: boolean
                sgreplicate_enabled:
                  description: >-
                    Whether the node should accept assign replications (`true`)
                    or not (`false`).
                  type: boolean
                  default: true
                sgreplicate_websocket_heartbeat_secs:
                  description: >-
                    Use a custom heartbeat interval (in seconds) for websocket
                    ping frames.
                  type: integer
                  default: 300
                slow_query_warning_threshold:
                  description: >-
                    The amount of milliseconds a N1QL query should run before
                    logging a warning. 
                  type: number
                  default: 500
                store_legacy_revtree_data:
                  description: >-
                    Controls whether Sync Gateway stores additional legacy
                    revision tree pointer data to support 3.x/early 4.x clients
                    that still use RevTree IDs (for example when used as delta
                    sources).


                    Disable this when you are confident all clients use newer
                    CV-based revisions and no longer require legacy RevTree ID
                    lookups.
                  type: boolean
                  default: true
                suspendable:
                  description: >-
                    Set to true to allow the database to be suspended.


                    Defaults to true when running in serverless mode otherwise
                    defaults to false.
                  type: boolean
                  default: false
                sync:
                  description: >-
                    The Javascript function that newly created documents are ran
                    through for the default scope and collection.


                    If `scopes` parameter is set, this is ignored.
                  type: string
                  default: 'function(doc){channel(doc.channels);}'
                unsupported:
                  description: >-
                    These are unsupported options and therefore it is not
                    recommended to use them.
                  type: object
                  properties:
                    api_endpoints:
                      type: object
                      properties:
                        enable_couchbase_bucket_flush:
                          description: >-
                            **Setting for test purposes only**


                            Whether Couchbase buckets can be flushed via Admin
                            REST API.
                          type: boolean
                    dcp_read_buffer:
                      description: Set the dcp feed to use a different read buffer size.
                      type: number
                    force_api_forbidden_errors:
                      description: Force REST API errors to return forbidden
                      type: boolean
                    guest_read_only:
                      description: Restrict GUEST document access to read-only.
                      type: boolean
                    kv_buffer:
                      description: Set the kv pool to use a different buffer size.
                      type: number
                    oidc_test_provider:
                      type: object
                      properties:
                        enabled:
                          description: >-
                            Whether the `oidc_test_provider` endpoints should be
                            exposed on the public API.
                          type: boolean
                    oidc_tls_skip_verify:
                      description: Enable self-signed certificates for OIDC testing.
                      type: boolean
                    remote_config_tls_skip_verify:
                      description: >-
                        Enable self-signed certificates for external JavaScript
                        load.
                      type: boolean
                    same_site_cookie:
                      description: >-
                        Override the session cookie SameSite behavior. By
                        default, a session cookie will have SameSite:None if
                        CORS is enabled, and will have no SameSite attribute if
                        CORS is not enabled.  Setting this property to`Default`
                        will omit the SameSite attribute from the cookie.
                      type: string
                      enum:
                        - Default
                        - Lax
                        - None
                        - Strict
                    sgr_tls_skip_verify:
                      description: >-
                        Enable self-signed certificates for SG-replicate
                        testing.
                      type: boolean
                    user_views:
                      type: object
                      properties:
                        enabled:
                          description: >-
                            Whether pass-through view query is supported through
                            public API.
                          type: boolean
                    warning_thresholds:
                      type: object
                      properties:
                        access_and_role_grants_per_doc:
                          description: >-
                            The number of access and role grants per document to
                            be used as a threshold for grant count warnings.
                          type: number
                        channel_name_size:
                          description: >-
                            The number of channel name characters to be used as
                            a threshold for channel name warnings.
                          type: number
                        channels_per_doc:
                          description: >-
                            The number of channels per document to be used as a
                            threshold for the channel count warnings.
                          type: number
                        channels_per_user:
                          description: >-
                            The number of channels per user to be used as a
                            threshold for channel count warnings.
                          type: number
                        xattr_size_bytes:
                          description: >-
                            The number of bytes to be used as a threshold for
                            xattr size limit warnings.
                          type: number
                use_views:
                  description: Force the use of views instead of GSI.
                  type: boolean
                  default: false
                user_xattr_key:
                  description: >-
                    The key to use for the user xattr that will be accessible
                    from the sync function. If empty, the feature will be
                    disabled.


                    This is an Enterprise Edition feature only.
                  type: string
                  maximum: 15
                username:
                  description: The username for authenticating to the server.
                  type: string
                users:
                  additionalProperties:
                    x-additionalPropertiesName: username
                    description: Properties associated with a user
                    type: object
                    properties:
                      name:
                        description: >-
                          The name of the user.


                          User names can only have alphanumeric ASCII characters
                          and underscores.
                        type: string
                      password:
                        description: >-
                          The password of the user.


                          Mandatory. unless `allow_empty_password` is `true` in
                          the database configs.
                        type: string
                      admin_channels:
                        description: >-
                          A list of channels to explicitly grant to the user for
                          the default collection.

                          See `collection_access` for channels in named
                          collections.
                        type: array
                        items:
                          type: string
                      all_channels:
                        description: >-
                          All the channels that the user has been granted access
                          to for the default collection.

                          See `collection_access` for channels in named
                          collections.


                          Access could have been granted through the sync
                          function, roles, or explicitly on the user under the
                          `admin_channels` property.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      email:
                        description: The email address of the user.
                        type: string
                      disabled:
                        description: >-
                          If true, the user will not be able to login to the
                          account as it is disabled.
                        type: boolean
                        default: false
                      admin_roles:
                        description: A list of roles to explicitly grant to the user.
                        type: array
                        items:
                          type: string
                      roles:
                        description: >-
                          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.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_roles:
                        description: >-
                          The roles that the user has been added to through
                          roles_claim.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_channels:
                        description: >-
                          The channels that the user has been granted access to
                          through channels_claim for the default collection.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_issuer:
                        description: >-
                          The issuer of the last JSON Web Token that the user
                          last used to sign in.
                        type: string
                        readOnly: true
                      jwt_last_updated:
                        description: >-
                          The last time that the user's JWT roles/channels were
                          updated.
                        type: string
                        format: date-time
                        readOnly: true
                      collection_access:
                        description: >-
                          A set of access grants by scope and collection for a
                          specific collection.
                        type: object
                        additionalProperties:
                          maxProperties: 1
                          description: >-
                            An object keyed by scope, containing a set of
                            collections.
                          type: object
                          x-additionalPropertiesName: scopename
                          additionalProperties:
                            description: >-
                              An object keyed by collection name, defines access
                              collections in this scope.
                            type: object
                            x-additionalPropertiesName: collectionname
                            properties:
                              admin_channels:
                                description: >-
                                  A list of channels to explicitly grant to the
                                  user in this collection.
                                type: array
                                items:
                                  type: string
                              all_channels:
                                description: >-
                                  All the channels that the user has been
                                  granted access to in this collection.


                                  Access could have been granted through the
                                  sync function, roles, or explicitly on the
                                  user under the `admin_channels` property.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_channels:
                                description: >-
                                  The channels that the user has been granted
                                  access to through channels_claim for this
                                  collection.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_last_updated:
                                description: >-
                                  The last time that the user's JWT channels
                                  were updated for this collection.
                                type: string
                                format: date-time
                                readOnly: true
                    title: User
                view_query_timeout_secs:
                  description: The number of seconds before a view query should timeout.
                  type: integer
                  default: 75
                allow_conflicts:
                  description: >-
                    Since Sync Gateway 4.0, this option has no effect.

                    If this option is set to true on an existing database, the
                    database must be modified to remove this parameter in order
                    allow the database to come online. Otherwise, the database
                    will be in the offline state.
                  type: boolean
                  default: false
                  deprecated: true
                enable_shared_bucket_access:
                  description: >-
                    Since Sync Gateway 4.0, this option has no effect.

                    If this option is set to true on an existing database, the
                    database must be modified to remove this parameter in order
                    allow the database to come online. Otherwise, the database
                    will be in the offline state.
                  type: boolean
                  default: true
                  deprecated: true
                feed_type:
                  description: >-
                    The type of feed to use to communicate with Couchbase
                    Server. This will use DCP regardless of specification.
                  type: string
                  default: DCP
                  enum:
                    - DCP
                  deprecated: true
                num_index_replicas:
                  description: >-
                    **Deprecated, please use the database setting
                    `index.num_replicas` instead**
                  deprecated: true
                  type: number
                  default: 1
                pool:
                  description: This field is unsupported and ignored.
                  type: string
                  default: default
                  deprecated: true
                rev_cache_size:
                  description: >-
                    **Deprecated, please use the database setting
                    `cache.rev_cache.size` instead**


                    The maximum number of revisions to store in the revision
                    cache.
                  type: number
                  deprecated: true
              title: Database-config
      responses:
        '201':
          description: Database created successfully
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '403':
          description: An authentication failure occurred
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '409':
          description: A database already exists for this bucket
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '412':
          description: A database under that name already exists
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '500':
          description: A server error occurred
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  /_all_dbs:
    get:
      summary: Get a list of all the databases
      operationId: get__all_dbs
      tags:
        - Database Management
      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:
        - name: verbose
          in: query
          schema:
            type: boolean
      responses:
        '200':
          description: Successfully retrieved all database names
          content:
            application/json:
              schema:
                oneOf:
                  - title: Simple
                    description: The names of all databases.
                    type: array
                    items:
                      type: string
                    example:
                      - db1
                      - db2
                  - title: Verbose
                    description: Description of all databases.
                    type: array
                    example:
                      - db_name: db1
                        bucket: bucket1
                        state: Online
                        require_resync: false
                        init_in_progress: false
                      - db_name: db2
                        bucket: bucket2
                        state: Starting
                        require_resync: true
                        init_in_progress: true
                    items:
                      type: object
                      properties:
                        db_name:
                          type: string
                          description: The name of the database.
                        bucket:
                          type: string
                          description: >-
                            The Couchbase Server backing bucket for the
                            database.
                        state:
                          allOf:
                            - description: The state of the database.
                              type: string
                              enum:
                                - Online
                                - Offline
                                - Starting
                                - Stopping
                                - Resyncing
                              x-enumDescriptions:
                                Online: The database is online and available for use.
                                Offline: >-
                                  The database is offline, resync and other
                                  offline only endpoints are allowed.
                                Starting: >-
                                  The database is in the process of going
                                  online.
                                Stopping: >-
                                  The database is no longer accepting
                                  connections and is being taken offline or
                                  deleted.
                                Resyncing: >-
                                  The database is offline and performing a
                                  resync operation.
                        require_resync:
                          description: >-
                            Indicates whether the database requires resync
                            before it can be brought online.
                          type: boolean
                          example: true
                        init_in_progress:
                          description: >-
                            Indicates whether database initialization is in
                            progress.
                          type: boolean
                          example: true
  '/{db}/_user/':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: Get all the names of the users
      operationId: get_db-_user-
      tags:
        - Database Security
      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:
        - name: name_only
          in: query
          required: false
          schema:
            type: boolean
            default: true
          description: >-
            Whether to return user names only, or more detailed information for
            each user.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
          description: >-
            How many results to return. Using a value of `0` results in no
            limit.
      responses:
        '200':
          description: Users retrieved successfully
          content:
            application/json:
              schema:
                description: List of users
                type: array
                items:
                  type: string
              example:
                - Alice
                - Bob
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    post:
      summary: Create a new 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
      requestBody:
        content:
          application/json:
            schema:
              description: Properties associated with a user
              type: object
              properties:
                name:
                  description: >-
                    The name of the user.


                    User names can only have alphanumeric ASCII characters and
                    underscores.
                  type: string
                password:
                  description: >-
                    The password of the user.


                    Mandatory. unless `allow_empty_password` is `true` in the
                    database configs.
                  type: string
                admin_channels:
                  description: >-
                    A list of channels to explicitly grant to the user for the
                    default collection.

                    See `collection_access` for channels in named collections.
                  type: array
                  items:
                    type: string
                all_channels:
                  description: >-
                    All the channels that the user has been granted access to
                    for the default collection.

                    See `collection_access` for channels in named collections.


                    Access could have been granted through the sync function,
                    roles, or explicitly on the user under the `admin_channels`
                    property.
                  type: array
                  items:
                    type: string
                  readOnly: true
                email:
                  description: The email address of the user.
                  type: string
                disabled:
                  description: >-
                    If true, the user will not be able to login to the account
                    as it is disabled.
                  type: boolean
                  default: false
                admin_roles:
                  description: A list of roles to explicitly grant to the user.
                  type: array
                  items:
                    type: string
                roles:
                  description: >-
                    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.
                  type: array
                  items:
                    type: string
                  readOnly: true
                jwt_roles:
                  description: >-
                    The roles that the user has been added to through
                    roles_claim.
                  type: array
                  items:
                    type: string
                  readOnly: true
                jwt_channels:
                  description: >-
                    The channels that the user has been granted access to
                    through channels_claim for the default collection.
                  type: array
                  items:
                    type: string
                  readOnly: true
                jwt_issuer:
                  description: >-
                    The issuer of the last JSON Web Token that the user last
                    used to sign in.
                  type: string
                  readOnly: true
                jwt_last_updated:
                  description: >-
                    The last time that the user's JWT roles/channels were
                    updated.
                  type: string
                  format: date-time
                  readOnly: true
                collection_access:
                  description: >-
                    A set of access grants by scope and collection for a
                    specific collection.
                  type: object
                  additionalProperties:
                    maxProperties: 1
                    description: 'An object keyed by scope, containing a set of collections.'
                    type: object
                    x-additionalPropertiesName: scopename
                    additionalProperties:
                      description: >-
                        An object keyed by collection name, defines access
                        collections in this scope.
                      type: object
                      x-additionalPropertiesName: collectionname
                      properties:
                        admin_channels:
                          description: >-
                            A list of channels to explicitly grant to the user
                            in this collection.
                          type: array
                          items:
                            type: string
                        all_channels:
                          description: >-
                            All the channels that the user has been granted
                            access to in this collection.


                            Access could have been granted through the sync
                            function, roles, or explicitly on the user under the
                            `admin_channels` property.
                          type: array
                          items:
                            type: string
                          readOnly: true
                        jwt_channels:
                          description: >-
                            The channels that the user has been granted access
                            to through channels_claim for this collection.
                          type: array
                          items:
                            type: string
                          readOnly: true
                        jwt_last_updated:
                          description: >-
                            The last time that the user's JWT channels were
                            updated for this collection.
                          type: string
                          format: date-time
                          readOnly: true
              title: User
        description: Properties associated with a user
      operationId: post_db-_user-
      tags:
        - Database Security
      responses:
        '201':
          description: New user created successfully
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '409':
          description: Resource already exists under that name
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  '/{db}/_user/{name}':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
      - name: name
        in: path
        required: true
        schema:
          type: string
        description: The name of the user.
    get:
      summary: Get a user
      operationId: get_db-_user-name
      tags:
        - Database Security
      description: |-
        Retrieve a single users information.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Architect
        * Sync Gateway Application
        * Sync Gateway Application Read Only
      responses:
        '200':
          description: Properties associated with a user
          content:
            application/json:
              schema:
                description: Properties associated with a user
                type: object
                properties:
                  name:
                    description: >-
                      The name of the user.


                      User names can only have alphanumeric ASCII characters and
                      underscores.
                    type: string
                  password:
                    description: >-
                      The password of the user.


                      Mandatory. unless `allow_empty_password` is `true` in the
                      database configs.
                    type: string
                  admin_channels:
                    description: >-
                      A list of channels to explicitly grant to the user for the
                      default collection.

                      See `collection_access` for channels in named collections.
                    type: array
                    items:
                      type: string
                  all_channels:
                    description: >-
                      All the channels that the user has been granted access to
                      for the default collection.

                      See `collection_access` for channels in named collections.


                      Access could have been granted through the sync function,
                      roles, or explicitly on the user under the
                      `admin_channels` property.
                    type: array
                    items:
                      type: string
                    readOnly: true
                  email:
                    description: The email address of the user.
                    type: string
                  disabled:
                    description: >-
                      If true, the user will not be able to login to the account
                      as it is disabled.
                    type: boolean
                    default: false
                  admin_roles:
                    description: A list of roles to explicitly grant to the user.
                    type: array
                    items:
                      type: string
                  roles:
                    description: >-
                      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.
                    type: array
                    items:
                      type: string
                    readOnly: true
                  jwt_roles:
                    description: >-
                      The roles that the user has been added to through
                      roles_claim.
                    type: array
                    items:
                      type: string
                    readOnly: true
                  jwt_channels:
                    description: >-
                      The channels that the user has been granted access to
                      through channels_claim for the default collection.
                    type: array
                    items:
                      type: string
                    readOnly: true
                  jwt_issuer:
                    description: >-
                      The issuer of the last JSON Web Token that the user last
                      used to sign in.
                    type: string
                    readOnly: true
                  jwt_last_updated:
                    description: >-
                      The last time that the user's JWT roles/channels were
                      updated.
                    type: string
                    format: date-time
                    readOnly: true
                  collection_access:
                    description: >-
                      A set of access grants by scope and collection for a
                      specific collection.
                    type: object
                    additionalProperties:
                      maxProperties: 1
                      description: >-
                        An object keyed by scope, containing a set of
                        collections.
                      type: object
                      x-additionalPropertiesName: scopename
                      additionalProperties:
                        description: >-
                          An object keyed by collection name, defines access
                          collections in this scope.
                        type: object
                        x-additionalPropertiesName: collectionname
                        properties:
                          admin_channels:
                            description: >-
                              A list of channels to explicitly grant to the user
                              in this collection.
                            type: array
                            items:
                              type: string
                          all_channels:
                            description: >-
                              All the channels that the user has been granted
                              access to in this collection.


                              Access could have been granted through the sync
                              function, roles, or explicitly on the user under
                              the `admin_channels` property.
                            type: array
                            items:
                              type: string
                            readOnly: true
                          jwt_channels:
                            description: >-
                              The channels that the user has been granted access
                              to through channels_claim for this collection.
                            type: array
                            items:
                              type: string
                            readOnly: true
                          jwt_last_updated:
                            description: >-
                              The last time that the user's JWT channels were
                              updated for this collection.
                            type: string
                            format: date-time
                            readOnly: true
                title: User
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    put:
      summary: Upsert a user
      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
      requestBody:
        content:
          application/json:
            schema:
              description: Properties associated with a user
              type: object
              properties:
                name:
                  description: >-
                    The name of the user.


                    User names can only have alphanumeric ASCII characters and
                    underscores.
                  type: string
                password:
                  description: >-
                    The password of the user.


                    Mandatory. unless `allow_empty_password` is `true` in the
                    database configs.
                  type: string
                admin_channels:
                  description: >-
                    A list of channels to explicitly grant to the user for the
                    default collection.

                    See `collection_access` for channels in named collections.
                  type: array
                  items:
                    type: string
                all_channels:
                  description: >-
                    All the channels that the user has been granted access to
                    for the default collection.

                    See `collection_access` for channels in named collections.


                    Access could have been granted through the sync function,
                    roles, or explicitly on the user under the `admin_channels`
                    property.
                  type: array
                  items:
                    type: string
                  readOnly: true
                email:
                  description: The email address of the user.
                  type: string
                disabled:
                  description: >-
                    If true, the user will not be able to login to the account
                    as it is disabled.
                  type: boolean
                  default: false
                admin_roles:
                  description: A list of roles to explicitly grant to the user.
                  type: array
                  items:
                    type: string
                roles:
                  description: >-
                    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.
                  type: array
                  items:
                    type: string
                  readOnly: true
                jwt_roles:
                  description: >-
                    The roles that the user has been added to through
                    roles_claim.
                  type: array
                  items:
                    type: string
                  readOnly: true
                jwt_channels:
                  description: >-
                    The channels that the user has been granted access to
                    through channels_claim for the default collection.
                  type: array
                  items:
                    type: string
                  readOnly: true
                jwt_issuer:
                  description: >-
                    The issuer of the last JSON Web Token that the user last
                    used to sign in.
                  type: string
                  readOnly: true
                jwt_last_updated:
                  description: >-
                    The last time that the user's JWT roles/channels were
                    updated.
                  type: string
                  format: date-time
                  readOnly: true
                collection_access:
                  description: >-
                    A set of access grants by scope and collection for a
                    specific collection.
                  type: object
                  additionalProperties:
                    maxProperties: 1
                    description: 'An object keyed by scope, containing a set of collections.'
                    type: object
                    x-additionalPropertiesName: scopename
                    additionalProperties:
                      description: >-
                        An object keyed by collection name, defines access
                        collections in this scope.
                      type: object
                      x-additionalPropertiesName: collectionname
                      properties:
                        admin_channels:
                          description: >-
                            A list of channels to explicitly grant to the user
                            in this collection.
                          type: array
                          items:
                            type: string
                        all_channels:
                          description: >-
                            All the channels that the user has been granted
                            access to in this collection.


                            Access could have been granted through the sync
                            function, roles, or explicitly on the user under the
                            `admin_channels` property.
                          type: array
                          items:
                            type: string
                          readOnly: true
                        jwt_channels:
                          description: >-
                            The channels that the user has been granted access
                            to through channels_claim for this collection.
                          type: array
                          items:
                            type: string
                          readOnly: true
                        jwt_last_updated:
                          description: >-
                            The last time that the user's JWT channels were
                            updated for this collection.
                          type: string
                          format: date-time
                          readOnly: true
              title: User
        description: Properties associated with a user
      operationId: put_db-_user-name
      tags:
        - Database Security
      responses:
        '200':
          description: Existing user modified successfully
        '201':
          description: New user created
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    delete:
      summary: Delete a user
      operationId: delete_db-_user-name
      tags:
        - Database Security
      description: |-
        Delete a user from the database.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Architect
        * Sync Gateway Application
      responses:
        '200':
          description: User deleted successfully
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    head:
      summary: Check if user exists
      operationId: head_db-_user-name
      tags:
        - Database Security
      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
      responses:
        '200':
          description: User exists
        '404':
          description: Not Found
  '/{db}/_user/{name}/_session':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
      - name: name
        in: path
        required: true
        schema:
          type: string
        description: The name of the user.
    delete:
      summary: Remove all of a users sessions
      operationId: delete_db-_user-name-_session
      tags:
        - 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
      responses:
        '200':
          description: User now has no sessions
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_user/{name}/_session/{sessionid}':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
      - name: name
        in: path
        required: true
        schema:
          type: string
        description: The name of the user.
      - name: sessionid
        in: path
        required: true
        schema:
          type: string
        description: The ID of the session to target.
    delete:
      summary: Remove session with user validation
      operationId: delete_db-_user-name-_session-sessionid
      tags:
        - Session
      description: |-
        Invalidates the session only if it belongs to the user.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Architect
        * Sync Gateway Application
      responses:
        '200':
          description: >-
            Session has been successfully removed as the user was associated
            with the session
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_role/':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: Get all names of the roles
      operationId: get_db-_role-
      tags:
        - Database Security
      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:
        - name: deleted
          in: query
          description: >-
            Indicates that roles marked as deleted should be included in the
            result.
          schema:
            type: boolean
            default: false
            enum:
              - true
              - false
      responses:
        '200':
          description: Roles retrieved successfully
          content:
            application/json:
              schema:
                description: List of all role names
                type: array
                items:
                  type: string
                minItems: 0
                uniqueItems: true
              example:
                - Administrator
                - Moderator
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    post:
      summary: Create a new 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
      requestBody:
        content:
          application/json:
            schema:
              description: Properties associated with a role
              type: object
              properties:
                name:
                  description: >-
                    The name of the role.


                    Role names can only have alphanumeric ASCII characters and
                    underscores.
                  type: string
                admin_channels:
                  description: >-
                    A list of channels to explicitly grant to the role for the
                    default collection.

                    See `collection_access` for channels in named collections.
                  type: array
                  items:
                    type: string
                all_channels:
                  description: >-
                    All the channels that the role has been granted access to
                    for the default collection.


                    These channels could have been assigned by the Sync function
                    or using the `admin_channels` property.
                  type: array
                  items:
                    type: string
                  readOnly: true
                collection_access:
                  description: >-
                    A set of access grants by scope and collection for a
                    specific collection.
                  type: object
                  additionalProperties:
                    maxProperties: 1
                    description: 'An object keyed by scope, containing a set of collections.'
                    type: object
                    x-additionalPropertiesName: scopename
                    additionalProperties:
                      description: >-
                        An object keyed by collection name, defines access
                        collections in this scope.
                      type: object
                      x-additionalPropertiesName: collectionname
                      properties:
                        admin_channels:
                          description: >-
                            A list of channels to explicitly grant to the user
                            in this collection.
                          type: array
                          items:
                            type: string
                        all_channels:
                          description: >-
                            All the channels that the user has been granted
                            access to in this collection.


                            Access could have been granted through the sync
                            function, roles, or explicitly on the user under the
                            `admin_channels` property.
                          type: array
                          items:
                            type: string
                          readOnly: true
                        jwt_channels:
                          description: >-
                            The channels that the user has been granted access
                            to through channels_claim for this collection.
                          type: array
                          items:
                            type: string
                          readOnly: true
                        jwt_last_updated:
                          description: >-
                            The last time that the user's JWT channels were
                            updated for this collection.
                          type: string
                          format: date-time
                          readOnly: true
              title: Role
        description: Properties associated with a role
      operationId: post_db-_role-
      tags:
        - Database Security
      responses:
        '201':
          description: New role created successfully
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '409':
          description: Resource already exists under that name
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  '/{db}/_role/{name}':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
      - name: name
        in: path
        required: true
        schema:
          type: string
        description: The name of the role.
    get:
      summary: Get a role
      operationId: get_db-_role-name
      tags:
        - Database Security
      description: |-
        Retrieve a single roles properties.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Architect
        * Sync Gateway Application
        * Sync Gateway Application Read Only
      responses:
        '200':
          description: Properties associated with a role
          content:
            application/json:
              schema:
                description: Properties associated with a role
                type: object
                properties:
                  name:
                    description: >-
                      The name of the role.


                      Role names can only have alphanumeric ASCII characters and
                      underscores.
                    type: string
                  admin_channels:
                    description: >-
                      A list of channels to explicitly grant to the role for the
                      default collection.

                      See `collection_access` for channels in named collections.
                    type: array
                    items:
                      type: string
                  all_channels:
                    description: >-
                      All the channels that the role has been granted access to
                      for the default collection.


                      These channels could have been assigned by the Sync
                      function or using the `admin_channels` property.
                    type: array
                    items:
                      type: string
                    readOnly: true
                  collection_access:
                    description: >-
                      A set of access grants by scope and collection for a
                      specific collection.
                    type: object
                    additionalProperties:
                      maxProperties: 1
                      description: >-
                        An object keyed by scope, containing a set of
                        collections.
                      type: object
                      x-additionalPropertiesName: scopename
                      additionalProperties:
                        description: >-
                          An object keyed by collection name, defines access
                          collections in this scope.
                        type: object
                        x-additionalPropertiesName: collectionname
                        properties:
                          admin_channels:
                            description: >-
                              A list of channels to explicitly grant to the user
                              in this collection.
                            type: array
                            items:
                              type: string
                          all_channels:
                            description: >-
                              All the channels that the user has been granted
                              access to in this collection.


                              Access could have been granted through the sync
                              function, roles, or explicitly on the user under
                              the `admin_channels` property.
                            type: array
                            items:
                              type: string
                            readOnly: true
                          jwt_channels:
                            description: >-
                              The channels that the user has been granted access
                              to through channels_claim for this collection.
                            type: array
                            items:
                              type: string
                            readOnly: true
                          jwt_last_updated:
                            description: >-
                              The last time that the user's JWT channels were
                              updated for this collection.
                            type: string
                            format: date-time
                            readOnly: true
                title: Role
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    put:
      summary: Upsert a role
      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
      requestBody:
        content:
          application/json:
            schema:
              description: Properties associated with a role
              type: object
              properties:
                name:
                  description: >-
                    The name of the role.


                    Role names can only have alphanumeric ASCII characters and
                    underscores.
                  type: string
                admin_channels:
                  description: >-
                    A list of channels to explicitly grant to the role for the
                    default collection.

                    See `collection_access` for channels in named collections.
                  type: array
                  items:
                    type: string
                all_channels:
                  description: >-
                    All the channels that the role has been granted access to
                    for the default collection.


                    These channels could have been assigned by the Sync function
                    or using the `admin_channels` property.
                  type: array
                  items:
                    type: string
                  readOnly: true
                collection_access:
                  description: >-
                    A set of access grants by scope and collection for a
                    specific collection.
                  type: object
                  additionalProperties:
                    maxProperties: 1
                    description: 'An object keyed by scope, containing a set of collections.'
                    type: object
                    x-additionalPropertiesName: scopename
                    additionalProperties:
                      description: >-
                        An object keyed by collection name, defines access
                        collections in this scope.
                      type: object
                      x-additionalPropertiesName: collectionname
                      properties:
                        admin_channels:
                          description: >-
                            A list of channels to explicitly grant to the user
                            in this collection.
                          type: array
                          items:
                            type: string
                        all_channels:
                          description: >-
                            All the channels that the user has been granted
                            access to in this collection.


                            Access could have been granted through the sync
                            function, roles, or explicitly on the user under the
                            `admin_channels` property.
                          type: array
                          items:
                            type: string
                          readOnly: true
                        jwt_channels:
                          description: >-
                            The channels that the user has been granted access
                            to through channels_claim for this collection.
                          type: array
                          items:
                            type: string
                          readOnly: true
                        jwt_last_updated:
                          description: >-
                            The last time that the user's JWT channels were
                            updated for this collection.
                          type: string
                          format: date-time
                          readOnly: true
              title: Role
        description: Properties associated with a role
      operationId: put_db-_role-name
      tags:
        - Database Security
      responses:
        '200':
          description: OK
        '201':
          description: Created
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    delete:
      summary: Delete a role
      operationId: delete_db-_role-name
      tags:
        - Database Security
      description: |-
        Delete a role from the database.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Architect
        * Sync Gateway Application
      responses:
        '200':
          description: OK
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    head:
      summary: Check if role exists
      operationId: head_db-_role-name
      tags:
        - Database Security
      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
      responses:
        '200':
          description: Role exists
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_replication/':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: Get all replication configurations
      operationId: get_db-_replication-
      tags:
        - Replication
      description: |-
        This will retrieve all database replication definitions.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Replicator
      responses:
        '200':
          description: >-
            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.
          content:
            application/json:
              schema:
                description: >-
                  Contains all the replication IDs with their corresponding
                  replication configurations
                type: object
                properties:
                  replication_id:
                    description: Properties of a replication
                    allOf:
                      - type: object
                        properties:
                          replication_id:
                            description: This is the ID of the replication.
                            type: string
                      - description: Properties of a replication
                        type: object
                        x-requirePropertiesSorted: true
                        properties:
                          adhoc:
                            description: >-
                              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.
                            type: boolean
                            default: false
                          batch_size:
                            description: >-
                              The amount of changes to be sent in one batch of
                              replications. Changing this is an Enterprise
                              Edition only feature.
                            type: integer
                            default: 200
                          collections_enabled:
                            description: >-
                              If true, the replicator will run with collections,
                              and will replicate all collections, unless
                              otherwise limited by `collections_local`.


                              If false, the replicator will only replicate the
                              default collection.
                            type: boolean
                            default: false
                          collections_local:
                            description: >-
                              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.
                            type: array
                            items:
                              type: string
                            example:
                              - scope1.collection1
                              - scope1.collection3
                              - scope1.collection6
                            default: []
                          collections_remote:
                            description: >-
                              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.
                            type: array
                            items:
                              type: string
                              nullable: true
                            example:
                              - scope1.collectionA
                              - null
                              - scope1.collectionF
                            default: []
                          conflict_resolution_type:
                            description: >-
                              This defines what conflict resolution policy Sync
                              Gateway should use to apply when resolving
                              conflicting revisions.


                              Changing this is an Enterprise Edition only
                              feature.
                            type: string
                            default: default
                            enum:
                              - default
                              - remoteWins
                              - localWins
                              - custom
                            x-enumDescriptions:
                              default: |-
                                This will use:
                                  - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                                  - The revision with the most recent timestamp wins.
                                  - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                              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.
                          continuous:
                            description: >-
                              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.
                            type: boolean
                            default: false
                          custom_conflict_resolver:
                            description: >-
                              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 document's
                              body. This can be the winning revision (for
                              example, `return conflict.LocalDocument`), a new
                              body, or `nil` to resolve as a delete.


                              Example:


                              ```javascript

                              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.


                              If a document merge is being done, the `_rev` and
                              `_cv` properties should not be included in the
                              returned document body as Sync Gateway will
                              generate new values for these.


                              This is an Enterprise Edition only feature.
                            type: string
                            default: ''
                          direction:
                            description: >-
                              This specifies which direction the replication
                              will be replicating with the `remote` replicator.
                            type: string
                            enum:
                              - push
                              - pull
                              - pushAndPull
                            x-enumDescriptions:
                              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
                          enable_delta_sync:
                            description: >-
                              This will turn on delta-sync for the replication.
                              In order to enable delta-sync for a replication,
                              the database level setting `delta_sync.enabled`
                              must also be set to true.


                              Using delta-sync is an Enterprise Edition only
                              feature.
                            type: boolean
                            default: false
                          filter:
                            description: This defines whether to filter documents.
                            type: string
                            enum:
                              - sync_gateway/bychannel
                              - ''
                            x-enumDescriptions:
                              '': Do not filter any documents.
                              sync_gateway/bychannel: >-
                                If set, a pull replication will be limited to a
                                specific set of channels specified by the
                                `query_param.channels` property.
                          initial_state:
                            description: >-
                              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`.
                            type: string
                            default: running
                            enum:
                              - running
                              - stopped
                            x-enumDescriptions:
                              running: The replication will immediately start running.
                              stopped: >-
                                The replication configuration will be created
                                but the replication will not start running until
                                the user explicitly starts it.
                          max_backoff_time:
                            description: >-
                              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.
                            type: integer
                            default: 5
                          purge_on_removal:
                            description: >-
                              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.
                            type: boolean
                            default: false
                          query_params:
                            description: >-
                              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:

                              ```json

                              "filter":"sync_gateway/bychannel",

                              "query_params": {
                                "channels":["chanUser1"]
                              },

                              ```
                            type: array
                            items:
                              type: string
                          remote:
                            description: >-
                              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,
                              `https://localhost:4985/db`.
                            type: string
                          remote_password:
                            description: >-
                              The password to use to authenticate with the
                              remote. This password will be redacted in the
                              replication config.
                            type: string
                          remote_username:
                            description: >-
                              The username to use to authenticate with the
                              remote.
                            type: string
                          replication_id:
                            description: >-
                              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.
                            type: string
                            maximum: 160
                          run_as:
                            description: >-
                              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.
                            type: string
                          password:
                            description: >-
                              **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.
                            type: string
                            deprecated: true
                          username:
                            description: >-
                              **This has been deprecated in favour of
                              `remote_username`.**


                              This is the username to use to authenticate with
                              the remote.
                            type: string
                            deprecated: true
                        required:
                          - direction
                        title: User configurable replication properties
                      - type: object
                        properties:
                          assigned_node:
                            description: >-
                              The unique ID of the node assigned to the
                              replication.
                            type: string
                          target_state:
                            description: >-
                              This is the state that the replicator is in or
                              that trying to transition in to.
                            type: string
                            enum:
                              - running
                              - stopped
                              - resetting
                              - error
                              - starting
                              - reconnecting
                            x-enumDescriptions:
                              running: Currently running replication.
                              stopped: Not running replication.
                              resetting: The replication is resetting its state.
                              error: The replication is stopped due to an error.
                              starting: The replication is starting up.
                              reconnecting: >-
                                The replication is reconnecting to the remote
                                database.
                            title: Replication Status
                          cluster_uuid:
                            description: The cluster unique identifier.
                            type: string
                    title: Replication
                title: All replications
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    post:
      summary: Upsert a 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
      requestBody:
        content:
          application/json:
            schema:
              description: Properties of a replication
              type: object
              x-requirePropertiesSorted: true
              properties:
                adhoc:
                  description: >-
                    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.
                  type: boolean
                  default: false
                batch_size:
                  description: >-
                    The amount of changes to be sent in one batch of
                    replications. Changing this is an Enterprise Edition only
                    feature.
                  type: integer
                  default: 200
                collections_enabled:
                  description: >-
                    If true, the replicator will run with collections, and will
                    replicate all collections, unless otherwise limited by
                    `collections_local`.


                    If false, the replicator will only replicate the default
                    collection.
                  type: boolean
                  default: false
                collections_local:
                  description: >-
                    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.
                  type: array
                  items:
                    type: string
                  example:
                    - scope1.collection1
                    - scope1.collection3
                    - scope1.collection6
                  default: []
                collections_remote:
                  description: >-
                    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.
                  type: array
                  items:
                    type: string
                    nullable: true
                  example:
                    - scope1.collectionA
                    - null
                    - scope1.collectionF
                  default: []
                conflict_resolution_type:
                  description: >-
                    This defines what conflict resolution policy Sync Gateway
                    should use to apply when resolving conflicting revisions.


                    Changing this is an Enterprise Edition only feature.
                  type: string
                  default: default
                  enum:
                    - default
                    - remoteWins
                    - localWins
                    - custom
                  x-enumDescriptions:
                    default: |-
                      This will use:
                        - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                        - The revision with the most recent timestamp wins.
                        - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                    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.
                continuous:
                  description: >-
                    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.
                  type: boolean
                  default: false
                custom_conflict_resolver:
                  description: >-
                    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 document's body. This can
                    be the winning revision (for example, `return
                    conflict.LocalDocument`), a new body, or `nil` to resolve as
                    a delete.


                    Example:


                    ```javascript

                    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.


                    If a document merge is being done, the `_rev` and `_cv`
                    properties should not be included in the returned document
                    body as Sync Gateway will generate new values for these.


                    This is an Enterprise Edition only feature.
                  type: string
                  default: ''
                direction:
                  description: >-
                    This specifies which direction the replication will be
                    replicating with the `remote` replicator.
                  type: string
                  enum:
                    - push
                    - pull
                    - pushAndPull
                  x-enumDescriptions:
                    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
                enable_delta_sync:
                  description: >-
                    This will turn on delta-sync for the replication. In order
                    to enable delta-sync for a replication, the database level
                    setting `delta_sync.enabled` must also be set to true.


                    Using delta-sync is an Enterprise Edition only feature.
                  type: boolean
                  default: false
                filter:
                  description: This defines whether to filter documents.
                  type: string
                  enum:
                    - sync_gateway/bychannel
                    - ''
                  x-enumDescriptions:
                    '': Do not filter any documents.
                    sync_gateway/bychannel: >-
                      If set, a pull replication will be limited to a specific
                      set of channels specified by the `query_param.channels`
                      property.
                initial_state:
                  description: >-
                    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`.
                  type: string
                  default: running
                  enum:
                    - running
                    - stopped
                  x-enumDescriptions:
                    running: The replication will immediately start running.
                    stopped: >-
                      The replication configuration will be created but the
                      replication will not start running until the user
                      explicitly starts it.
                max_backoff_time:
                  description: >-
                    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.
                  type: integer
                  default: 5
                purge_on_removal:
                  description: >-
                    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.
                  type: boolean
                  default: false
                query_params:
                  description: >-
                    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:

                    ```json

                    "filter":"sync_gateway/bychannel",

                    "query_params": {
                      "channels":["chanUser1"]
                    },

                    ```
                  type: array
                  items:
                    type: string
                remote:
                  description: >-
                    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, `https://localhost:4985/db`.
                  type: string
                remote_password:
                  description: >-
                    The password to use to authenticate with the remote. This
                    password will be redacted in the replication config.
                  type: string
                remote_username:
                  description: The username to use to authenticate with the remote.
                  type: string
                replication_id:
                  description: >-
                    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.
                  type: string
                  maximum: 160
                run_as:
                  description: >-
                    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.
                  type: string
                password:
                  description: >-
                    **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.
                  type: string
                  deprecated: true
                username:
                  description: |-
                    **This has been deprecated in favour of `remote_username`.**

                    This is the username to use to authenticate with the remote.
                  type: string
                  deprecated: true
              required:
                - direction
              title: User configurable replication properties
        description: >-
          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.
      operationId: post_db-_replication-
      tags:
        - Replication
      responses:
        '200':
          description: Updated existing configuration successfully
        '201':
          description: Created new replication successfully
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_replication/{replicationid}':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
      - name: replicationid
        in: path
        required: true
        schema:
          type: string
          minimum: 1
          maximum: 160
        description: What replication to target based on its replication ID.
    get:
      summary: Get a replication configuration
      operationId: get_db-_replication-replicationid
      tags:
        - Replication
      description: |-
        Retrieve a replication configuration from the database.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Replicator
      responses:
        '200':
          description: Successfully retrieved the replication configuration
          content:
            application/json:
              schema:
                description: Properties of a replication
                allOf:
                  - type: object
                    properties:
                      replication_id:
                        description: This is the ID of the replication.
                        type: string
                  - description: Properties of a replication
                    type: object
                    x-requirePropertiesSorted: true
                    properties:
                      adhoc:
                        description: >-
                          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.
                        type: boolean
                        default: false
                      batch_size:
                        description: >-
                          The amount of changes to be sent in one batch of
                          replications. Changing this is an Enterprise Edition
                          only feature.
                        type: integer
                        default: 200
                      collections_enabled:
                        description: >-
                          If true, the replicator will run with collections, and
                          will replicate all collections, unless otherwise
                          limited by `collections_local`.


                          If false, the replicator will only replicate the
                          default collection.
                        type: boolean
                        default: false
                      collections_local:
                        description: >-
                          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.
                        type: array
                        items:
                          type: string
                        example:
                          - scope1.collection1
                          - scope1.collection3
                          - scope1.collection6
                        default: []
                      collections_remote:
                        description: >-
                          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.
                        type: array
                        items:
                          type: string
                          nullable: true
                        example:
                          - scope1.collectionA
                          - null
                          - scope1.collectionF
                        default: []
                      conflict_resolution_type:
                        description: >-
                          This defines what conflict resolution policy Sync
                          Gateway should use to apply when resolving conflicting
                          revisions.


                          Changing this is an Enterprise Edition only feature.
                        type: string
                        default: default
                        enum:
                          - default
                          - remoteWins
                          - localWins
                          - custom
                        x-enumDescriptions:
                          default: |-
                            This will use:
                              - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                              - The revision with the most recent timestamp wins.
                              - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                          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.
                      continuous:
                        description: >-
                          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.
                        type: boolean
                        default: false
                      custom_conflict_resolver:
                        description: >-
                          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 document's body.
                          This can be the winning revision (for example, `return
                          conflict.LocalDocument`), a new body, or `nil` to
                          resolve as a delete.


                          Example:


                          ```javascript

                          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.


                          If a document merge is being done, the `_rev` and
                          `_cv` properties should not be included in the
                          returned document body as Sync Gateway will generate
                          new values for these.


                          This is an Enterprise Edition only feature.
                        type: string
                        default: ''
                      direction:
                        description: >-
                          This specifies which direction the replication will be
                          replicating with the `remote` replicator.
                        type: string
                        enum:
                          - push
                          - pull
                          - pushAndPull
                        x-enumDescriptions:
                          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
                      enable_delta_sync:
                        description: >-
                          This will turn on delta-sync for the replication. In
                          order to enable delta-sync for a replication, the
                          database level setting `delta_sync.enabled` must also
                          be set to true.


                          Using delta-sync is an Enterprise Edition only
                          feature.
                        type: boolean
                        default: false
                      filter:
                        description: This defines whether to filter documents.
                        type: string
                        enum:
                          - sync_gateway/bychannel
                          - ''
                        x-enumDescriptions:
                          '': Do not filter any documents.
                          sync_gateway/bychannel: >-
                            If set, a pull replication will be limited to a
                            specific set of channels specified by the
                            `query_param.channels` property.
                      initial_state:
                        description: >-
                          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`.
                        type: string
                        default: running
                        enum:
                          - running
                          - stopped
                        x-enumDescriptions:
                          running: The replication will immediately start running.
                          stopped: >-
                            The replication configuration will be created but
                            the replication will not start running until the
                            user explicitly starts it.
                      max_backoff_time:
                        description: >-
                          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.
                        type: integer
                        default: 5
                      purge_on_removal:
                        description: >-
                          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.
                        type: boolean
                        default: false
                      query_params:
                        description: >-
                          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:

                          ```json

                          "filter":"sync_gateway/bychannel",

                          "query_params": {
                            "channels":["chanUser1"]
                          },

                          ```
                        type: array
                        items:
                          type: string
                      remote:
                        description: >-
                          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,
                          `https://localhost:4985/db`.
                        type: string
                      remote_password:
                        description: >-
                          The password to use to authenticate with the remote.
                          This password will be redacted in the replication
                          config.
                        type: string
                      remote_username:
                        description: The username to use to authenticate with the remote.
                        type: string
                      replication_id:
                        description: >-
                          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.
                        type: string
                        maximum: 160
                      run_as:
                        description: >-
                          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.
                        type: string
                      password:
                        description: >-
                          **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.
                        type: string
                        deprecated: true
                      username:
                        description: >-
                          **This has been deprecated in favour of
                          `remote_username`.**


                          This is the username to use to authenticate with the
                          remote.
                        type: string
                        deprecated: true
                    required:
                      - direction
                    title: User configurable replication properties
                  - type: object
                    properties:
                      assigned_node:
                        description: The unique ID of the node assigned to the replication.
                        type: string
                      target_state:
                        description: >-
                          This is the state that the replicator is in or that
                          trying to transition in to.
                        type: string
                        enum:
                          - running
                          - stopped
                          - resetting
                          - error
                          - starting
                          - reconnecting
                        x-enumDescriptions:
                          running: Currently running replication.
                          stopped: Not running replication.
                          resetting: The replication is resetting its state.
                          error: The replication is stopped due to an error.
                          starting: The replication is starting up.
                          reconnecting: >-
                            The replication is reconnecting to the remote
                            database.
                        title: Replication Status
                      cluster_uuid:
                        description: The cluster unique identifier.
                        type: string
                title: Replication
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    put:
      summary: Upsert a replication
      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
      requestBody:
        content:
          application/json:
            schema:
              description: Properties of a replication
              type: object
              x-requirePropertiesSorted: true
              properties:
                adhoc:
                  description: >-
                    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.
                  type: boolean
                  default: false
                batch_size:
                  description: >-
                    The amount of changes to be sent in one batch of
                    replications. Changing this is an Enterprise Edition only
                    feature.
                  type: integer
                  default: 200
                collections_enabled:
                  description: >-
                    If true, the replicator will run with collections, and will
                    replicate all collections, unless otherwise limited by
                    `collections_local`.


                    If false, the replicator will only replicate the default
                    collection.
                  type: boolean
                  default: false
                collections_local:
                  description: >-
                    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.
                  type: array
                  items:
                    type: string
                  example:
                    - scope1.collection1
                    - scope1.collection3
                    - scope1.collection6
                  default: []
                collections_remote:
                  description: >-
                    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.
                  type: array
                  items:
                    type: string
                    nullable: true
                  example:
                    - scope1.collectionA
                    - null
                    - scope1.collectionF
                  default: []
                conflict_resolution_type:
                  description: >-
                    This defines what conflict resolution policy Sync Gateway
                    should use to apply when resolving conflicting revisions.


                    Changing this is an Enterprise Edition only feature.
                  type: string
                  default: default
                  enum:
                    - default
                    - remoteWins
                    - localWins
                    - custom
                  x-enumDescriptions:
                    default: |-
                      This will use:
                        - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                        - The revision with the most recent timestamp wins.
                        - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                    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.
                continuous:
                  description: >-
                    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.
                  type: boolean
                  default: false
                custom_conflict_resolver:
                  description: >-
                    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 document's body. This can
                    be the winning revision (for example, `return
                    conflict.LocalDocument`), a new body, or `nil` to resolve as
                    a delete.


                    Example:


                    ```javascript

                    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.


                    If a document merge is being done, the `_rev` and `_cv`
                    properties should not be included in the returned document
                    body as Sync Gateway will generate new values for these.


                    This is an Enterprise Edition only feature.
                  type: string
                  default: ''
                direction:
                  description: >-
                    This specifies which direction the replication will be
                    replicating with the `remote` replicator.
                  type: string
                  enum:
                    - push
                    - pull
                    - pushAndPull
                  x-enumDescriptions:
                    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
                enable_delta_sync:
                  description: >-
                    This will turn on delta-sync for the replication. In order
                    to enable delta-sync for a replication, the database level
                    setting `delta_sync.enabled` must also be set to true.


                    Using delta-sync is an Enterprise Edition only feature.
                  type: boolean
                  default: false
                filter:
                  description: This defines whether to filter documents.
                  type: string
                  enum:
                    - sync_gateway/bychannel
                    - ''
                  x-enumDescriptions:
                    '': Do not filter any documents.
                    sync_gateway/bychannel: >-
                      If set, a pull replication will be limited to a specific
                      set of channels specified by the `query_param.channels`
                      property.
                initial_state:
                  description: >-
                    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`.
                  type: string
                  default: running
                  enum:
                    - running
                    - stopped
                  x-enumDescriptions:
                    running: The replication will immediately start running.
                    stopped: >-
                      The replication configuration will be created but the
                      replication will not start running until the user
                      explicitly starts it.
                max_backoff_time:
                  description: >-
                    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.
                  type: integer
                  default: 5
                purge_on_removal:
                  description: >-
                    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.
                  type: boolean
                  default: false
                query_params:
                  description: >-
                    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:

                    ```json

                    "filter":"sync_gateway/bychannel",

                    "query_params": {
                      "channels":["chanUser1"]
                    },

                    ```
                  type: array
                  items:
                    type: string
                remote:
                  description: >-
                    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, `https://localhost:4985/db`.
                  type: string
                remote_password:
                  description: >-
                    The password to use to authenticate with the remote. This
                    password will be redacted in the replication config.
                  type: string
                remote_username:
                  description: The username to use to authenticate with the remote.
                  type: string
                replication_id:
                  description: >-
                    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.
                  type: string
                  maximum: 160
                run_as:
                  description: >-
                    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.
                  type: string
                password:
                  description: >-
                    **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.
                  type: string
                  deprecated: true
                username:
                  description: |-
                    **This has been deprecated in favour of `remote_username`.**

                    This is the username to use to authenticate with the remote.
                  type: string
                  deprecated: true
              required:
                - direction
              title: User configurable replication properties
        description: >-
          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.
      operationId: put_db-_replication-replicationid
      tags:
        - Replication
      responses:
        '200':
          description: Updated existing configuration successfully
        '201':
          description: Created new replication successfully
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    delete:
      summary: Stop and delete a replication
      operationId: delete_db-_replication-replicationid
      tags:
        - Replication
      description: |-
        This will delete a replication causing it to stop and no longer exist.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Replicator
      responses:
        '200':
          description: Replication successfully deleted
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    head:
      summary: Check if a replication exists
      operationId: head_db-_replication-replicationid
      tags:
        - Replication
      description: |-
        Check if a replication exists.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Replicator
      responses:
        '200':
          description: Replication exists
        '404':
          description: Replication does not exist
  '/{db}/_replicationStatus/':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: Get all replication statuses
      operationId: get_db-_replicationStatus-
      tags:
        - Replication
      description: |-
        Retrieve all the replication statuses in the Sync Gateway node.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Replicator
      parameters:
        - name: activeOnly
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Only return replications that are actively running
            (`state=running`).
        - name: localOnly
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Only return replications that were started on the current Sync
            Gateway node.
        - name: includeError
          in: query
          required: false
          schema:
            type: boolean
            default: true
          description: >-
            Include replications that have stopped due to an error
            (`state=error`).
        - name: includeConfig
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Include the replication configuration with each replicator status in
            the response.
      responses:
        '200':
          description: Successfully retrieved all replication statuses.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    replication_id:
                      description: The ID of the replication.
                      type: string
                    config:
                      description: Properties of a replication
                      type: object
                      x-requirePropertiesSorted: true
                      properties:
                        adhoc:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        batch_size:
                          description: >-
                            The amount of changes to be sent in one batch of
                            replications. Changing this is an Enterprise Edition
                            only feature.
                          type: integer
                          default: 200
                        collections_enabled:
                          description: >-
                            If true, the replicator will run with collections,
                            and will replicate all collections, unless otherwise
                            limited by `collections_local`.


                            If false, the replicator will only replicate the
                            default collection.
                          type: boolean
                          default: false
                        collections_local:
                          description: >-
                            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.
                          type: array
                          items:
                            type: string
                          example:
                            - scope1.collection1
                            - scope1.collection3
                            - scope1.collection6
                          default: []
                        collections_remote:
                          description: >-
                            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.
                          type: array
                          items:
                            type: string
                            nullable: true
                          example:
                            - scope1.collectionA
                            - null
                            - scope1.collectionF
                          default: []
                        conflict_resolution_type:
                          description: >-
                            This defines what conflict resolution policy Sync
                            Gateway should use to apply when resolving
                            conflicting revisions.


                            Changing this is an Enterprise Edition only feature.
                          type: string
                          default: default
                          enum:
                            - default
                            - remoteWins
                            - localWins
                            - custom
                          x-enumDescriptions:
                            default: |-
                              This will use:
                                - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                                - The revision with the most recent timestamp wins.
                                - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                            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.
                        continuous:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        custom_conflict_resolver:
                          description: >-
                            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 document's body.
                            This can be the winning revision (for example,
                            `return conflict.LocalDocument`), a new body, or
                            `nil` to resolve as a delete.


                            Example:


                            ```javascript

                            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.


                            If a document merge is being done, the `_rev` and
                            `_cv` properties should not be included in the
                            returned document body as Sync Gateway will generate
                            new values for these.


                            This is an Enterprise Edition only feature.
                          type: string
                          default: ''
                        direction:
                          description: >-
                            This specifies which direction the replication will
                            be replicating with the `remote` replicator.
                          type: string
                          enum:
                            - push
                            - pull
                            - pushAndPull
                          x-enumDescriptions:
                            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
                        enable_delta_sync:
                          description: >-
                            This will turn on delta-sync for the replication. In
                            order to enable delta-sync for a replication, the
                            database level setting `delta_sync.enabled` must
                            also be set to true.


                            Using delta-sync is an Enterprise Edition only
                            feature.
                          type: boolean
                          default: false
                        filter:
                          description: This defines whether to filter documents.
                          type: string
                          enum:
                            - sync_gateway/bychannel
                            - ''
                          x-enumDescriptions:
                            '': Do not filter any documents.
                            sync_gateway/bychannel: >-
                              If set, a pull replication will be limited to a
                              specific set of channels specified by the
                              `query_param.channels` property.
                        initial_state:
                          description: >-
                            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`.
                          type: string
                          default: running
                          enum:
                            - running
                            - stopped
                          x-enumDescriptions:
                            running: The replication will immediately start running.
                            stopped: >-
                              The replication configuration will be created but
                              the replication will not start running until the
                              user explicitly starts it.
                        max_backoff_time:
                          description: >-
                            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.
                          type: integer
                          default: 5
                        purge_on_removal:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        query_params:
                          description: >-
                            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:

                            ```json

                            "filter":"sync_gateway/bychannel",

                            "query_params": {
                              "channels":["chanUser1"]
                            },

                            ```
                          type: array
                          items:
                            type: string
                        remote:
                          description: >-
                            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,
                            `https://localhost:4985/db`.
                          type: string
                        remote_password:
                          description: >-
                            The password to use to authenticate with the remote.
                            This password will be redacted in the replication
                            config.
                          type: string
                        remote_username:
                          description: The username to use to authenticate with the remote.
                          type: string
                        replication_id:
                          description: >-
                            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.
                          type: string
                          maximum: 160
                        run_as:
                          description: >-
                            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.
                          type: string
                        password:
                          description: >-
                            **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.
                          type: string
                          deprecated: true
                        username:
                          description: >-
                            **This has been deprecated in favour of
                            `remote_username`.**


                            This is the username to use to authenticate with the
                            remote.
                          type: string
                          deprecated: true
                      required:
                        - direction
                      title: User configurable replication properties
                    status:
                      description: >-
                        This is the state that the replicator is in or that
                        trying to transition in to.
                      type: string
                      enum:
                        - running
                        - stopped
                        - resetting
                        - error
                        - starting
                        - reconnecting
                      x-enumDescriptions:
                        running: Currently running replication.
                        stopped: Not running replication.
                        resetting: The replication is resetting its state.
                        error: The replication is stopped due to an error.
                        starting: The replication is starting up.
                        reconnecting: >-
                          The replication is reconnecting to the remote
                          database.
                      title: Replication Status
                    error_message:
                      description: >-
                        The error message of the replication if an error has
                        occurred.
                      type: string
                    docs_read:
                      description: >-
                        The number of documents that have been read (fetched)
                        from the source database.
                      type: integer
                    docs_checked_pull:
                      type: integer
                    docs_purged:
                      description: The number of documents that have been purged.
                      type: integer
                    rejected_by_local:
                      description: >-
                        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.
                      type: integer
                    last_seq_pull:
                      description: >-
                        The last changes sequence number that was pulled from
                        the remote.
                      type: string
                    deltas_recv:
                      description: >-
                        The number of deltas that have been received from the
                        remote.
                      type: integer
                    deltas_requested:
                      type: integer
                    docs_written:
                      description: >-
                        The number of documents that have been wrote (pushed) to
                        the target database.
                      type: integer
                    docs_checked_push:
                      type: integer
                    doc_write_failures:
                      description: >-
                        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.
                      type: integer
                    doc_write_conflicts:
                      description: The number of documents that had a conflict.
                      type: integer
                    rejected_by_remote:
                      description: >-
                        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.
                      type: integer
                    last_seq_push:
                      description: >-
                        The last changes sequence number that was pushed to the
                        remote.
                      type: string
                    deltas_sent:
                      description: 'The number of deltas that have been sent to the remote. '
                      type: integer
                  required:
                    - replication_id
                  title: Replication-status
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  '/{db}/_replicationStatus/{replicationid}':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
      - name: replicationid
        in: path
        required: true
        schema:
          type: string
          minimum: 1
          maximum: 160
        description: What replication to target based on its replication ID.
    get:
      summary: Get replication status
      operationId: get_db-_replicationStatus-replicationid
      tags:
        - Replication
      description: |-
        Retrieve the status of a replication.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Replicator
      parameters:
        - name: activeOnly
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Only return replications that are actively running
            (`state=running`).
        - name: localOnly
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Only return replications that were started on the current Sync
            Gateway node.
        - name: includeError
          in: query
          required: false
          schema:
            type: boolean
            default: true
          description: >-
            Include replications that have stopped due to an error
            (`state=error`).
        - name: includeConfig
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Include the replication configuration with each replicator status in
            the response.
      responses:
        '200':
          description: Successfully retrieved replication status
          content:
            application/json:
              schema:
                type: object
                properties:
                  replication_id:
                    description: The ID of the replication.
                    type: string
                  config:
                    description: Properties of a replication
                    type: object
                    x-requirePropertiesSorted: true
                    properties:
                      adhoc:
                        description: >-
                          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.
                        type: boolean
                        default: false
                      batch_size:
                        description: >-
                          The amount of changes to be sent in one batch of
                          replications. Changing this is an Enterprise Edition
                          only feature.
                        type: integer
                        default: 200
                      collections_enabled:
                        description: >-
                          If true, the replicator will run with collections, and
                          will replicate all collections, unless otherwise
                          limited by `collections_local`.


                          If false, the replicator will only replicate the
                          default collection.
                        type: boolean
                        default: false
                      collections_local:
                        description: >-
                          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.
                        type: array
                        items:
                          type: string
                        example:
                          - scope1.collection1
                          - scope1.collection3
                          - scope1.collection6
                        default: []
                      collections_remote:
                        description: >-
                          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.
                        type: array
                        items:
                          type: string
                          nullable: true
                        example:
                          - scope1.collectionA
                          - null
                          - scope1.collectionF
                        default: []
                      conflict_resolution_type:
                        description: >-
                          This defines what conflict resolution policy Sync
                          Gateway should use to apply when resolving conflicting
                          revisions.


                          Changing this is an Enterprise Edition only feature.
                        type: string
                        default: default
                        enum:
                          - default
                          - remoteWins
                          - localWins
                          - custom
                        x-enumDescriptions:
                          default: |-
                            This will use:
                              - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                              - The revision with the most recent timestamp wins.
                              - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                          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.
                      continuous:
                        description: >-
                          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.
                        type: boolean
                        default: false
                      custom_conflict_resolver:
                        description: >-
                          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 document's body.
                          This can be the winning revision (for example, `return
                          conflict.LocalDocument`), a new body, or `nil` to
                          resolve as a delete.


                          Example:


                          ```javascript

                          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.


                          If a document merge is being done, the `_rev` and
                          `_cv` properties should not be included in the
                          returned document body as Sync Gateway will generate
                          new values for these.


                          This is an Enterprise Edition only feature.
                        type: string
                        default: ''
                      direction:
                        description: >-
                          This specifies which direction the replication will be
                          replicating with the `remote` replicator.
                        type: string
                        enum:
                          - push
                          - pull
                          - pushAndPull
                        x-enumDescriptions:
                          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
                      enable_delta_sync:
                        description: >-
                          This will turn on delta-sync for the replication. In
                          order to enable delta-sync for a replication, the
                          database level setting `delta_sync.enabled` must also
                          be set to true.


                          Using delta-sync is an Enterprise Edition only
                          feature.
                        type: boolean
                        default: false
                      filter:
                        description: This defines whether to filter documents.
                        type: string
                        enum:
                          - sync_gateway/bychannel
                          - ''
                        x-enumDescriptions:
                          '': Do not filter any documents.
                          sync_gateway/bychannel: >-
                            If set, a pull replication will be limited to a
                            specific set of channels specified by the
                            `query_param.channels` property.
                      initial_state:
                        description: >-
                          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`.
                        type: string
                        default: running
                        enum:
                          - running
                          - stopped
                        x-enumDescriptions:
                          running: The replication will immediately start running.
                          stopped: >-
                            The replication configuration will be created but
                            the replication will not start running until the
                            user explicitly starts it.
                      max_backoff_time:
                        description: >-
                          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.
                        type: integer
                        default: 5
                      purge_on_removal:
                        description: >-
                          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.
                        type: boolean
                        default: false
                      query_params:
                        description: >-
                          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:

                          ```json

                          "filter":"sync_gateway/bychannel",

                          "query_params": {
                            "channels":["chanUser1"]
                          },

                          ```
                        type: array
                        items:
                          type: string
                      remote:
                        description: >-
                          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,
                          `https://localhost:4985/db`.
                        type: string
                      remote_password:
                        description: >-
                          The password to use to authenticate with the remote.
                          This password will be redacted in the replication
                          config.
                        type: string
                      remote_username:
                        description: The username to use to authenticate with the remote.
                        type: string
                      replication_id:
                        description: >-
                          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.
                        type: string
                        maximum: 160
                      run_as:
                        description: >-
                          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.
                        type: string
                      password:
                        description: >-
                          **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.
                        type: string
                        deprecated: true
                      username:
                        description: >-
                          **This has been deprecated in favour of
                          `remote_username`.**


                          This is the username to use to authenticate with the
                          remote.
                        type: string
                        deprecated: true
                    required:
                      - direction
                    title: User configurable replication properties
                  status:
                    description: >-
                      This is the state that the replicator is in or that trying
                      to transition in to.
                    type: string
                    enum:
                      - running
                      - stopped
                      - resetting
                      - error
                      - starting
                      - reconnecting
                    x-enumDescriptions:
                      running: Currently running replication.
                      stopped: Not running replication.
                      resetting: The replication is resetting its state.
                      error: The replication is stopped due to an error.
                      starting: The replication is starting up.
                      reconnecting: The replication is reconnecting to the remote database.
                    title: Replication Status
                  error_message:
                    description: >-
                      The error message of the replication if an error has
                      occurred.
                    type: string
                  docs_read:
                    description: >-
                      The number of documents that have been read (fetched) from
                      the source database.
                    type: integer
                  docs_checked_pull:
                    type: integer
                  docs_purged:
                    description: The number of documents that have been purged.
                    type: integer
                  rejected_by_local:
                    description: >-
                      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.
                    type: integer
                  last_seq_pull:
                    description: >-
                      The last changes sequence number that was pulled from the
                      remote.
                    type: string
                  deltas_recv:
                    description: >-
                      The number of deltas that have been received from the
                      remote.
                    type: integer
                  deltas_requested:
                    type: integer
                  docs_written:
                    description: >-
                      The number of documents that have been wrote (pushed) to
                      the target database.
                    type: integer
                  docs_checked_push:
                    type: integer
                  doc_write_failures:
                    description: >-
                      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.
                    type: integer
                  doc_write_conflicts:
                    description: The number of documents that had a conflict.
                    type: integer
                  rejected_by_remote:
                    description: >-
                      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.
                    type: integer
                  last_seq_push:
                    description: >-
                      The last changes sequence number that was pushed to the
                      remote.
                    type: string
                  deltas_sent:
                    description: 'The number of deltas that have been sent to the remote. '
                    type: integer
                required:
                  - replication_id
                title: Replication-status
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Could not find replication
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
    put:
      summary: Control a replication state
      operationId: put_db-_replicationStatus-replicationid
      tags:
        - Replication
      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:
        - name: action
          in: query
          description: The target state to put the replicator into.
          required: true
          schema:
            type: string
            enum:
              - start
              - stop
              - reset
      responses:
        '200':
          description: Successfully changed target state of replicator
          content:
            application/json:
              schema:
                type: object
                properties:
                  replication_id:
                    description: The ID of the replication.
                    type: string
                  config:
                    description: Properties of a replication
                    type: object
                    x-requirePropertiesSorted: true
                    properties:
                      adhoc:
                        description: >-
                          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.
                        type: boolean
                        default: false
                      batch_size:
                        description: >-
                          The amount of changes to be sent in one batch of
                          replications. Changing this is an Enterprise Edition
                          only feature.
                        type: integer
                        default: 200
                      collections_enabled:
                        description: >-
                          If true, the replicator will run with collections, and
                          will replicate all collections, unless otherwise
                          limited by `collections_local`.


                          If false, the replicator will only replicate the
                          default collection.
                        type: boolean
                        default: false
                      collections_local:
                        description: >-
                          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.
                        type: array
                        items:
                          type: string
                        example:
                          - scope1.collection1
                          - scope1.collection3
                          - scope1.collection6
                        default: []
                      collections_remote:
                        description: >-
                          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.
                        type: array
                        items:
                          type: string
                          nullable: true
                        example:
                          - scope1.collectionA
                          - null
                          - scope1.collectionF
                        default: []
                      conflict_resolution_type:
                        description: >-
                          This defines what conflict resolution policy Sync
                          Gateway should use to apply when resolving conflicting
                          revisions.


                          Changing this is an Enterprise Edition only feature.
                        type: string
                        default: default
                        enum:
                          - default
                          - remoteWins
                          - localWins
                          - custom
                        x-enumDescriptions:
                          default: |-
                            This will use:
                              - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                              - The revision with the most recent timestamp wins.
                              - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                          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.
                      continuous:
                        description: >-
                          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.
                        type: boolean
                        default: false
                      custom_conflict_resolver:
                        description: >-
                          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 document's body.
                          This can be the winning revision (for example, `return
                          conflict.LocalDocument`), a new body, or `nil` to
                          resolve as a delete.


                          Example:


                          ```javascript

                          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.


                          If a document merge is being done, the `_rev` and
                          `_cv` properties should not be included in the
                          returned document body as Sync Gateway will generate
                          new values for these.


                          This is an Enterprise Edition only feature.
                        type: string
                        default: ''
                      direction:
                        description: >-
                          This specifies which direction the replication will be
                          replicating with the `remote` replicator.
                        type: string
                        enum:
                          - push
                          - pull
                          - pushAndPull
                        x-enumDescriptions:
                          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
                      enable_delta_sync:
                        description: >-
                          This will turn on delta-sync for the replication. In
                          order to enable delta-sync for a replication, the
                          database level setting `delta_sync.enabled` must also
                          be set to true.


                          Using delta-sync is an Enterprise Edition only
                          feature.
                        type: boolean
                        default: false
                      filter:
                        description: This defines whether to filter documents.
                        type: string
                        enum:
                          - sync_gateway/bychannel
                          - ''
                        x-enumDescriptions:
                          '': Do not filter any documents.
                          sync_gateway/bychannel: >-
                            If set, a pull replication will be limited to a
                            specific set of channels specified by the
                            `query_param.channels` property.
                      initial_state:
                        description: >-
                          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`.
                        type: string
                        default: running
                        enum:
                          - running
                          - stopped
                        x-enumDescriptions:
                          running: The replication will immediately start running.
                          stopped: >-
                            The replication configuration will be created but
                            the replication will not start running until the
                            user explicitly starts it.
                      max_backoff_time:
                        description: >-
                          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.
                        type: integer
                        default: 5
                      purge_on_removal:
                        description: >-
                          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.
                        type: boolean
                        default: false
                      query_params:
                        description: >-
                          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:

                          ```json

                          "filter":"sync_gateway/bychannel",

                          "query_params": {
                            "channels":["chanUser1"]
                          },

                          ```
                        type: array
                        items:
                          type: string
                      remote:
                        description: >-
                          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,
                          `https://localhost:4985/db`.
                        type: string
                      remote_password:
                        description: >-
                          The password to use to authenticate with the remote.
                          This password will be redacted in the replication
                          config.
                        type: string
                      remote_username:
                        description: The username to use to authenticate with the remote.
                        type: string
                      replication_id:
                        description: >-
                          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.
                        type: string
                        maximum: 160
                      run_as:
                        description: >-
                          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.
                        type: string
                      password:
                        description: >-
                          **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.
                        type: string
                        deprecated: true
                      username:
                        description: >-
                          **This has been deprecated in favour of
                          `remote_username`.**


                          This is the username to use to authenticate with the
                          remote.
                        type: string
                        deprecated: true
                    required:
                      - direction
                    title: User configurable replication properties
                  status:
                    description: >-
                      This is the state that the replicator is in or that trying
                      to transition in to.
                    type: string
                    enum:
                      - running
                      - stopped
                      - resetting
                      - error
                      - starting
                      - reconnecting
                    x-enumDescriptions:
                      running: Currently running replication.
                      stopped: Not running replication.
                      resetting: The replication is resetting its state.
                      error: The replication is stopped due to an error.
                      starting: The replication is starting up.
                      reconnecting: The replication is reconnecting to the remote database.
                    title: Replication Status
                  error_message:
                    description: >-
                      The error message of the replication if an error has
                      occurred.
                    type: string
                  docs_read:
                    description: >-
                      The number of documents that have been read (fetched) from
                      the source database.
                    type: integer
                  docs_checked_pull:
                    type: integer
                  docs_purged:
                    description: The number of documents that have been purged.
                    type: integer
                  rejected_by_local:
                    description: >-
                      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.
                    type: integer
                  last_seq_pull:
                    description: >-
                      The last changes sequence number that was pulled from the
                      remote.
                    type: string
                  deltas_recv:
                    description: >-
                      The number of deltas that have been received from the
                      remote.
                    type: integer
                  deltas_requested:
                    type: integer
                  docs_written:
                    description: >-
                      The number of documents that have been wrote (pushed) to
                      the target database.
                    type: integer
                  docs_checked_push:
                    type: integer
                  doc_write_failures:
                    description: >-
                      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.
                    type: integer
                  doc_write_conflicts:
                    description: The number of documents that had a conflict.
                    type: integer
                  rejected_by_remote:
                    description: >-
                      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.
                    type: integer
                  last_seq_push:
                    description: >-
                      The last changes sequence number that was pushed to the
                      remote.
                    type: string
                  deltas_sent:
                    description: 'The number of deltas that have been sent to the remote. '
                    type: integer
                required:
                  - replication_id
                title: Replication-status
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    head:
      summary: Check if replication exists
      operationId: head_db-_replicationStatus-replicationid
      tags:
        - Replication
      description: |-
        Check if a replication exists.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Replicator
      parameters:
        - name: activeOnly
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Only return replications that are actively running
            (`state=running`).
        - name: localOnly
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Only return replications that were started on the current Sync
            Gateway node.
        - name: includeError
          in: query
          required: false
          schema:
            type: boolean
            default: true
          description: >-
            Include replications that have stopped due to an error
            (`state=error`).
        - name: includeConfig
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Include the replication configuration with each replicator status in
            the response.
      responses:
        '200':
          description: Replication exists
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/_profile/{profilename}':
    parameters:
      - name: profilename
        in: path
        description: The handler to use for profiling.
        required: true
        schema:
          type: string
          enum:
            - heap
            - block
            - threadcreate
            - mutex
            - goroutine
    post:
      summary: Create point-in-time profile
      description: |-
        This endpoint allows you to create a pprof snapshot of the given type.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                file:
                  description: This is the file to output the pprof profile at.
                  type: string
      operationId: post__profile-profilename
      tags:
        - Profiling
      responses:
        '200':
          description: Successfully created profile
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  /_profile:
    post:
      summary: Start or Stop continuous CPU profiling
      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
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                file:
                  description: This is the file to output the pprof profile at.
                  type: string
      operationId: post__profile
      tags:
        - Profiling
      responses:
        '200':
          description: Successfully started or stopped CPU profiling
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  /_heap:
    post:
      summary: Dump heap profile
      description: |-
        This endpoint will dump a pprof heap profile.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                file:
                  description: This is the file to output the pprof profile at.
                  type: string
      operationId: post__heap
      tags:
        - Profiling
      responses:
        '200':
          description: Successfully dumped heap profile
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  /_stats:
    get:
      summary: Get memory statistics
      operationId: get__stats
      tags:
        - Metrics
      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
      responses:
        '200':
          description: Returned memory usage statistics
          content:
            application/json:
              schema:
                type: object
                properties:
                  memstats:
                    description: A set of Go runtime memory statistics.
                    additionalProperties: true
  /_config:
    get:
      summary: Get server configuration
      operationId: get__config
      tags:
        - Server
      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:
        - name: redact
          in: query
          deprecated: true
          required: false
          schema:
            type: boolean
            default: true
          description: No longer supported field.
        - name: include_runtime
          in: query
          description: >-
            Whether to include the values set after starting (at runtime),
            default values, and all loaded databases.
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Successfully returned server configuration
          content:
            application/json:
              schema:
                type: object
                x-requirePropertiesSorted: true
                properties:
                  api:
                    description: >-
                      Configuration settings for modifying how the REST API is
                      interacted with.
                    type: object
                    properties:
                      admin_interface:
                        description: >-
                          Network interface to bind admin API to.


                          By default, this will only be accessible to the
                          localhost.
                        type: string
                        default: '127.0.0.1:4985'
                      admin_interface_authentication:
                        description: Whether the admin API requires authentication
                        type: boolean
                        default: true
                      compress_responses:
                        description: 'If false, disables compression of HTTP responses'
                        type: boolean
                        default: true
                      cors:
                        allOf:
                          - type: object
                            description: CORS configuration for all databases
                          - type: object
                            properties:
                              headers:
                                description: >-
                                  List of allowed headers. These headers will be
                                  added the `Access-Control-Allow-Headers`
                                  response to a valid CORS request.


                                  A recommended minimum set of values should be
                                  `["Accept-Encoding", "Authorization",
                                  "Content-Type", "If-Match"]`.
                                type: array
                                items:
                                  type: string
                                example:
                                  - Accept-Encoding
                                  - Authorization
                                  - Content-Type
                                  - If-Match
                              login_origin:
                                description: >-
                                  List of allowed origins to apply to public
                                  `/{db}/_session` API.


                                  To use cors on `/{db}/_session`, the domain
                                  must be present in both `login_origin` and
                                  `origin`.


                                  If configured, `Authorization` must be
                                  included in headers.
                                type: array
                                items:
                                  type: string
                                example:
                                  - 'https://example.com'
                              max_age:
                                description: >-
                                  Value for `Access-Control-Maximum-Age`. Uses 0
                                  by default.
                                type: integer
                                default: 0
                              origin:
                                description: >-
                                  List of allowed origins for the public API.
                                  The request `Origin` header is checked against
                                  these values. If successful the `Origin`
                                  header is returned in the HTTP response header
                                  as `Access-Control-Allow-Origin`.
                                type: array
                                items:
                                  type: string
                                example:
                                  - 'https://example.com'
                            title: Cors Configuration
                      enable_advanced_auth_dp:
                        description: >-
                          Whether to enable the DP permissions check feature of
                          admin auth.


                          Defaults to `true` if using Enterprise Edition or
                          `false` if using Community Edition.
                        type: boolean
                      hide_product_version:
                        description: >-
                          Whether product versions removed from Server headers
                          and REST API responses
                        type: boolean
                      https:
                        type: object
                        properties:
                          tls_cert_path:
                            description: The TLS cert file to use for the REST APIs
                            type: string
                          tls_key_path:
                            description: The TLS key file to use for the REST APIs
                            type: string
                          tls_minimum_version:
                            description: >-
                              The minimum allowable TLS version for the REST
                              APIs
                            type: string
                            default: tlsv1.2
                      idle_timeout:
                        description: >-
                          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`.
                        type: string
                        default: 90s
                      max_connections:
                        description: Max of incoming HTTP connections to accept
                        type: number
                        default: 0
                      metrics_interface:
                        description: >-
                          Network interface to bind metrics API to.


                          By default, this will only be accessible to the
                          localhost.
                        type: string
                        default: '127.0.0.1:4986'
                      metrics_interface_authentication:
                        description: Whether the metrics API requires authentication
                        type: boolean
                        default: true
                      profile_interface:
                        description: Network interface to bind profiling API to
                        type: string
                      public_interface:
                        description: Network interface to bind public API to
                        type: string
                        default: ':4984'
                      read_header_timeout:
                        description: >-
                          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`.
                        type: string
                        default: 5s
                      server_read_timeout:
                        description: >-
                          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`.
                        type: string
                      server_write_timeout:
                        description: >-
                          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`.
                        type: string
                      pretty:
                        description: >-
                          Pretty-print JSON responses. This property is
                          deprecated.
                        type: boolean
                        deprecated: true
                    readOnly: true
                  auth:
                    type: object
                    properties:
                      bcrypt_cost:
                        description: Cost to use for bcrypt password hashes
                        type: integer
                        default: 10
                        maximum: 31
                        minimum: 10
                    readOnly: true
                  bootstrap:
                    description: >-
                      Configuration settings for interacting with Couchbase
                      Server.
                    type: object
                    properties:
                      ca_cert_path:
                        description: Root CA cert path for TLS connection
                        type: string
                      config_update_frequency:
                        description: >-
                          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`.
                        type: string
                        default: 10s
                      group_id:
                        description: >-
                          The config group ID to use when discovering databases.
                          Allows for non-homogenous configuration.
                        type: string
                        default: default
                      password:
                        description: Password for authenticating to server
                        type: string
                      server:
                        description: >
                          Couchbase Server connection string/URL for bootstrap
                          configuration.

                          The connection string should only reference Couchbase
                          Server Data (KV) nodes.

                          Using other node types (Query, Index, Analytics, or
                          Search nodes) is not supported.

                          **Connection String Format**

                          Sync Gateway supports the ability to resolve DNS SRV
                          records for alternate hostnames, or specifying
                          multiple hostnames explicitly. See the [Couchbase Go
                          SDK documentation on DNS SRV
                          records](https://docs.couchbase.com/go-sdk/current/howtos/managing-connections.html#using-dns-srv-records)
                          for more details.

                          Sync Gateway supports both the couchbases:// for TLS
                          and couchbase:// schemes for insecure connection.

                          The supported schemes match that of the Couchbase
                          Server SDKs.

                          **Examples of valid server values:**

                          - `couchbases://nodeA.example.com`

                          - `couchbase://nodeA.example.com`

                          - `couchbases://nodeA.example.com,nodeB.example.com`

                          - `couchbase://nodeA.example.com,nodeB.example.com`

                          -
                          `couchbases://nodeA.example.com:1234,nodeB.example.com:1234`

                          -
                          `couchbase://nodeA.example.com:1234,nodeB.example.com:1234`

                          - `couchbases://127.0.0.1`

                          - `couchbase://127.0.0.1`

                          On startup, Sync Gateway will try all hostnames until
                          it is able

                          to connect successfully.

                          **Port Information**

                          When using the couchbase:// or couchbases:// schemes,
                          the port is not required as Sync Gateway will use the
                          default Couchbase Server client-to-node ports (11210
                          for couchbase:// and 11207 for couchbases://). See the
                          [Couchbase Server ports
                          documentation](https://docs.couchbase.com/server/current/install/install-ports.html#ports-listed-by-communication-path)
                          for more details.

                          **Alternate Addresses**

                          If your Couchbase Server cluster is running in a
                          containerized, port mapped, or otherwise NATd
                          environment like Docker or Kubernetes, Sync Gateway
                          might need more information to connect to the cluster.
                          In many cases the client is able to automatically
                          select the correct set of addresses.

                          If the detection heuristic fails in your environment,
                          it is possible to override this behavior by adding a
                          network parameter to the connection string.

                          The network parameter can be:

                          - `external`: Force the use alternate addresses of
                          Couchbase Server. Used when Sync Gateway should not
                          share network used by Couchbase Server internally.

                          - `default`: Do not allow use of alternate addresses
                          of Couchbase Server. Used when Sync Gateway and
                          Couchbase Server are on the same network.

                          Example: `"server":
                          "couchbases://my-cbs-server?network=default"`

                          Will force the connection to ignore any alternative
                          external addresses configured

                          on the Couchbase Server node.

                          **Lost Connections**

                          If the connection to Couchbase Server is lost during
                          normal operations, Sync Gateway

                          will automatically re-connect to another node in the
                          cluster.
                        type: string
                      server_tls_skip_verify:
                        description: >-
                          Allow empty server CA Cert Path without attempting to
                          use system root pool
                        type: boolean
                        default: false
                      use_tls_server:
                        description: Enforces a secure or non-secure server scheme
                        type: boolean
                        default: true
                      username:
                        description: Username for authenticating to server.
                        type: string
                      x509_cert_path:
                        description: Cert path (public key) for X.509 bucket auth
                        type: string
                      x509_key_path:
                        description: Key path (private key) for X.509 bucket auth
                        type: string
                    readOnly: true
                    required:
                      - server
                      - username
                      - password
                  bucket_credentials:
                    description: >-
                      A map of bucket names to credentials, that can be used
                      instead of the bootstrap ones.
                    type: object
                    additionalProperties:
                      x-additionalPropertiesName: bucketname
                      description: The configuration for the credentials set.
                      type: object
                      properties:
                        username:
                          description: Username for authenticating to the bucket
                          type: string
                        password:
                          description: >-
                            Password for authenticating to the bucket. This
                            value is always redacted.
                          type: string
                        x509_cert_path:
                          description: Cert path (public key) for X.509 bucket auth
                          type: string
                        x509_key_path:
                          description: Key path (private key) for X.509 bucket auth
                          type: string
                      title: Credentials config
                    readOnly: true
                  database_credentials:
                    description: >-
                      A map of database name to credentials, that can be used
                      instead of the bootstrap ones.
                    type: object
                    additionalProperties:
                      x-additionalPropertiesName: databasename
                      description: The configuration for the credentials set.
                      type: object
                      properties:
                        username:
                          description: Username for authenticating to the bucket
                          type: string
                        password:
                          description: >-
                            Password for authenticating to the bucket. This
                            value is always redacted.
                          type: string
                        x509_cert_path:
                          description: Cert path (public key) for X.509 bucket auth
                          type: string
                        x509_key_path:
                          description: Key path (private key) for X.509 bucket auth
                          type: string
                      title: Credentials config
                    readOnly: true
                  heap_profile_collection_threshold:
                    description: >-
                      Threshold in bytes for automatic collection of heap
                      profiles. If not specified, defaults to 85% of the lesser
                      of cgroup or system memory.
                    readOnly: true
                    type: integer
                  heap_profile_disable_collection:
                    description: Disables automatic heap profile collection.
                    default: false
                    type: boolean
                    readOnly: true
                  logging:
                    description: >-
                      The configuration settings for modifying Sync Gateway
                      logging.
                    type: object
                    allOf:
                      - type: object
                        properties:
                          log_file_path:
                            description: >-
                              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.
                            type: string
                            readOnly: true
                          redaction_level:
                            description: Redaction level to apply to log output.
                            type: string
                            default: partial
                            enum:
                              - none
                              - partial
                              - full
                              - unset
                            readOnly: true
                          console:
                            allOf:
                              - title: Configuration for console logging.
                                allOf:
                                  - type: object
                                    properties:
                                      log_level:
                                        description: Log Level for the console output
                                        type: string
                                        default: info
                                        enum:
                                          - none
                                          - error
                                          - warn
                                          - info
                                          - debug
                                          - trace
                                      log_keys:
                                        description: Log Keys for the console output
                                        type: array
                                        items:
                                          type: string
                                          enum:
                                            - '*'
                                            - Admin
                                            - Access
                                            - Auth
                                            - Bucket
                                            - Cache
                                            - Changes
                                            - SGCluster
                                            - Config
                                            - CRUD
                                            - DCP
                                            - Diagnostic
                                            - Events
                                            - gocb
                                            - HTTP
                                            - HTTP+
                                            - Import
                                            - Javascript
                                            - Migrate
                                            - Query
                                            - Replicate
                                            - Sync
                                            - SyncMsg
                                            - WS
                                            - WSFrame
                                          x-enumDescriptions:
                                            '*': >-
                                              This wildcard log key, enables all log
                                              keys.
                                            Access: >-
                                              Anytime an access() call is made in the
                                              sync function.
                                            Admin: Admin processes in Sync Gateway.
                                            Auth: Authentication.
                                            Bucket: >-
                                              Sync Gateway interactions with the
                                              bucket.
                                            CRUD: CRUD operations.
                                            Cache: >-
                                              Interactions with Sync Gateway’s
                                              in-memory channel cache.
                                            Changes: >-
                                              Processing of /{keyspace}/_changes
                                              requests and pull replications
                                            Config: Server or database configuration.
                                            DCP: >-
                                              Updates made by Sync Gateway to
                                              documents.
                                            Diagnostic: Operations used by dry run endpoints.
                                            Events: Event processing (webhooks).
                                            HTTP: >-
                                              All requests made to the Sync Gateway
                                              REST APIs.
                                            HTTP+: >-
                                              Additional information about HTTP
                                              requests (response times, status codes).
                                            Import: >-
                                              This log key can be useful to
                                              troubleshoot why a given document was
                                              not successfully imported.
                                            Javascript: >-
                                              All logging from Javascript. This
                                              includes: sync function, import filters,
                                              webhook filter function, and custom
                                              inter-Sync Gateway replication conflict
                                              resolvers.
                                            Migrate: >-
                                              Logs messages that show when old inline
                                              document metadata is upgraded to xattrs.
                                            Query: >-
                                              Query is used for Sync Gateway code
                                              related to N1QL queries
                                            Replicate: >-
                                              Log messages related to Inter-Sync
                                              Gateway replications. This is not used
                                              for replications initiated by Couchbase
                                              Lite.
                                            SGCluster: >-
                                              Log messages related to coordination of
                                              Sync Gateways for sharded import and
                                              Inter-Sync Gateway Replication.
                                            Sync: >-
                                              Activity which relates to
                                              synchronization between Couchbase Lite
                                              and Sync Gateway
                                            SyncMsg: Additional logging on top of `Sync` key.
                                            WS: Websocket replication log messages.
                                            WSFrame: Additional logging on top of `WS` key.
                                            gocb: All logging emitted by the gocb SDK
                                          example:
                                            - CRUD
                                            - HTTP
                                            - Query
                                  - type: object
                                    properties:
                                      color_enabled:
                                        description: Log with color for the console output
                                        type: boolean
                                        default: false
                                        readOnly: true
                                      file_output:
                                        description: >-
                                          Override the default stderr output, and
                                          write to the file specified instead
                                        type: string
                                        readOnly: true
                                      enabled:
                                        description: Toggle for this log output
                                        type: boolean
                                        default: false
                                        readOnly: true
                                      rotation:
                                        type: object
                                        readOnly: true
                                        title: Log-rotation-config
                                        properties:
                                          max_size:
                                            description: >-
                                              The maximum size in MB of the log file
                                              before it gets rotated.
                                            type: integer
                                            default: 100
                                          localtime:
                                            description: >-
                                              If true, it uses the computer's local
                                              time to format the backup timestamp.
                                            type: boolean
                                            default: false
                                          rotated_logs_size_limit:
                                            description: >-
                                              Max Size (in mb) of log files before
                                              deletion
                                            type: integer
                                            default: 1024
                                          rotation_interval:
                                            description: >-
                                              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`.
                                            type: string
                                            default: ''
                                          max_age:
                                            description: >-
                                              The maximum number of days to retain old
                                              log files. By default, there is no
                                              rotation, max_age=0.
                                            default: 0
                                            type: integer
                                      collation_buffer_size:
                                        description: >-
                                          The size of the log collation buffer.
                                          The default is 10 if the output is
                                          stderr, or 1000 if to a file.
                                        type: integer
                                        default: 10
                                        readOnly: true
                          error:
                            type: object
                            description: Error logging configuration.
                            properties:
                              enabled:
                                description: Toggle for this log output
                                type: boolean
                                default: true
                              rotation:
                                type: object
                                readOnly: true
                                properties:
                                  max_size:
                                    description: >-
                                      The maximum size in MB of the log file
                                      before it gets rotated.
                                    type: integer
                                    default: 100
                                  localtime:
                                    description: >-
                                      If true, it uses the computer's local time
                                      to format the backup timestamp.
                                    type: boolean
                                    default: false
                                  rotated_logs_size_limit:
                                    description: >-
                                      Max Size (in mb) of log files before
                                      deletion
                                    type: integer
                                    default: 1024
                                  rotation_interval:
                                    description: >-
                                      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`.
                                    type: string
                                    default: ''
                                  max_age:
                                    description: >-
                                      The maximum number of days to retain old
                                      log files.
                                    default: 360
                                    type: integer
                              collation_buffer_size:
                                description: The size of the log collation buffer.
                                default: 0
                                type: integer
                                readOnly: true
                          warn:
                            type: object
                            description: Warning logging configuration.
                            properties:
                              enabled:
                                description: Toggle for this log output
                                type: boolean
                                default: true
                              rotation:
                                type: object
                                readOnly: true
                                properties:
                                  max_size:
                                    description: >-
                                      The maximum size in MB of the log file
                                      before it gets rotated.
                                    type: integer
                                    default: 100
                                  localtime:
                                    description: >-
                                      If true, it uses the computer's local time
                                      to format the backup timestamp.
                                    type: boolean
                                    default: false
                                  rotated_logs_size_limit:
                                    description: >-
                                      Max Size (in mb) of log files before
                                      deletion
                                    type: integer
                                    default: 1024
                                  rotation_interval:
                                    description: >-
                                      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`.
                                    type: string
                                    default: ''
                                  max_age:
                                    description: >-
                                      The maximum number of days to retain old
                                      log files.
                                    default: 180
                                    type: integer
                              collation_buffer_size:
                                description: The size of the log collation buffer
                                default: 0
                                type: integer
                                readOnly: true
                          info:
                            type: object
                            description: Info logging configuration.
                            properties:
                              enabled:
                                description: Toggle for this log output
                                type: boolean
                                default: true
                              rotation:
                                type: object
                                readOnly: true
                                properties:
                                  max_size:
                                    description: >-
                                      The maximum size in MB of the log file
                                      before it gets rotated.
                                    type: integer
                                    default: 100
                                  localtime:
                                    description: >-
                                      If true, it uses the computer's local time
                                      to format the backup timestamp.
                                    type: boolean
                                    default: false
                                  rotated_logs_size_limit:
                                    description: >-
                                      Max Size (in mb) of log files before
                                      deletion
                                    type: integer
                                    default: 1024
                                  rotation_interval:
                                    description: >-
                                      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`.
                                    type: string
                                    default: ''
                                  max_age:
                                    description: >-
                                      The maximum number of days to retain old
                                      log files.
                                    default: 6
                                    type: integer
                              collation_buffer_size:
                                description: The size of the log collation buffer
                                default: 0
                                type: integer
                                readOnly: true
                          debug:
                            type: object
                            description: Debug logging configuration.
                            properties:
                              enabled:
                                description: Toggle for this log output
                                type: boolean
                                default: false
                              rotation:
                                type: object
                                readOnly: true
                                properties:
                                  max_size:
                                    description: >-
                                      The maximum size in MB of the log file
                                      before it gets rotated.
                                    type: integer
                                    default: 100
                                  localtime:
                                    description: >-
                                      If true, it uses the computer's local time
                                      to format the backup timestamp.
                                    type: boolean
                                    default: false
                                  rotated_logs_size_limit:
                                    description: >-
                                      Max Size (in mb) of log files before
                                      deletion
                                    type: integer
                                    default: 1024
                                  rotation_interval:
                                    description: >-
                                      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`.
                                    type: string
                                    default: ''
                                  max_age:
                                    description: >-
                                      The maximum number of days to retain old
                                      log files.
                                    default: 2
                                    type: integer
                              collation_buffer_size:
                                description: The size of the log collation buffer
                                default: 1000
                                type: integer
                                readOnly: true
                          trace:
                            type: object
                            description: Trace logging configuration.
                            properties:
                              enabled:
                                description: Toggle for this log output
                                type: boolean
                                default: false
                              rotation:
                                type: object
                                readOnly: true
                                properties:
                                  max_size:
                                    description: >-
                                      The maximum size in MB of the log file
                                      before it gets rotated.
                                    type: integer
                                    default: 100
                                  localtime:
                                    description: >-
                                      If true, it uses the computer's local time
                                      to format the backup timestamp.
                                    type: boolean
                                    default: false
                                  rotated_logs_size_limit:
                                    description: >-
                                      Max Size (in mb) of log files before
                                      deletion
                                    type: integer
                                    default: 1024
                                  rotation_interval:
                                    description: >-
                                      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`.
                                    type: string
                                    default: ''
                                  max_age:
                                    description: >-
                                      The maximum number of days to retain old
                                      log files.
                                    default: 2
                                    type: integer
                              collation_buffer_size:
                                description: The size of the log collation buffer
                                default: 1000
                                type: integer
                                readOnly: true
                          stats:
                            type: object
                            description: Trace logging configuration.
                            properties:
                              enabled:
                                description: Toggle for this log output
                                type: boolean
                                default: true
                              rotation:
                                type: object
                                readOnly: true
                                properties:
                                  max_size:
                                    description: >-
                                      The maximum size in MB of the log file
                                      before it gets rotated.
                                    type: integer
                                    default: 100
                                  localtime:
                                    description: >-
                                      If true, it uses the computer's local time
                                      to format the backup timestamp.
                                    type: boolean
                                    default: false
                                  rotated_logs_size_limit:
                                    description: >-
                                      Max Size (in mb) of log files before
                                      deletion
                                    type: integer
                                    default: 1024
                                  rotation_interval:
                                    description: >-
                                      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`.
                                    type: string
                                    default: ''
                                  max_age:
                                    description: >-
                                      The maximum number of days to retain old
                                      log files.
                                    default: 6
                                    type: integer
                              collation_buffer_size:
                                description: The size of the log collation buffer
                                default: 0
                                type: integer
                                readOnly: true
                          audit:
                            type: object
                            title: Audit logging config
                            properties:
                              enabled:
                                description: Toggle for this log output
                                type: boolean
                                default: false
                              rotation:
                                type: object
                                readOnly: true
                                properties:
                                  max_size:
                                    description: >-
                                      The maximum size in MB of the log file
                                      before it gets rotated.
                                    type: integer
                                    default: 100
                                  localtime:
                                    description: >-
                                      If true, it uses the computer's local time
                                      to format the backup timestamp.
                                    type: boolean
                                    default: false
                                  rotated_logs_size_limit:
                                    description: >-
                                      Max Size (in mb) of log files before
                                      deletion
                                    type: integer
                                    default: 1024
                                  rotation_interval:
                                    description: >-
                                      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`.
                                    type: string
                                    default: ''
                                  max_age:
                                    description: >-
                                      The maximum number of days to retain old
                                      log files.
                                    default: 6
                                    type: integer
                              audit_log_file_path:
                                description: The path to write audit log files to
                                type: string
                                readOnly: true
                              enabled_events:
                                description: List of enabled global audit events.
                                type: array
                                items:
                                  type: number
                                example:
                                  - 1234
                                  - 5678
                                readOnly: true
                  max_file_descriptors:
                    description: Max of open file descriptors (RLIMIT_NOFILE)
                    type: number
                    default: 5000
                    minimum: 0
                    readOnly: true
                  replicator:
                    type: object
                    properties:
                      blip_compression:
                        description: BLIP data compression level (0-9)
                        type: integer
                        maximum: 9
                        minimum: 0
                      max_concurrent_changes_batches:
                        description: >-
                          Maximum number of changes batches to process
                          concurrently per replication (1-5)"
                        type: integer
                        default: 2
                        minimum: 1
                        maximum: 5
                      max_concurrent_replications:
                        description: >-
                          Maximum number of concurrent replication connections
                          allowed. If set to 0 this limit will be ignored.
                        type: integer
                      max_concurrent_revs:
                        description: >-
                          Maximum number of revs to process concurrently per
                          replication (5-200)
                        type: integer
                        default: 5
                        minimum: 5
                        maximum: 200
                      max_heartbeat:
                        description: >-
                          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`.
                        type: string
                    readOnly: true
                  unsupported:
                    description: >-
                      Settings that are not officially supported. It is highly
                      recommended these are **not** used.
                    type: object
                    properties:
                      allow_dbconfig_env_vars:
                        description: >-
                          Can be set to false to skip environment variable
                          expansion in database configs
                        type: boolean
                        default: true
                      diagnostic_interface:
                        description: >-
                          Network interface to bind diagnotic API to.


                          By default, this API will not be run unless this
                          string is specified.
                        type: string
                        default: ''
                      http2:
                        type: object
                        properties:
                          enabled:
                            description: Whether HTTP2 support is enabled
                            type: boolean
                            default: false
                      serverless:
                        description: >-
                          Configuration for when SG is running in serverless
                          mode
                        type: object
                        properties:
                          enabled:
                            description: Run SG in to serverless mode
                            type: boolean
                            readOnly: true
                          min_config_fetch_interval:
                            description: >-
                              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`.
                            type: string
                            default: 1s
                      stats_log_frequency:
                        description: >-
                          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`.
                        type: string
                        default: 1m
                      use_stdlib_json:
                        description: >-
                          Bypass the jsoniter package and use Go's stdlib
                          instead
                        type: boolean
                        default: false
                      use_xattr_config:
                        description: Store database configurations in system xattrs
                        type: boolean
                        default: false
                    readOnly: true
                  couchbase_keepalive_interval:
                    description: >-
                      TCP keep-alive interval between SG and Couchbase server.
                      This is unused.
                    type: integer
                    deprecated: true
                    readOnly: true
                title: Startup-config
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
    put:
      summary: Set runtime configuration
      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
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                logging:
                  allOf:
                    - type: object
                      properties:
                        log_file_path:
                          description: >-
                            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.
                          type: string
                          readOnly: true
                        redaction_level:
                          description: Redaction level to apply to log output.
                          type: string
                          default: partial
                          enum:
                            - none
                            - partial
                            - full
                            - unset
                          readOnly: true
                        console:
                          allOf:
                            - title: Configuration for console logging.
                              allOf:
                                - type: object
                                  properties:
                                    log_level:
                                      description: Log Level for the console output
                                      type: string
                                      default: info
                                      enum:
                                        - none
                                        - error
                                        - warn
                                        - info
                                        - debug
                                        - trace
                                    log_keys:
                                      description: Log Keys for the console output
                                      type: array
                                      items:
                                        type: string
                                        enum:
                                          - '*'
                                          - Admin
                                          - Access
                                          - Auth
                                          - Bucket
                                          - Cache
                                          - Changes
                                          - SGCluster
                                          - Config
                                          - CRUD
                                          - DCP
                                          - Diagnostic
                                          - Events
                                          - gocb
                                          - HTTP
                                          - HTTP+
                                          - Import
                                          - Javascript
                                          - Migrate
                                          - Query
                                          - Replicate
                                          - Sync
                                          - SyncMsg
                                          - WS
                                          - WSFrame
                                        x-enumDescriptions:
                                          '*': >-
                                            This wildcard log key, enables all log
                                            keys.
                                          Access: >-
                                            Anytime an access() call is made in the
                                            sync function.
                                          Admin: Admin processes in Sync Gateway.
                                          Auth: Authentication.
                                          Bucket: >-
                                            Sync Gateway interactions with the
                                            bucket.
                                          CRUD: CRUD operations.
                                          Cache: >-
                                            Interactions with Sync Gateway’s
                                            in-memory channel cache.
                                          Changes: >-
                                            Processing of /{keyspace}/_changes
                                            requests and pull replications
                                          Config: Server or database configuration.
                                          DCP: >-
                                            Updates made by Sync Gateway to
                                            documents.
                                          Diagnostic: Operations used by dry run endpoints.
                                          Events: Event processing (webhooks).
                                          HTTP: >-
                                            All requests made to the Sync Gateway
                                            REST APIs.
                                          HTTP+: >-
                                            Additional information about HTTP
                                            requests (response times, status codes).
                                          Import: >-
                                            This log key can be useful to
                                            troubleshoot why a given document was
                                            not successfully imported.
                                          Javascript: >-
                                            All logging from Javascript. This
                                            includes: sync function, import filters,
                                            webhook filter function, and custom
                                            inter-Sync Gateway replication conflict
                                            resolvers.
                                          Migrate: >-
                                            Logs messages that show when old inline
                                            document metadata is upgraded to xattrs.
                                          Query: >-
                                            Query is used for Sync Gateway code
                                            related to N1QL queries
                                          Replicate: >-
                                            Log messages related to Inter-Sync
                                            Gateway replications. This is not used
                                            for replications initiated by Couchbase
                                            Lite.
                                          SGCluster: >-
                                            Log messages related to coordination of
                                            Sync Gateways for sharded import and
                                            Inter-Sync Gateway Replication.
                                          Sync: >-
                                            Activity which relates to
                                            synchronization between Couchbase Lite
                                            and Sync Gateway
                                          SyncMsg: Additional logging on top of `Sync` key.
                                          WS: Websocket replication log messages.
                                          WSFrame: Additional logging on top of `WS` key.
                                          gocb: All logging emitted by the gocb SDK
                                        example:
                                          - CRUD
                                          - HTTP
                                          - Query
                                - type: object
                                  properties:
                                    color_enabled:
                                      description: Log with color for the console output
                                      type: boolean
                                      default: false
                                      readOnly: true
                                    file_output:
                                      description: >-
                                        Override the default stderr output, and
                                        write to the file specified instead
                                      type: string
                                      readOnly: true
                                    enabled:
                                      description: Toggle for this log output
                                      type: boolean
                                      default: false
                                      readOnly: true
                                    rotation:
                                      type: object
                                      readOnly: true
                                      title: Log-rotation-config
                                      properties:
                                        max_size:
                                          description: >-
                                            The maximum size in MB of the log file
                                            before it gets rotated.
                                          type: integer
                                          default: 100
                                        localtime:
                                          description: >-
                                            If true, it uses the computer's local
                                            time to format the backup timestamp.
                                          type: boolean
                                          default: false
                                        rotated_logs_size_limit:
                                          description: >-
                                            Max Size (in mb) of log files before
                                            deletion
                                          type: integer
                                          default: 1024
                                        rotation_interval:
                                          description: >-
                                            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`.
                                          type: string
                                          default: ''
                                        max_age:
                                          description: >-
                                            The maximum number of days to retain old
                                            log files. By default, there is no
                                            rotation, max_age=0.
                                          default: 0
                                          type: integer
                                    collation_buffer_size:
                                      description: >-
                                        The size of the log collation buffer.
                                        The default is 10 if the output is
                                        stderr, or 1000 if to a file.
                                      type: integer
                                      default: 10
                                      readOnly: true
                        error:
                          type: object
                          description: Error logging configuration.
                          properties:
                            enabled:
                              description: Toggle for this log output
                              type: boolean
                              default: true
                            rotation:
                              type: object
                              readOnly: true
                              properties:
                                max_size:
                                  description: >-
                                    The maximum size in MB of the log file
                                    before it gets rotated.
                                  type: integer
                                  default: 100
                                localtime:
                                  description: >-
                                    If true, it uses the computer's local time
                                    to format the backup timestamp.
                                  type: boolean
                                  default: false
                                rotated_logs_size_limit:
                                  description: >-
                                    Max Size (in mb) of log files before
                                    deletion
                                  type: integer
                                  default: 1024
                                rotation_interval:
                                  description: >-
                                    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`.
                                  type: string
                                  default: ''
                                max_age:
                                  description: >-
                                    The maximum number of days to retain old log
                                    files.
                                  default: 360
                                  type: integer
                            collation_buffer_size:
                              description: The size of the log collation buffer.
                              default: 0
                              type: integer
                              readOnly: true
                        warn:
                          type: object
                          description: Warning logging configuration.
                          properties:
                            enabled:
                              description: Toggle for this log output
                              type: boolean
                              default: true
                            rotation:
                              type: object
                              readOnly: true
                              properties:
                                max_size:
                                  description: >-
                                    The maximum size in MB of the log file
                                    before it gets rotated.
                                  type: integer
                                  default: 100
                                localtime:
                                  description: >-
                                    If true, it uses the computer's local time
                                    to format the backup timestamp.
                                  type: boolean
                                  default: false
                                rotated_logs_size_limit:
                                  description: >-
                                    Max Size (in mb) of log files before
                                    deletion
                                  type: integer
                                  default: 1024
                                rotation_interval:
                                  description: >-
                                    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`.
                                  type: string
                                  default: ''
                                max_age:
                                  description: >-
                                    The maximum number of days to retain old log
                                    files.
                                  default: 180
                                  type: integer
                            collation_buffer_size:
                              description: The size of the log collation buffer
                              default: 0
                              type: integer
                              readOnly: true
                        info:
                          type: object
                          description: Info logging configuration.
                          properties:
                            enabled:
                              description: Toggle for this log output
                              type: boolean
                              default: true
                            rotation:
                              type: object
                              readOnly: true
                              properties:
                                max_size:
                                  description: >-
                                    The maximum size in MB of the log file
                                    before it gets rotated.
                                  type: integer
                                  default: 100
                                localtime:
                                  description: >-
                                    If true, it uses the computer's local time
                                    to format the backup timestamp.
                                  type: boolean
                                  default: false
                                rotated_logs_size_limit:
                                  description: >-
                                    Max Size (in mb) of log files before
                                    deletion
                                  type: integer
                                  default: 1024
                                rotation_interval:
                                  description: >-
                                    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`.
                                  type: string
                                  default: ''
                                max_age:
                                  description: >-
                                    The maximum number of days to retain old log
                                    files.
                                  default: 6
                                  type: integer
                            collation_buffer_size:
                              description: The size of the log collation buffer
                              default: 0
                              type: integer
                              readOnly: true
                        debug:
                          type: object
                          description: Debug logging configuration.
                          properties:
                            enabled:
                              description: Toggle for this log output
                              type: boolean
                              default: false
                            rotation:
                              type: object
                              readOnly: true
                              properties:
                                max_size:
                                  description: >-
                                    The maximum size in MB of the log file
                                    before it gets rotated.
                                  type: integer
                                  default: 100
                                localtime:
                                  description: >-
                                    If true, it uses the computer's local time
                                    to format the backup timestamp.
                                  type: boolean
                                  default: false
                                rotated_logs_size_limit:
                                  description: >-
                                    Max Size (in mb) of log files before
                                    deletion
                                  type: integer
                                  default: 1024
                                rotation_interval:
                                  description: >-
                                    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`.
                                  type: string
                                  default: ''
                                max_age:
                                  description: >-
                                    The maximum number of days to retain old log
                                    files.
                                  default: 2
                                  type: integer
                            collation_buffer_size:
                              description: The size of the log collation buffer
                              default: 1000
                              type: integer
                              readOnly: true
                        trace:
                          type: object
                          description: Trace logging configuration.
                          properties:
                            enabled:
                              description: Toggle for this log output
                              type: boolean
                              default: false
                            rotation:
                              type: object
                              readOnly: true
                              properties:
                                max_size:
                                  description: >-
                                    The maximum size in MB of the log file
                                    before it gets rotated.
                                  type: integer
                                  default: 100
                                localtime:
                                  description: >-
                                    If true, it uses the computer's local time
                                    to format the backup timestamp.
                                  type: boolean
                                  default: false
                                rotated_logs_size_limit:
                                  description: >-
                                    Max Size (in mb) of log files before
                                    deletion
                                  type: integer
                                  default: 1024
                                rotation_interval:
                                  description: >-
                                    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`.
                                  type: string
                                  default: ''
                                max_age:
                                  description: >-
                                    The maximum number of days to retain old log
                                    files.
                                  default: 2
                                  type: integer
                            collation_buffer_size:
                              description: The size of the log collation buffer
                              default: 1000
                              type: integer
                              readOnly: true
                        stats:
                          type: object
                          description: Trace logging configuration.
                          properties:
                            enabled:
                              description: Toggle for this log output
                              type: boolean
                              default: true
                            rotation:
                              type: object
                              readOnly: true
                              properties:
                                max_size:
                                  description: >-
                                    The maximum size in MB of the log file
                                    before it gets rotated.
                                  type: integer
                                  default: 100
                                localtime:
                                  description: >-
                                    If true, it uses the computer's local time
                                    to format the backup timestamp.
                                  type: boolean
                                  default: false
                                rotated_logs_size_limit:
                                  description: >-
                                    Max Size (in mb) of log files before
                                    deletion
                                  type: integer
                                  default: 1024
                                rotation_interval:
                                  description: >-
                                    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`.
                                  type: string
                                  default: ''
                                max_age:
                                  description: >-
                                    The maximum number of days to retain old log
                                    files.
                                  default: 6
                                  type: integer
                            collation_buffer_size:
                              description: The size of the log collation buffer
                              default: 0
                              type: integer
                              readOnly: true
                        audit:
                          type: object
                          title: Audit logging config
                          properties:
                            enabled:
                              description: Toggle for this log output
                              type: boolean
                              default: false
                            rotation:
                              type: object
                              readOnly: true
                              properties:
                                max_size:
                                  description: >-
                                    The maximum size in MB of the log file
                                    before it gets rotated.
                                  type: integer
                                  default: 100
                                localtime:
                                  description: >-
                                    If true, it uses the computer's local time
                                    to format the backup timestamp.
                                  type: boolean
                                  default: false
                                rotated_logs_size_limit:
                                  description: >-
                                    Max Size (in mb) of log files before
                                    deletion
                                  type: integer
                                  default: 1024
                                rotation_interval:
                                  description: >-
                                    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`.
                                  type: string
                                  default: ''
                                max_age:
                                  description: >-
                                    The maximum number of days to retain old log
                                    files.
                                  default: 6
                                  type: integer
                            audit_log_file_path:
                              description: The path to write audit log files to
                              type: string
                              readOnly: true
                            enabled_events:
                              description: List of enabled global audit events.
                              type: array
                              items:
                                type: number
                              example:
                                - 1234
                                - 5678
                              readOnly: true
                max_concurrent_replications:
                  description: >-
                    Maximum number of concurrent replication connections
                    allowed. If set to 0 this limit will be ignored.
                  type: integer
                  default: 0
              title: Runtime-config
      operationId: put__config
      tags:
        - Server
      responses:
        '200':
          description: Successfully set runtime options
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  /_status:
    get:
      summary: Get the server status
      operationId: get__status
      tags:
        - Server
      description: >-
        This will retrieve the status of each database and the overall server
        status.


        Required Sync Gateway RBAC roles:


        * Sync Gateway Dev Ops
      responses:
        '200':
          description: Returned the status successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  databases:
                    description: >-
                      Contains a map of all the databases in the node along with
                      their status.
                    type: object
                    additionalProperties:
                      x-additionalPropertiesName: dbname
                      description: The name of the database.
                      type: object
                      properties:
                        seq:
                          description: The latest sequence number in the database.
                          type: number
                          minimum: 0
                        server_uuid:
                          description: The server unique identifier.
                          type: string
                        require_resync:
                          description: >-
                            Indicates whether the database requires resync
                            before it can be brought online.
                          type: boolean
                        state:
                          allOf:
                            - description: The state of the database.
                              type: string
                              enum:
                                - Online
                                - Offline
                                - Starting
                                - Stopping
                                - Resyncing
                              x-enumDescriptions:
                                Online: The database is online and available for use.
                                Offline: >-
                                  The database is offline, resync and other
                                  offline only endpoints are allowed.
                                Starting: >-
                                  The database is in the process of going
                                  online.
                                Stopping: >-
                                  The database is no longer accepting
                                  connections and is being taken offline or
                                  deleted.
                                Resyncing: >-
                                  The database is offline and performing a
                                  resync operation.
                        replication_status:
                          type: array
                          items:
                            type: object
                            properties:
                              replication_id:
                                description: The ID of the replication.
                                type: string
                              config:
                                description: Properties of a replication
                                type: object
                                x-requirePropertiesSorted: true
                                properties:
                                  adhoc:
                                    description: >-
                                      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.
                                    type: boolean
                                    default: false
                                  batch_size:
                                    description: >-
                                      The amount of changes to be sent in one
                                      batch of replications. Changing this is an
                                      Enterprise Edition only feature.
                                    type: integer
                                    default: 200
                                  collections_enabled:
                                    description: >-
                                      If true, the replicator will run with
                                      collections, and will replicate all
                                      collections, unless otherwise limited by
                                      `collections_local`.


                                      If false, the replicator will only
                                      replicate the default collection.
                                    type: boolean
                                    default: false
                                  collections_local:
                                    description: >-
                                      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.
                                    type: array
                                    items:
                                      type: string
                                    example:
                                      - scope1.collection1
                                      - scope1.collection3
                                      - scope1.collection6
                                    default: []
                                  collections_remote:
                                    description: >-
                                      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.
                                    type: array
                                    items:
                                      type: string
                                      nullable: true
                                    example:
                                      - scope1.collectionA
                                      - null
                                      - scope1.collectionF
                                    default: []
                                  conflict_resolution_type:
                                    description: >-
                                      This defines what conflict resolution
                                      policy Sync Gateway should use to apply
                                      when resolving conflicting revisions.


                                      Changing this is an Enterprise Edition
                                      only feature.
                                    type: string
                                    default: default
                                    enum:
                                      - default
                                      - remoteWins
                                      - localWins
                                      - custom
                                    x-enumDescriptions:
                                      default: |-
                                        This will use:
                                          - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                                          - The revision with the most recent timestamp wins.
                                          - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                                      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.
                                  continuous:
                                    description: >-
                                      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.
                                    type: boolean
                                    default: false
                                  custom_conflict_resolver:
                                    description: >-
                                      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
                                      document's body. This can be the winning
                                      revision (for example, `return
                                      conflict.LocalDocument`), a new body, or
                                      `nil` to resolve as a delete.


                                      Example:


                                      ```javascript

                                      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.


                                      If a document merge is being done, the
                                      `_rev` and `_cv` properties should not be
                                      included in the returned document body as
                                      Sync Gateway will generate new values for
                                      these.


                                      This is an Enterprise Edition only
                                      feature.
                                    type: string
                                    default: ''
                                  direction:
                                    description: >-
                                      This specifies which direction the
                                      replication will be replicating with the
                                      `remote` replicator.
                                    type: string
                                    enum:
                                      - push
                                      - pull
                                      - pushAndPull
                                    x-enumDescriptions:
                                      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
                                  enable_delta_sync:
                                    description: >-
                                      This will turn on delta-sync for the
                                      replication. In order to enable delta-sync
                                      for a replication, the database level
                                      setting `delta_sync.enabled` must also be
                                      set to true.


                                      Using delta-sync is an Enterprise Edition
                                      only feature.
                                    type: boolean
                                    default: false
                                  filter:
                                    description: This defines whether to filter documents.
                                    type: string
                                    enum:
                                      - sync_gateway/bychannel
                                      - ''
                                    x-enumDescriptions:
                                      '': Do not filter any documents.
                                      sync_gateway/bychannel: >-
                                        If set, a pull replication will be
                                        limited to a specific set of channels
                                        specified by the `query_param.channels`
                                        property.
                                  initial_state:
                                    description: >-
                                      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`.
                                    type: string
                                    default: running
                                    enum:
                                      - running
                                      - stopped
                                    x-enumDescriptions:
                                      running: >-
                                        The replication will immediately start
                                        running.
                                      stopped: >-
                                        The replication configuration will be
                                        created but the replication will not
                                        start running until the user explicitly
                                        starts it.
                                  max_backoff_time:
                                    description: >-
                                      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.
                                    type: integer
                                    default: 5
                                  purge_on_removal:
                                    description: >-
                                      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.
                                    type: boolean
                                    default: false
                                  query_params:
                                    description: >-
                                      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:

                                      ```json

                                      "filter":"sync_gateway/bychannel",

                                      "query_params": {
                                        "channels":["chanUser1"]
                                      },

                                      ```
                                    type: array
                                    items:
                                      type: string
                                  remote:
                                    description: >-
                                      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,
                                      `https://localhost:4985/db`.
                                    type: string
                                  remote_password:
                                    description: >-
                                      The password to use to authenticate with
                                      the remote. This password will be redacted
                                      in the replication config.
                                    type: string
                                  remote_username:
                                    description: >-
                                      The username to use to authenticate with
                                      the remote.
                                    type: string
                                  replication_id:
                                    description: >-
                                      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.
                                    type: string
                                    maximum: 160
                                  run_as:
                                    description: >-
                                      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.
                                    type: string
                                  password:
                                    description: >-
                                      **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.
                                    type: string
                                    deprecated: true
                                  username:
                                    description: >-
                                      **This has been deprecated in favour of
                                      `remote_username`.**


                                      This is the username to use to
                                      authenticate with the remote.
                                    type: string
                                    deprecated: true
                                required:
                                  - direction
                                title: User configurable replication properties
                              status:
                                description: >-
                                  This is the state that the replicator is in or
                                  that trying to transition in to.
                                type: string
                                enum:
                                  - running
                                  - stopped
                                  - resetting
                                  - error
                                  - starting
                                  - reconnecting
                                x-enumDescriptions:
                                  running: Currently running replication.
                                  stopped: Not running replication.
                                  resetting: The replication is resetting its state.
                                  error: The replication is stopped due to an error.
                                  starting: The replication is starting up.
                                  reconnecting: >-
                                    The replication is reconnecting to the
                                    remote database.
                                title: Replication Status
                              error_message:
                                description: >-
                                  The error message of the replication if an
                                  error has occurred.
                                type: string
                              docs_read:
                                description: >-
                                  The number of documents that have been read
                                  (fetched) from the source database.
                                type: integer
                              docs_checked_pull:
                                type: integer
                              docs_purged:
                                description: The number of documents that have been purged.
                                type: integer
                              rejected_by_local:
                                description: >-
                                  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.
                                type: integer
                              last_seq_pull:
                                description: >-
                                  The last changes sequence number that was
                                  pulled from the remote.
                                type: string
                              deltas_recv:
                                description: >-
                                  The number of deltas that have been received
                                  from the remote.
                                type: integer
                              deltas_requested:
                                type: integer
                              docs_written:
                                description: >-
                                  The number of documents that have been wrote
                                  (pushed) to the target database.
                                type: integer
                              docs_checked_push:
                                type: integer
                              doc_write_failures:
                                description: >-
                                  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.
                                type: integer
                              doc_write_conflicts:
                                description: The number of documents that had a conflict.
                                type: integer
                              rejected_by_remote:
                                description: >-
                                  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.
                                type: integer
                              last_seq_push:
                                description: >-
                                  The last changes sequence number that was
                                  pushed to the remote.
                                type: string
                              deltas_sent:
                                description: >-
                                  The number of deltas that have been sent to
                                  the remote. 
                                type: integer
                            required:
                              - replication_id
                            title: Replication-status
                        cluster:
                          type: object
                          properties:
                            cluster_uuid:
                              description: The cluster unique identifier.
                              type: string
                            replication:
                              description: >-
                                Map of replication configs defined for the
                                cluster.
                              type: object
                              properties:
                                replication_id:
                                  description: Properties of a replication
                                  allOf:
                                    - type: object
                                      properties:
                                        replication_id:
                                          description: This is the ID of the replication.
                                          type: string
                                    - description: Properties of a replication
                                      type: object
                                      x-requirePropertiesSorted: true
                                      properties:
                                        adhoc:
                                          description: >-
                                            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.
                                          type: boolean
                                          default: false
                                        batch_size:
                                          description: >-
                                            The amount of changes to be sent in one
                                            batch of replications. Changing this is
                                            an Enterprise Edition only feature.
                                          type: integer
                                          default: 200
                                        collections_enabled:
                                          description: >-
                                            If true, the replicator will run with
                                            collections, and will replicate all
                                            collections, unless otherwise limited by
                                            `collections_local`.


                                            If false, the replicator will only
                                            replicate the default collection.
                                          type: boolean
                                          default: false
                                        collections_local:
                                          description: >-
                                            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.
                                          type: array
                                          items:
                                            type: string
                                          example:
                                            - scope1.collection1
                                            - scope1.collection3
                                            - scope1.collection6
                                          default: []
                                        collections_remote:
                                          description: >-
                                            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.
                                          type: array
                                          items:
                                            type: string
                                            nullable: true
                                          example:
                                            - scope1.collectionA
                                            - null
                                            - scope1.collectionF
                                          default: []
                                        conflict_resolution_type:
                                          description: >-
                                            This defines what conflict resolution
                                            policy Sync Gateway should use to apply
                                            when resolving conflicting revisions.


                                            Changing this is an Enterprise Edition
                                            only feature.
                                          type: string
                                          default: default
                                          enum:
                                            - default
                                            - remoteWins
                                            - localWins
                                            - custom
                                          x-enumDescriptions:
                                            default: |-
                                              This will use:
                                                - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                                                - The revision with the most recent timestamp wins.
                                                - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                                            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.
                                        continuous:
                                          description: >-
                                            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.
                                          type: boolean
                                          default: false
                                        custom_conflict_resolver:
                                          description: >-
                                            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
                                            document's body. This can be the winning
                                            revision (for example, `return
                                            conflict.LocalDocument`), a new body, or
                                            `nil` to resolve as a delete.


                                            Example:


                                            ```javascript

                                            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.


                                            If a document merge is being done, the
                                            `_rev` and `_cv` properties should not
                                            be included in the returned document
                                            body as Sync Gateway will generate new
                                            values for these.


                                            This is an Enterprise Edition only
                                            feature.
                                          type: string
                                          default: ''
                                        direction:
                                          description: >-
                                            This specifies which direction the
                                            replication will be replicating with the
                                            `remote` replicator.
                                          type: string
                                          enum:
                                            - push
                                            - pull
                                            - pushAndPull
                                          x-enumDescriptions:
                                            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
                                        enable_delta_sync:
                                          description: >-
                                            This will turn on delta-sync for the
                                            replication. In order to enable
                                            delta-sync for a replication, the
                                            database level setting
                                            `delta_sync.enabled` must also be set to
                                            true.


                                            Using delta-sync is an Enterprise
                                            Edition only feature.
                                          type: boolean
                                          default: false
                                        filter:
                                          description: >-
                                            This defines whether to filter
                                            documents.
                                          type: string
                                          enum:
                                            - sync_gateway/bychannel
                                            - ''
                                          x-enumDescriptions:
                                            '': Do not filter any documents.
                                            sync_gateway/bychannel: >-
                                              If set, a pull replication will be
                                              limited to a specific set of channels
                                              specified by the `query_param.channels`
                                              property.
                                        initial_state:
                                          description: >-
                                            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`.
                                          type: string
                                          default: running
                                          enum:
                                            - running
                                            - stopped
                                          x-enumDescriptions:
                                            running: >-
                                              The replication will immediately start
                                              running.
                                            stopped: >-
                                              The replication configuration will be
                                              created but the replication will not
                                              start running until the user explicitly
                                              starts it.
                                        max_backoff_time:
                                          description: >-
                                            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.
                                          type: integer
                                          default: 5
                                        purge_on_removal:
                                          description: >-
                                            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.
                                          type: boolean
                                          default: false
                                        query_params:
                                          description: >-
                                            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:

                                            ```json

                                            "filter":"sync_gateway/bychannel",

                                            "query_params": {
                                              "channels":["chanUser1"]
                                            },

                                            ```
                                          type: array
                                          items:
                                            type: string
                                        remote:
                                          description: >-
                                            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,
                                            `https://localhost:4985/db`.
                                          type: string
                                        remote_password:
                                          description: >-
                                            The password to use to authenticate with
                                            the remote. This password will be
                                            redacted in the replication config.
                                          type: string
                                        remote_username:
                                          description: >-
                                            The username to use to authenticate with
                                            the remote.
                                          type: string
                                        replication_id:
                                          description: >-
                                            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.
                                          type: string
                                          maximum: 160
                                        run_as:
                                          description: >-
                                            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.
                                          type: string
                                        password:
                                          description: >-
                                            **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.
                                          type: string
                                          deprecated: true
                                        username:
                                          description: >-
                                            **This has been deprecated in favour of
                                            `remote_username`.**


                                            This is the username to use to
                                            authenticate with the remote.
                                          type: string
                                          deprecated: true
                                      required:
                                        - direction
                                      title: User configurable replication properties
                                    - type: object
                                      properties:
                                        assigned_node:
                                          description: >-
                                            The unique ID of the node assigned to
                                            the replication.
                                          type: string
                                        target_state:
                                          description: >-
                                            This is the state that the replicator is
                                            in or that trying to transition in to.
                                          type: string
                                          enum:
                                            - running
                                            - stopped
                                            - resetting
                                            - error
                                            - starting
                                            - reconnecting
                                          x-enumDescriptions:
                                            running: Currently running replication.
                                            stopped: Not running replication.
                                            resetting: The replication is resetting its state.
                                            error: >-
                                              The replication is stopped due to an
                                              error.
                                            starting: The replication is starting up.
                                            reconnecting: >-
                                              The replication is reconnecting to the
                                              remote database.
                                          title: Replication Status
                                        cluster_uuid:
                                          description: The cluster unique identifier.
                                          type: string
                                  title: Replication
                            nodes:
                              description: Map of all Sync Gateway nodes in the cluster.
                              type: object
                              properties:
                                node_uuid:
                                  description: The nodes unique identifier.
                                  type: object
                                  properties:
                                    uuid:
                                      description: The nodes unique identifier.
                                      type: string
                                    host:
                                      description: The nodes host name.
                                      type: string
                  version:
                    description: >-
                      The product version including the build number and edition
                      (ie. `EE` or `CE`).


                      Blank if `api.hide_product_version=true` in the startup
                      configuration.
                    type: string
                  vendor:
                    allOf:
                      - description: Product vendor
                        type: object
                        properties:
                          name:
                            description: Product name
                            type: string
                            example: Couchbase Sync Gateway
                          version:
                            description: |-
                              API version.
                              Omitted if `api.hide_product_version=true`
                            type: string
                            example: 3.1
                        required:
                          - name
                        title: Vendor
                title: Status
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  /_sgcollect_info:
    get:
      summary: Get the status of the Sync Gateway Collect Info
      operationId: get__sgcollect_info
      tags:
        - Server
      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
      responses:
        '200':
          description: Returned sgcollect_info status
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    description: The status of sgcollect_info.
                    type: string
                    enum:
                      - stopped
                      - running
                required:
                  - status
    post:
      summary: Start Sync Gateway Collect 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
      requestBody:
        description: sgcollect_info options
        content:
          application/json:
            schema:
              type: object
              properties:
                redact_level:
                  description: The redaction level to use for redacting the collected logs.
                  type: string
                  default: partial
                  enum:
                    - partial
                    - none
                redact_salt:
                  description: The salt to use for the log redactions.
                  type: string
                output_dir:
                  description: >-
                    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`.
                  type: string
                  default: >-
                    The configured path set in the startup config
                    `logging.log_file_path`
                upload:
                  description: |-
                    If set, upload the logs to Couchbase Support.

                    A customer name must be set if this is set.
                  type: boolean
                upload_host:
                  description: The host to send the logs too.
                  type: string
                  default: 'https://uploads.couchbase.com'
                upload_proxy:
                  description: The proxy to use while uploading the logs.
                  type: string
                customer:
                  description: The customer name to use when uploading the logs.
                  type: string
                ticket:
                  description: The Zendesk ticket number to use when uploading logs.
                  type: string
                  maxLength: 7
                  minLength: 1
      operationId: post__sgcollect_info
      tags:
        - Server
      responses:
        '200':
          description: Successfully started sgcollect_info
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    description: The new sgcollect_info status.
                    type: string
                    default: started
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '500':
          description: An error occurred while trying to run sgcollect_info
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
    delete:
      summary: Cancel the Sync Gateway Collect Info job
      operationId: delete__sgcollect_info
      tags:
        - Server
      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
      responses:
        '200':
          description: Job cancelled successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    description: The new status of sgcollect_info.
                    type: string
                    default: cancelled
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  /_debug/pprof/goroutine:
    get:
      summary: Get goroutine profile
      operationId: get__debug-pprof-goroutine
      tags:
        - Profiling
      description: |-
        Stack traces of all current goroutines.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          description: >-
            If set, collect a delta profile for the given duration, instead of a
            snapshot.
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
    post:
      summary: Get goroutine profile
      operationId: post__debug-pprof-goroutine
      tags:
        - Profiling
      description: |-
        Stack traces of all current goroutines.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          description: >-
            If set, collect a delta profile for the given duration, instead of a
            snapshot.
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
  /_debug/pprof/cmdline:
    get:
      summary: Get passed in command line parameters
      operationId: get__debug-pprof-cmdline
      tags:
        - Profiling
      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
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                type: string
    post:
      summary: Get passed in command line parameters
      operationId: post__debug-pprof-cmdline
      tags:
        - Profiling
      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
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                type: string
  /_debug/pprof/symbol:
    get:
      summary: Get symbol pprof debug information
      operationId: get__debug-pprof-symbol
      tags:
        - Profiling
      description: |-
        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                type: string
    post:
      summary: Get symbol pprof debug information
      operationId: post__debug-pprof-symbol
      tags:
        - Profiling
      description: |-
        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                type: string
  /_debug/pprof/heap:
    get:
      summary: Get the heap pprof debug file
      operationId: get__debug-pprof-heap
      tags:
        - Profiling
      description: |-
        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          description: >-
            If set, collect a delta profile for the given duration, instead of a
            snapshot.
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
    post:
      summary: Get the heap pprof debug file
      operationId: post__debug-pprof-heap
      tags:
        - Profiling
      description: |-
        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          description: >-
            If set, collect a delta profile for the given duration, instead of a
            snapshot.
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
  /_debug/pprof/profile:
    get:
      summary: Get the profile pprof debug file
      operationId: get__debug-pprof-profile
      tags:
        - Profiling
      description: |-
        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          description: >-
            If set, collect a delta profile for the given duration, instead of a
            snapshot.
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
    post:
      summary: Get the profile pprof debug file
      operationId: post__debug-pprof-profile
      tags:
        - Profiling
      description: |-
        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          description: >-
            If set, collect a delta profile for the given duration, instead of a
            snapshot.
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
  /_debug/pprof/block:
    get:
      summary: Get block profile
      operationId: get__debug-pprof-block
      tags:
        - Profiling
      description: |-
        Returns stack traces that led to blocking on synchronization primitives.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          required: false
          schema:
            type: integer
            default: 30
            minimum: 0
          description: The amount of seconds to run the profiler for.
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: forbidden
                reason: Can only run one mutex profile at a time
    post:
      summary: Get block profile
      operationId: post__debug-pprof-block
      tags:
        - Profiling
      description: |-
        Returns stack traces that led to blocking on synchronization primitives.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          required: false
          schema:
            type: integer
            default: 30
            minimum: 0
          description: The amount of seconds to run the profiler for.
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: forbidden
                reason: Can only run one mutex profile at a time
  /_debug/pprof/threadcreate:
    get:
      summary: Get the threadcreate pprof debug file
      operationId: get__debug-pprof-threadcreate
      tags:
        - Profiling
      description: |-
        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
    post:
      summary: Get the threadcreate pprof debug file
      operationId: post__debug-pprof-threadcreate
      tags:
        - Profiling
      description: |-
        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
  /_debug/pprof/mutex:
    get:
      summary: Get mutex profile
      operationId: get__debug-pprof-mutex
      tags:
        - Profiling
      description: |-
        Returns stack traces of holders of contended mutexes.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          required: false
          schema:
            type: integer
            default: 30
            minimum: 0
          description: The amount of seconds to run the profiler for.
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: forbidden
                reason: Can only run one mutex profile at a time
    post:
      summary: Get mutex profile
      operationId: post__debug-pprof-mutex
      tags:
        - Profiling
      description: |-
        Returns stack traces of holders of contended mutexes.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          required: false
          schema:
            type: integer
            default: 30
            minimum: 0
          description: The amount of seconds to run the profiler for.
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: forbidden
                reason: Can only run one mutex profile at a time
  /_debug/pprof/trace:
    get:
      summary: Get trace profile
      operationId: get__debug-pprof-trace
      tags:
        - Profiling
      description: |-
        Responds with the execution trace in binary form.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          schema:
            type: integer
            default: 1
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
    post:
      summary: Get trace profile
      operationId: post__debug-pprof-trace
      tags:
        - Profiling
      description: |-
        Responds with the execution trace in binary form.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          schema:
            type: integer
            default: 1
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                description: pprof binary data
                type: string
                example: pprof binary data
  /_debug/fgprof:
    get:
      summary: Get fgprof profile
      operationId: get__debug-fgprof
      tags:
        - Profiling
      description: >-
        A sampling Go profiler that allows you to analyze On-CPU as well as
        [Off-CPU](https://www.brendangregg.com/offcpuanalysis.html) (e.g. I/O)
        time together.


        Required Sync Gateway RBAC roles:


        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          required: false
          schema:
            type: integer
            default: 30
            minimum: 0
          description: The amount of seconds to run the profiler for.
      responses:
        '200':
          description: OK
          content:
            application/x-gzip:
              schema:
                type: string
    post:
      summary: Get fgprof profile
      operationId: post__debug-fgprof
      tags:
        - Profiling
      description: >-
        A sampling Go profiler that allows you to analyze On-CPU as well as
        [Off-CPU](https://www.brendangregg.com/offcpuanalysis.html) (e.g. I/O)
        time together.


        Required Sync Gateway RBAC roles:


        * Sync Gateway Dev Ops
      parameters:
        - name: seconds
          in: query
          required: false
          schema:
            type: integer
            default: 30
            minimum: 0
          description: The amount of seconds to run the profiler for.
      responses:
        '200':
          description: OK
          content:
            application/x-gzip:
              schema:
                type: string
  /_post_upgrade:
    post:
      summary: Run the post upgrade process on all databases
      operationId: post__post_upgrade
      tags:
        - Server
      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:
        - name: preview
          in: query
          description: 'If set, a dry-run will be done to return what would be removed.'
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Returned results
          content:
            application/json:
              schema:
                type: object
                properties:
                  post_upgrade_results:
                    description: A map of databases.
                    type: object
                    additionalProperties:
                      x-additionalPropertiesName: db
                      description: The name of the database that was targetted.
                      type: object
                      properties:
                        removed_design_docs:
                          description: The design documents that have or will be removed.
                          type: array
                          items:
                            type: string
                        removed_indexes:
                          description: The indexes that have or will be removed.
                          type: array
                          items:
                            type: string
                          example:
                            - '`_default`.`_default`.syncDocs_x1`'
                            - '`scope`.`collection1`.sg_allDocs_1'
                      required:
                        - removed_design_docs
                        - removed_indexes
                  preview:
                    description: >-
                      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.
                    type: boolean
                required:
                  - post_upgrade_results
  '/{db}/_config':
    get:
      summary: Get database configuration
      operationId: get_db-_config
      tags:
        - Database Configuration
      description: |-
        Retrieve the full configuration for the database specified.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Architect
      parameters:
        - name: redact
          in: query
          deprecated: true
          required: false
          schema:
            type: boolean
            default: true
          description: No longer supported field.
        - name: include_javascript
          in: query
          description: >-
            Include the fields that have Javascript functions in the response.
            E.g. sync function, import filter, and event handlers.
          schema:
            type: boolean
            default: true
        - name: include_runtime
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: 'Whether to include the values set at runtime, and default values.'
        - name: refresh_config
          in: query
          description: Forces the configuration to be reloaded on the Sync Gateway node.
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Successfully retrieved database configuration
          headers:
            Etag:
              schema:
                type: string
              description: >-
                The database configuration version. Use with If-Match for
                optimistic concurrency control.
          content:
            application/json:
              schema:
                description: The properties of a database configuration.
                type: object
                x-requirePropertiesSorted: true
                properties:
                  allow_empty_password:
                    description: >-
                      This controls whether users that are created can have an
                      empty password or not.
                    type: boolean
                    default: false
                  bucket:
                    description: The Couchbase Server backing bucket for the database.
                    type: string
                    default: The database name
                  bucket_op_timeout_ms:
                    description: >-
                      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`.
                    type: number
                  cacertpath:
                    description: The root CA cert path for X.509 bucket authentication.
                    type: string
                  cache:
                    type: object
                    x-requirePropertiesSorted: true
                    properties:
                      channel_cache:
                        description: The channel cache config settings.
                        x-requirePropertiesSorted: true
                        type: object
                        properties:
                          compact_high_watermark_pct:
                            description: >-
                              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.
                            type: integer
                            default: 80
                          compact_low_watermark_pct:
                            description: >-
                              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.
                            type: integer
                            default: 60
                          expiry_seconds:
                            description: >-
                              The amount of time (in seconds) to keep entries in
                              the cache beyond the minimum retained.
                            type: integer
                            default: 60
                          max_length:
                            description: >-
                              The maximum number of entries to maintain in the
                              cache per channel.
                            type: integer
                            default: 500
                          max_num_pending:
                            description: >-
                              The maximum number of pending sequences before
                              skipping sequences.
                            type: integer
                            default: 10000
                          max_number:
                            description: >-
                              The maximum number of channel caches which can
                              exist at any one point.
                            type: integer
                            default: 50000
                          max_wait_pending:
                            description: >-
                              The maximum time (in milliseconds) for waiting for
                              a pending sequence before skipping it.
                            type: number
                            default: 5000
                          max_wait_skipped:
                            description: >-
                              The maximum amount of time (in milliseconds) to
                              wait for a skipped sequence before abandoning it.
                            type: number
                            default: 3600000
                          min_length:
                            description: >-
                              The minimum number of entries to maintain in the
                              cache per channel.
                            type: integer
                            default: 50
                          enable_star_channel:
                            description: >-
                              Since Sync Gateway 4.0, this option no longer has
                              an effect, the star channel is always enabled.

                              If this value is set to false, a database can only
                              exist in the offline state until this
                              configuration is modified.
                            type: boolean
                            default: true
                            deprecated: true
                          query_limit:
                            description: >-
                              **Deprecated in favour of the database setting
                              `query_pagination_limit`**


                              The limit used for channel queries.
                            type: integer
                            default: 5000
                            deprecated: true
                      rev_cache:
                        description: The revision cache config settings.
                        type: object
                        properties:
                          max_memory_count_mb:
                            description: >-
                              The maximum amount of memory the revision cache
                              should take up in MB, setting to 0 will disable
                              any eviction based on memory at rev cache.

                              There is a minimum value of 50 (50MB) for this
                              config option.

                              When set this memory limit will work in in hand
                              with revision cache size parameter. So you will
                              potentially get eviction at revision cache both
                              based off memory footprint and number of items in
                              the cache.

                              **This is an Enterprise Edition feature only**
                            type: integer
                            default: 0
                          shard_count:
                            description: >-
                              The number of shards the revision cache should be
                              split into.
                            type: integer
                            default: 16
                          size:
                            description: >-
                              The maximum number of revisions that can be stored
                              in the revision cache.

                              Note when running with greater than 1 shard count
                              we add 10% capacity overall to avoid early
                              eviction when some shards fill up before others,
                              so

                              you may find that the capacity stat
                              (revision_cache_num_items) will climb to the
                              defined rev cache size + 10%.
                            type: integer
                            default: 5000
                      channel_cache_expiry:
                        description: >-
                          **Deprecated, please use the database setting
                          `cache.channel_cache.expiry_seconds` instead**


                          The time (seconds) to keep entries in cache beyond the
                          minimum retained.
                        type: integer
                        deprecated: true
                      channel_cache_max_length:
                        description: >-
                          **Deprecated, please use the database setting
                          `cache.channel_cache.max_length` instead**


                          The maximum number of entries maintained in cache per
                          channel.
                        type: number
                        deprecated: true
                      channel_cache_min_length:
                        description: >-
                          **Deprecated, please use the database setting
                          `cache.channel_cache.min_length` instead**


                          The minimum number of entries maintained in cache per
                          channel.
                        type: integer
                        deprecated: true
                      enable_star_channel:
                        description: >-
                          **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.
                        type: boolean
                        deprecated: true
                      max_num_pending:
                        description: >-
                          **Deprecated, please use the database setting
                          `cache.channel_cache.max_num_pending` instead**


                          The max number of pending sequences before skipping.
                        type: integer
                        deprecated: true
                      max_wait_pending:
                        description: >-
                          **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.
                        type: number
                        deprecated: true
                      max_wait_skipped:
                        description: >-
                          **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.
                        type: number
                        deprecated: true
                  certpath:
                    description: The cert path (public key) for X.509 bucket auth.
                    type: string
                  changes_request_plus:
                    type: boolean
                    default: false
                    description: >-
                      Sets the default value of `request_plus` for
                      one-shot/non-continuous changes feeds, which when true,
                      ensures all valid documents written prior to the request
                      being issued are included in the response. Setting this
                      option at the database level is required to ensure
                      Couchbase Lite utilizes this changes feed mode.


                      This also sets the default value of query param
                      `request_plus` for [GET
                      /{keyspace}/_changes](#operation/get_keyspace-_changes) or
                      `request_plus` for [POST
                      /{keyspace}/_changes](#operation/post_keyspace-_changes).
                  client_partition_window_secs:
                    description: >-
                      How long (in seconds) clients can remain offline for
                      without losing replication metadata.


                      Defaults to 30 days (in seconds)
                    type: integer
                    default: 2592000
                  compact_interval_days:
                    description: >-
                      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.
                    type: number
                    default: 1
                  cors:
                    allOf:
                      - type: object
                        properties:
                          headers:
                            description: >-
                              List of allowed headers. These headers will be
                              added the `Access-Control-Allow-Headers` response
                              to a valid CORS request.


                              A recommended minimum set of values should be
                              `["Accept-Encoding", "Authorization",
                              "Content-Type", "If-Match"]`.
                            type: array
                            items:
                              type: string
                            example:
                              - Accept-Encoding
                              - Authorization
                              - Content-Type
                              - If-Match
                          login_origin:
                            description: >-
                              List of allowed origins to apply to public
                              `/{db}/_session` API.


                              To use cors on `/{db}/_session`, the domain must
                              be present in both `login_origin` and `origin`.


                              If configured, `Authorization` must be included in
                              headers.
                            type: array
                            items:
                              type: string
                            example:
                              - 'https://example.com'
                          max_age:
                            description: >-
                              Value for `Access-Control-Maximum-Age`. Uses 0 by
                              default.
                            type: integer
                            default: 0
                          origin:
                            description: >-
                              List of allowed origins for the public API. The
                              request `Origin` header is checked against these
                              values. If successful the `Origin` header is
                              returned in the HTTP response header as
                              `Access-Control-Allow-Origin`.
                            type: array
                            items:
                              type: string
                            example:
                              - 'https://example.com'
                        title: Cors Configuration
                      - type: object
                        description: >-
                          CORS configuration for this database; if present,
                          overrides server's config.
                  delta_sync:
                    description: |-
                      Delta sync configuration settings.

                      **This is an Enterprise Edition feature only**
                    type: object
                    properties:
                      enabled:
                        description: |-
                          Whether delta sync is enabled.

                          **This is an Enterprise Edition feature only**
                        type: boolean
                        default: false
                      rev_max_age_seconds:
                        description: >-
                          The number of seconds deltas for old revisions are
                          available for.


                          This defaults to 24 hours (in seconds).
                        type: number
                        default: 86400
                  disable_password_auth:
                    description: >-
                      Whether to disable username/password authentication and
                      only allow OIDC and guest access.
                    type: boolean
                    default: false
                  disable_public_all_docs:
                    description: >-
                      This controls whether the [GET
                      /{keyspace}/_all_docs](#operation/get_keyspace-_all_docs)
                      REST API endpoint is publicly accessible or not.

                      Disabling this endpoint is recommended for larger datasets
                      or production workloads.

                      [GET
                      /{keyspace}/_changes](#operation/get_keyspace-_changes) or
                      [POST
                      /{keyspace}/_bulk_get](#operation/post_keyspace-_bulk_get)
                      have more efficient implementations and should be used
                      instead.


                      If set to `true`, the endpoint will not be publicly
                      accessible, and will only be available on the Admin API.

                      Setting this to `false`, or leaving it as the default
                      value is deprecated, and may default to `true` in a future
                      release.
                    type: boolean
                    default: false
                  event_handlers:
                    description: These are the settings for webhooks.
                    type: object
                    properties:
                      db_state_changed:
                        type: object
                        properties:
                          handler:
                            description: The handler type.
                            type: string
                            enum:
                              - webhook
                          url:
                            description: The URL of the webhook.
                            type: string
                          filter:
                            description: >-
                              The Javascript function to use to filter the
                              webhook events.
                            type: string
                          timeout:
                            description: >-
                              The amount of time (in seconds) to attempt connect
                              to the webhook before giving up.
                            type: number
                        title: Event-config
                      document_changed:
                        allOf:
                          - type: object
                            properties:
                              handler:
                                description: The handler type.
                                type: string
                                enum:
                                  - webhook
                              url:
                                description: The URL of the webhook.
                                type: string
                              filter:
                                description: >-
                                  The Javascript function to use to filter the
                                  webhook events.
                                type: string
                              timeout:
                                description: >-
                                  The amount of time (in seconds) to attempt
                                  connect to the webhook before giving up.
                                type: number
                            title: Event-config
                          - type: object
                            properties:
                              options:
                                description: Options for the document changed event.
                                type: object
                                properties:
                                  winning_rev_only:
                                    description: >-
                                      If true, only the winning revision of the
                                      document will be sent to the webhook.
                                    type: boolean
                                    default: false
                      max_processes:
                        description: >-
                          The maximum amount of concurrent event handling
                          independent functions that can be running at the same
                          time.
                        type: string
                      wait_for_process:
                        description: >-
                          The maximum amount of time (in milliseconds) to wait
                          when the even queue is full.
                        type: string
                  guest:
                    description: Properties associated with a user
                    type: object
                    properties:
                      name:
                        description: >-
                          The name of the user.


                          User names can only have alphanumeric ASCII characters
                          and underscores.
                        type: string
                      password:
                        description: >-
                          The password of the user.


                          Mandatory. unless `allow_empty_password` is `true` in
                          the database configs.
                        type: string
                      admin_channels:
                        description: >-
                          A list of channels to explicitly grant to the user for
                          the default collection.

                          See `collection_access` for channels in named
                          collections.
                        type: array
                        items:
                          type: string
                      all_channels:
                        description: >-
                          All the channels that the user has been granted access
                          to for the default collection.

                          See `collection_access` for channels in named
                          collections.


                          Access could have been granted through the sync
                          function, roles, or explicitly on the user under the
                          `admin_channels` property.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      email:
                        description: The email address of the user.
                        type: string
                      disabled:
                        description: >-
                          If true, the user will not be able to login to the
                          account as it is disabled.
                        type: boolean
                        default: false
                      admin_roles:
                        description: A list of roles to explicitly grant to the user.
                        type: array
                        items:
                          type: string
                      roles:
                        description: >-
                          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.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_roles:
                        description: >-
                          The roles that the user has been added to through
                          roles_claim.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_channels:
                        description: >-
                          The channels that the user has been granted access to
                          through channels_claim for the default collection.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_issuer:
                        description: >-
                          The issuer of the last JSON Web Token that the user
                          last used to sign in.
                        type: string
                        readOnly: true
                      jwt_last_updated:
                        description: >-
                          The last time that the user's JWT roles/channels were
                          updated.
                        type: string
                        format: date-time
                        readOnly: true
                      collection_access:
                        description: >-
                          A set of access grants by scope and collection for a
                          specific collection.
                        type: object
                        additionalProperties:
                          maxProperties: 1
                          description: >-
                            An object keyed by scope, containing a set of
                            collections.
                          type: object
                          x-additionalPropertiesName: scopename
                          additionalProperties:
                            description: >-
                              An object keyed by collection name, defines access
                              collections in this scope.
                            type: object
                            x-additionalPropertiesName: collectionname
                            properties:
                              admin_channels:
                                description: >-
                                  A list of channels to explicitly grant to the
                                  user in this collection.
                                type: array
                                items:
                                  type: string
                              all_channels:
                                description: >-
                                  All the channels that the user has been
                                  granted access to in this collection.


                                  Access could have been granted through the
                                  sync function, roles, or explicitly on the
                                  user under the `admin_channels` property.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_channels:
                                description: >-
                                  The channels that the user has been granted
                                  access to through channels_claim for this
                                  collection.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_last_updated:
                                description: >-
                                  The last time that the user's JWT channels
                                  were updated for this collection.
                                type: string
                                format: date-time
                                readOnly: true
                    title: User
                  import_backup_old_rev:
                    description: >-
                      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.
                    type: boolean
                    default: false
                  import_docs:
                    description: >-
                      If true, documents will be imported in to Sync Gateway
                      from the bucket in the background. 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 value requires
                      `enable_shared_bucket_access=true`.


                      This can also be set to the string `continuous` which maps
                      to true.
                    type: boolean
                  import_filter:
                    description: >-
                      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.
                    type: string
                    example: >-
                      function(doc) { if (doc.type != 'mobile') { return false;
                      } return true; }
                  import_partitions:
                    description: >-
                      ** 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.
                    type: number
                    default: 16
                    minimum: 1
                    maximum: 1024
                  index:
                    description: Global Secondary Index Settings
                    properties:
                      num_partitions:
                        description: >-
                          The number of partitions to use for the large indexes
                          created by Sync Gateway. It is not recommended to set
                          this unless you require additional horizontal
                          scalability for individual indexes and have
                          appropriately scaled your Query nodes to handle the
                          increased query parallelism. If set, the recommended
                          number is 8 and does not need to be directly related
                          to the number of your Query nodes. Ensure
                          documentation is read to understand the performance
                          tradeoffs and instructions for migration if you have
                          previously run with only one partition. See
                          [/{db}/_index_init](#operation/post_db-_index_init)
                          for more information.


                          If not specified or 1, all indexes will be non
                          partitioned.
                        type: number
                        default: 1
                        title: Number of Index Partitions
                      num_replicas:
                        description: >-
                          This is the number of Global Secondary Indexes (GSI)
                          to use for core indexes.
                        type: number
                        default: 1
                  javascript_timeout_secs:
                    description: >-
                      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.
                    type: number
                    default: 60
                  keypath:
                    description: The key path (private key) for X.509 bucket auth
                    type: string
                  kv_tls_port:
                    description: The Memcached TLS port.
                    type: integer
                    default: 11207
                  local_doc_expiry_secs:
                    description: >-
                      The number of seconds before a `_local` document should
                      expire.
                    type: integer
                    default: 7776000
                  local_jwt:
                    description: Configuration for Local JWT authentication.
                    type: object
                    additionalProperties:
                      x-additionalPropertiesName: providername
                      description: The providers name.
                      type: object
                      required:
                        - issuer
                        - client_id
                        - algorithms
                        - keys
                      properties:
                        algorithms:
                          description: >-
                            The JWT signing algorithms to accept for
                            authentication.
                          type: array
                          items:
                            type: string
                        channels_claim:
                          description: >-
                            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.
                          type: string
                        client_id:
                          description: >-
                            The value to match against the "aud" claim of JWTs.
                            Set to an empty string to disable audience
                            validation.
                          type: string
                        disable_session:
                          description: >-
                            Disable Sync Gateway session creation on successful
                            JWT authentication.
                          type: boolean
                        issuer:
                          description: The value to match against the "iss" claim of JWTs.
                          type: string
                        keys:
                          description: The JSON Web Keys to use to validate JWTs.
                          type: array
                          items:
                            type: object
                            properties:
                              alg:
                                type: string
                                description: The algorithm intended for use with the key.
                              crv:
                                type: string
                                description: >-
                                  For Elliptic Curve keys, the name of the curve
                                  to use.
                                enum:
                                  - P-256
                                  - P-384
                                  - P-521
                              e:
                                type: string
                                description: >-
                                  For RSA keys, the exponent of the public key,
                                  as a Base64urlUInt-encoded value.
                              kid:
                                type: string
                                description: 'The Key ID, used to identify the key to use.'
                              kty:
                                type: string
                                description: >-
                                  The cryptographic algorithm family used with
                                  the key, such as "RSA" or "EC"
                                enum:
                                  - RSA
                                  - EC
                              'n':
                                type: string
                                description: >-
                                  For RSA keys, the modulus value of the key, as
                                  a Base64urlUInt-encoded value.
                              use:
                                type: string
                                description: >-
                                  The intended use of the public key. Only 'sig'
                                  is accepted.
                                enum:
                                  - sig
                              x:
                                type: string
                                description: >-
                                  For Elliptic Curve keys, the X coordinate of
                                  the point, as a base64url string.
                              'y':
                                type: string
                                description: >-
                                  For Elliptic Curve keys, the Y coordinate of
                                  the point, as a base64url string.
                        register:
                          description: >-
                            If to register a new Sync Gateway user account when
                            a user logs in with a JWT.
                          type: boolean
                        roles_claim:
                          description: >-
                            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.
                          type: string
                        user_prefix:
                          description: >-
                            This is the username prefix for all users created
                            through this provider.
                          type: string
                        username_claim:
                          description: >-
                            Allows a different OpenID Connect field to be
                            specified instead of the Subject (`sub`).


                            The field name to use can be specified here.
                          type: string
                  logging:
                    description: Per-database logging configuration.
                    type: object
                    properties:
                      audit:
                        description: Audit logging configuration.
                        type: object
                        properties:
                          disabled_roles:
                            description: >-
                              List of roles for which audit logging is disabled.
                              Either cbs or sgw.
                            type: array
                            items:
                              type: object
                              properties:
                                domain:
                                  description: >
                                    The domain of the role for which audit
                                    logging is disabled.
                                  enum:
                                    - cbs
                                    - sgw
                                  x-enumDescription:
                                    cbs: Couchbase Server RBAC
                                    sgw: Sync Gateway Role
                                  type: string
                                name:
                                  description: >-
                                    The name of the role for which audit logging
                                    is disabled.
                                  type: string
                          disabled_users:
                            description: List of users for which audit logging is disabled.
                            type: array
                            items:
                              type: object
                              properties:
                                domain:
                                  description: >
                                    The domain of the user for which audit
                                    logging is disabled.
                                  type: string
                                  enum:
                                    - cbs
                                    - sgw
                                  x-enumDescription:
                                    cbs: Couchbase Server User
                                    sgw: Sync Gateway User
                                name:
                                  description: >-
                                    The name of the user for which audit logging
                                    is disabled.
                                  type: string
                          enabled:
                            description: Whether audit logging is enabled.
                            type: boolean
                            default: false
                          enabled_events:
                            description: List of enabled audit events for this database.
                            type: array
                            items:
                              type: number
                              example:
                                - 1234
                                - 5678
                      console:
                        description: Console logging configuration.
                        type: object
                        properties:
                          log_keys:
                            description: Log Keys for the console output
                            type: array
                            items:
                              type: string
                            example:
                              - CRUD
                              - HTTP
                              - Query
                          log_level:
                            description: Log Level for the console output
                            type: string
                            enum:
                              - none
                              - error
                              - warn
                              - info
                              - debug
                              - trace
                            example: debug
                  max_concurrent_query_ops:
                    description: >-
                      The maximum amount of query operations that can be running
                      at any one point.
                    type: integer
                    default: 1000
                  name:
                    description: The name of the database.
                    type: string
                  offline:
                    description: Start the database in an offline state.
                    type: boolean
                    default: false
                  oidc:
                    description: Configuration for OpenID Connect authentication.
                    type: object
                    properties:
                      default_provider:
                        description: >-
                          The default provider to use when the provider is not
                          specified in the client.
                        type: string
                      providers:
                        description: List of OpenID Connect issuers.
                        type: object
                        additionalProperties:
                          x-additionalPropertiesName: providername
                          description: The providers name.
                          type: object
                          properties:
                            InsecureSkipVerify:
                              description: >-
                                Determines whether the TLS certificate
                                verification should be disabled for this
                                provider. 
                              type: boolean
                              default: false
                            IsDefault:
                              description: >-
                                Indicates if this is the default OpenID Connect
                                provider.
                              type: boolean
                            Name:
                              description: The name of the OpenID Connect Provider.
                              type: string
                            allow_unsigned_provider_tokens:
                              description: >-
                                Allows users accept unsigned tokens from
                                providers.
                              type: boolean
                            callback_url:
                              description: >-
                                The URL that the OpenID Connect will redirect to
                                after authentication.


                                If not provided, a callback URL will be
                                generated.
                              type: string
                            channels_claim:
                              description: >-
                                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.
                              type: string
                            client_id:
                              description: The OpenID Connect provider client ID.
                              type: string
                            disable_callback_state:
                              description: >-
                                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).**
                              type: boolean
                              default: false
                            disable_cfg_validation:
                              description: >-
                                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.
                              type: boolean
                              default: false
                            disable_session:
                              description: >-
                                Disable Sync Gateway session creation on
                                successful OpenID Connect authentication.
                              type: boolean
                            discovery_url:
                              description: The non-standard discovery endpoint.
                              type: string
                            include_access:
                              description: >-
                                This is whether the `_oidc_callback` response
                                should include the OpenID Connect access token
                                and associated fields (such as `token_type`, and
                                `expires_in`).
                              type: boolean
                            issuer:
                              description: The URL for the OpenID Connect issuer.
                              type: string
                            register:
                              description: >-
                                If to register a new Sync Gateway user account
                                when a user logs in with OpenID Connect.
                              type: boolean
                            roles_claim:
                              description: >-
                                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.
                              type: string
                            scope:
                              description: The scope sent for the OpenID Connect request.
                              type: array
                              items:
                                type: string
                            user_prefix:
                              description: >-
                                This is the username prefix for all users
                                created through this provider.
                              type: string
                            username_claim:
                              description: >-
                                Allows a different OpenID Connect field to be
                                specified instead of the Subject (`sub`).


                                The field name to use can be specified here.
                              type: string
                            validation_key:
                              description: The OpenID Connect provider client secret.
                              type: string
                  old_rev_expiry_seconds:
                    description: >-
                      The number of seconds before old revisions are removed
                      from the Couchbase Server bucket.
                    type: number
                    default: 300
                  password:
                    description: The password for authenticating to the server.
                    type: string
                  query_pagination_limit:
                    description: >-
                      The query limit to be used during pagination of large
                      queries.
                    type: integer
                    default: 5000
                  replications:
                    type: object
                    properties:
                      replication_id:
                        description: Properties of a replication
                        type: object
                        x-requirePropertiesSorted: true
                        properties:
                          adhoc:
                            description: >-
                              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.
                            type: boolean
                            default: false
                          batch_size:
                            description: >-
                              The amount of changes to be sent in one batch of
                              replications. Changing this is an Enterprise
                              Edition only feature.
                            type: integer
                            default: 200
                          collections_enabled:
                            description: >-
                              If true, the replicator will run with collections,
                              and will replicate all collections, unless
                              otherwise limited by `collections_local`.


                              If false, the replicator will only replicate the
                              default collection.
                            type: boolean
                            default: false
                          collections_local:
                            description: >-
                              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.
                            type: array
                            items:
                              type: string
                            example:
                              - scope1.collection1
                              - scope1.collection3
                              - scope1.collection6
                            default: []
                          collections_remote:
                            description: >-
                              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.
                            type: array
                            items:
                              type: string
                              nullable: true
                            example:
                              - scope1.collectionA
                              - null
                              - scope1.collectionF
                            default: []
                          conflict_resolution_type:
                            description: >-
                              This defines what conflict resolution policy Sync
                              Gateway should use to apply when resolving
                              conflicting revisions.


                              Changing this is an Enterprise Edition only
                              feature.
                            type: string
                            default: default
                            enum:
                              - default
                              - remoteWins
                              - localWins
                              - custom
                            x-enumDescriptions:
                              default: |-
                                This will use:
                                  - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                                  - The revision with the most recent timestamp wins.
                                  - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                              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.
                          continuous:
                            description: >-
                              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.
                            type: boolean
                            default: false
                          custom_conflict_resolver:
                            description: >-
                              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 document's
                              body. This can be the winning revision (for
                              example, `return conflict.LocalDocument`), a new
                              body, or `nil` to resolve as a delete.


                              Example:


                              ```javascript

                              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.


                              If a document merge is being done, the `_rev` and
                              `_cv` properties should not be included in the
                              returned document body as Sync Gateway will
                              generate new values for these.


                              This is an Enterprise Edition only feature.
                            type: string
                            default: ''
                          direction:
                            description: >-
                              This specifies which direction the replication
                              will be replicating with the `remote` replicator.
                            type: string
                            enum:
                              - push
                              - pull
                              - pushAndPull
                            x-enumDescriptions:
                              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
                          enable_delta_sync:
                            description: >-
                              This will turn on delta-sync for the replication.
                              In order to enable delta-sync for a replication,
                              the database level setting `delta_sync.enabled`
                              must also be set to true.


                              Using delta-sync is an Enterprise Edition only
                              feature.
                            type: boolean
                            default: false
                          filter:
                            description: This defines whether to filter documents.
                            type: string
                            enum:
                              - sync_gateway/bychannel
                              - ''
                            x-enumDescriptions:
                              '': Do not filter any documents.
                              sync_gateway/bychannel: >-
                                If set, a pull replication will be limited to a
                                specific set of channels specified by the
                                `query_param.channels` property.
                          initial_state:
                            description: >-
                              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`.
                            type: string
                            default: running
                            enum:
                              - running
                              - stopped
                            x-enumDescriptions:
                              running: The replication will immediately start running.
                              stopped: >-
                                The replication configuration will be created
                                but the replication will not start running until
                                the user explicitly starts it.
                          max_backoff_time:
                            description: >-
                              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.
                            type: integer
                            default: 5
                          purge_on_removal:
                            description: >-
                              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.
                            type: boolean
                            default: false
                          query_params:
                            description: >-
                              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:

                              ```json

                              "filter":"sync_gateway/bychannel",

                              "query_params": {
                                "channels":["chanUser1"]
                              },

                              ```
                            type: array
                            items:
                              type: string
                          remote:
                            description: >-
                              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,
                              `https://localhost:4985/db`.
                            type: string
                          remote_password:
                            description: >-
                              The password to use to authenticate with the
                              remote. This password will be redacted in the
                              replication config.
                            type: string
                          remote_username:
                            description: >-
                              The username to use to authenticate with the
                              remote.
                            type: string
                          replication_id:
                            description: >-
                              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.
                            type: string
                            maximum: 160
                          run_as:
                            description: >-
                              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.
                            type: string
                          password:
                            description: >-
                              **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.
                            type: string
                            deprecated: true
                          username:
                            description: >-
                              **This has been deprecated in favour of
                              `remote_username`.**


                              This is the username to use to authenticate with
                              the remote.
                            type: string
                            deprecated: true
                        required:
                          - direction
                        title: User configurable replication properties
                  revs_limit:
                    description: The maximum depth a document's revision tree can grow to.
                    type: number
                    default: 50
                    minimum: 0
                  roles:
                    additionalProperties:
                      x-additionalPropertiesName: rolename
                      description: Properties associated with a role
                      type: object
                      properties:
                        name:
                          description: >-
                            The name of the role.


                            Role names can only have alphanumeric ASCII
                            characters and underscores.
                          type: string
                        admin_channels:
                          description: >-
                            A list of channels to explicitly grant to the role
                            for the default collection.

                            See `collection_access` for channels in named
                            collections.
                          type: array
                          items:
                            type: string
                        all_channels:
                          description: >-
                            All the channels that the role has been granted
                            access to for the default collection.


                            These channels could have been assigned by the Sync
                            function or using the `admin_channels` property.
                          type: array
                          items:
                            type: string
                          readOnly: true
                        collection_access:
                          description: >-
                            A set of access grants by scope and collection for a
                            specific collection.
                          type: object
                          additionalProperties:
                            maxProperties: 1
                            description: >-
                              An object keyed by scope, containing a set of
                              collections.
                            type: object
                            x-additionalPropertiesName: scopename
                            additionalProperties:
                              description: >-
                                An object keyed by collection name, defines
                                access collections in this scope.
                              type: object
                              x-additionalPropertiesName: collectionname
                              properties:
                                admin_channels:
                                  description: >-
                                    A list of channels to explicitly grant to
                                    the user in this collection.
                                  type: array
                                  items:
                                    type: string
                                all_channels:
                                  description: >-
                                    All the channels that the user has been
                                    granted access to in this collection.


                                    Access could have been granted through the
                                    sync function, roles, or explicitly on the
                                    user under the `admin_channels` property.
                                  type: array
                                  items:
                                    type: string
                                  readOnly: true
                                jwt_channels:
                                  description: >-
                                    The channels that the user has been granted
                                    access to through channels_claim for this
                                    collection.
                                  type: array
                                  items:
                                    type: string
                                  readOnly: true
                                jwt_last_updated:
                                  description: >-
                                    The last time that the user's JWT channels
                                    were updated for this collection.
                                  type: string
                                  format: date-time
                                  readOnly: true
                      title: Role
                  scopes:
                    description: >-
                      An object keyed by scope name containing config for the
                      specific collection.
                    type: object
                    additionalProperties:
                      x-additionalPropertiesName: scopename
                      description: Scope-specific configuration.
                      type: object
                      properties:
                        collections:
                          description: >-
                            An object keyed by collection name containing config
                            for the specific collection.
                          type: object
                          additionalProperties:
                            x-additionalPropertiesName: collectionname
                            description: Collection-specific configuration.
                            type: object
                            properties:
                              sync:
                                description: >-
                                  The Javascript function that newly created
                                  documents in this collection are ran through.
                                type: string
                                example: 'function(doc){channel("collection name");}'
                              import_filter:
                                description: >-
                                  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.
                                type: string
                                example: >-
                                  function(doc) { if (doc.type != 'mobile') {
                                  return false; } return true; }
                            title: Collection config
                      title: Scopes
                    maxProperties: 1
                    example:
                      scopename:
                        collections:
                          collectionname1:
                            sync: 'function(doc){channel("collection name");}'
                            import_filter: >-
                              function(doc) { if (doc.type != 'mobile') { return
                              false; } return true; }
                          collectionname2:
                            sync: 'function(doc){channel("collection name");}'
                            import_filter: >-
                              function(doc) { if (doc.type != 'mobile') { return
                              false; } return true; }
                  send_www_authenticate_header:
                    description: >-
                      Controls whether to send a `WWW-Authenticate` header in
                      `401 Unauthorized` HTTP responses.
                    type: boolean
                    default: true
                  serve_insecure_attachment_types:
                    description: >
                      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.
                    type: boolean
                    default: false
                  server:
                    description: >-
                      This is the Couchbase Server address or addresses that the
                      database connect to. 
                    type: string
                  session_cookie_http_only:
                    description: >-
                      Make all session cookies for the database set the
                      `HttpOnly` flag so they are inaccessible to JavaScript.
                    type: boolean
                    default: false
                  session_cookie_name:
                    description: >-
                      This can be used to define a custom per-database session
                      cookie name.
                    type: string
                  session_cookie_secure:
                    description: >-
                      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`.
                    type: boolean
                  sgreplicate_enabled:
                    description: >-
                      Whether the node should accept assign replications
                      (`true`) or not (`false`).
                    type: boolean
                    default: true
                  sgreplicate_websocket_heartbeat_secs:
                    description: >-
                      Use a custom heartbeat interval (in seconds) for websocket
                      ping frames.
                    type: integer
                    default: 300
                  slow_query_warning_threshold:
                    description: >-
                      The amount of milliseconds a N1QL query should run before
                      logging a warning. 
                    type: number
                    default: 500
                  store_legacy_revtree_data:
                    description: >-
                      Controls whether Sync Gateway stores additional legacy
                      revision tree pointer data to support 3.x/early 4.x
                      clients that still use RevTree IDs (for example when used
                      as delta sources).


                      Disable this when you are confident all clients use newer
                      CV-based revisions and no longer require legacy RevTree ID
                      lookups.
                    type: boolean
                    default: true
                  suspendable:
                    description: >-
                      Set to true to allow the database to be suspended.


                      Defaults to true when running in serverless mode otherwise
                      defaults to false.
                    type: boolean
                    default: false
                  sync:
                    description: >-
                      The Javascript function that newly created documents are
                      ran through for the default scope and collection.


                      If `scopes` parameter is set, this is ignored.
                    type: string
                    default: 'function(doc){channel(doc.channels);}'
                  unsupported:
                    description: >-
                      These are unsupported options and therefore it is not
                      recommended to use them.
                    type: object
                    properties:
                      api_endpoints:
                        type: object
                        properties:
                          enable_couchbase_bucket_flush:
                            description: >-
                              **Setting for test purposes only**


                              Whether Couchbase buckets can be flushed via Admin
                              REST API.
                            type: boolean
                      dcp_read_buffer:
                        description: Set the dcp feed to use a different read buffer size.
                        type: number
                      force_api_forbidden_errors:
                        description: Force REST API errors to return forbidden
                        type: boolean
                      guest_read_only:
                        description: Restrict GUEST document access to read-only.
                        type: boolean
                      kv_buffer:
                        description: Set the kv pool to use a different buffer size.
                        type: number
                      oidc_test_provider:
                        type: object
                        properties:
                          enabled:
                            description: >-
                              Whether the `oidc_test_provider` endpoints should
                              be exposed on the public API.
                            type: boolean
                      oidc_tls_skip_verify:
                        description: Enable self-signed certificates for OIDC testing.
                        type: boolean
                      remote_config_tls_skip_verify:
                        description: >-
                          Enable self-signed certificates for external
                          JavaScript load.
                        type: boolean
                      same_site_cookie:
                        description: >-
                          Override the session cookie SameSite behavior. By
                          default, a session cookie will have SameSite:None if
                          CORS is enabled, and will have no SameSite attribute
                          if CORS is not enabled.  Setting this property
                          to`Default` will omit the SameSite attribute from the
                          cookie.
                        type: string
                        enum:
                          - Default
                          - Lax
                          - None
                          - Strict
                      sgr_tls_skip_verify:
                        description: >-
                          Enable self-signed certificates for SG-replicate
                          testing.
                        type: boolean
                      user_views:
                        type: object
                        properties:
                          enabled:
                            description: >-
                              Whether pass-through view query is supported
                              through public API.
                            type: boolean
                      warning_thresholds:
                        type: object
                        properties:
                          access_and_role_grants_per_doc:
                            description: >-
                              The number of access and role grants per document
                              to be used as a threshold for grant count
                              warnings.
                            type: number
                          channel_name_size:
                            description: >-
                              The number of channel name characters to be used
                              as a threshold for channel name warnings.
                            type: number
                          channels_per_doc:
                            description: >-
                              The number of channels per document to be used as
                              a threshold for the channel count warnings.
                            type: number
                          channels_per_user:
                            description: >-
                              The number of channels per user to be used as a
                              threshold for channel count warnings.
                            type: number
                          xattr_size_bytes:
                            description: >-
                              The number of bytes to be used as a threshold for
                              xattr size limit warnings.
                            type: number
                  use_views:
                    description: Force the use of views instead of GSI.
                    type: boolean
                    default: false
                  user_xattr_key:
                    description: >-
                      The key to use for the user xattr that will be accessible
                      from the sync function. If empty, the feature will be
                      disabled.


                      This is an Enterprise Edition feature only.
                    type: string
                    maximum: 15
                  username:
                    description: The username for authenticating to the server.
                    type: string
                  users:
                    additionalProperties:
                      x-additionalPropertiesName: username
                      description: Properties associated with a user
                      type: object
                      properties:
                        name:
                          description: >-
                            The name of the user.


                            User names can only have alphanumeric ASCII
                            characters and underscores.
                          type: string
                        password:
                          description: >-
                            The password of the user.


                            Mandatory. unless `allow_empty_password` is `true`
                            in the database configs.
                          type: string
                        admin_channels:
                          description: >-
                            A list of channels to explicitly grant to the user
                            for the default collection.

                            See `collection_access` for channels in named
                            collections.
                          type: array
                          items:
                            type: string
                        all_channels:
                          description: >-
                            All the channels that the user has been granted
                            access to for the default collection.

                            See `collection_access` for channels in named
                            collections.


                            Access could have been granted through the sync
                            function, roles, or explicitly on the user under the
                            `admin_channels` property.
                          type: array
                          items:
                            type: string
                          readOnly: true
                        email:
                          description: The email address of the user.
                          type: string
                        disabled:
                          description: >-
                            If true, the user will not be able to login to the
                            account as it is disabled.
                          type: boolean
                          default: false
                        admin_roles:
                          description: A list of roles to explicitly grant to the user.
                          type: array
                          items:
                            type: string
                        roles:
                          description: >-
                            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.
                          type: array
                          items:
                            type: string
                          readOnly: true
                        jwt_roles:
                          description: >-
                            The roles that the user has been added to through
                            roles_claim.
                          type: array
                          items:
                            type: string
                          readOnly: true
                        jwt_channels:
                          description: >-
                            The channels that the user has been granted access
                            to through channels_claim for the default
                            collection.
                          type: array
                          items:
                            type: string
                          readOnly: true
                        jwt_issuer:
                          description: >-
                            The issuer of the last JSON Web Token that the user
                            last used to sign in.
                          type: string
                          readOnly: true
                        jwt_last_updated:
                          description: >-
                            The last time that the user's JWT roles/channels
                            were updated.
                          type: string
                          format: date-time
                          readOnly: true
                        collection_access:
                          description: >-
                            A set of access grants by scope and collection for a
                            specific collection.
                          type: object
                          additionalProperties:
                            maxProperties: 1
                            description: >-
                              An object keyed by scope, containing a set of
                              collections.
                            type: object
                            x-additionalPropertiesName: scopename
                            additionalProperties:
                              description: >-
                                An object keyed by collection name, defines
                                access collections in this scope.
                              type: object
                              x-additionalPropertiesName: collectionname
                              properties:
                                admin_channels:
                                  description: >-
                                    A list of channels to explicitly grant to
                                    the user in this collection.
                                  type: array
                                  items:
                                    type: string
                                all_channels:
                                  description: >-
                                    All the channels that the user has been
                                    granted access to in this collection.


                                    Access could have been granted through the
                                    sync function, roles, or explicitly on the
                                    user under the `admin_channels` property.
                                  type: array
                                  items:
                                    type: string
                                  readOnly: true
                                jwt_channels:
                                  description: >-
                                    The channels that the user has been granted
                                    access to through channels_claim for this
                                    collection.
                                  type: array
                                  items:
                                    type: string
                                  readOnly: true
                                jwt_last_updated:
                                  description: >-
                                    The last time that the user's JWT channels
                                    were updated for this collection.
                                  type: string
                                  format: date-time
                                  readOnly: true
                      title: User
                  view_query_timeout_secs:
                    description: The number of seconds before a view query should timeout.
                    type: integer
                    default: 75
                  allow_conflicts:
                    description: >-
                      Since Sync Gateway 4.0, this option has no effect.

                      If this option is set to true on an existing database, the
                      database must be modified to remove this parameter in
                      order allow the database to come online. Otherwise, the
                      database will be in the offline state.
                    type: boolean
                    default: false
                    deprecated: true
                  enable_shared_bucket_access:
                    description: >-
                      Since Sync Gateway 4.0, this option has no effect.

                      If this option is set to true on an existing database, the
                      database must be modified to remove this parameter in
                      order allow the database to come online. Otherwise, the
                      database will be in the offline state.
                    type: boolean
                    default: true
                    deprecated: true
                  feed_type:
                    description: >-
                      The type of feed to use to communicate with Couchbase
                      Server. This will use DCP regardless of specification.
                    type: string
                    default: DCP
                    enum:
                      - DCP
                    deprecated: true
                  num_index_replicas:
                    description: >-
                      **Deprecated, please use the database setting
                      `index.num_replicas` instead**
                    deprecated: true
                    type: number
                    default: 1
                  pool:
                    description: This field is unsupported and ignored.
                    type: string
                    default: default
                    deprecated: true
                  rev_cache_size:
                    description: >-
                      **Deprecated, please use the database setting
                      `cache.rev_cache.size` instead**


                      The maximum number of revisions to store in the revision
                      cache.
                    type: number
                    deprecated: true
                title: Database-config
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    put:
      summary: Replace database configuration
      operationId: put_db-_config
      tags:
        - Database Configuration
      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 (sync function only)
      parameters:
        - name: If-Match
          in: header
          required: false
          schema:
            type: string
          description: >-
            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.
        - name: disable_oidc_validation
          in: query
          required: false
          description: >-
            If set, will not attempt to validate the configured OpenID Connect
            providers are reachable.
          schema:
            type: boolean
            default: false
      requestBody:
        description: The new database configuration to use
        content:
          application/json:
            schema:
              description: The properties of a database configuration.
              type: object
              x-requirePropertiesSorted: true
              properties:
                allow_empty_password:
                  description: >-
                    This controls whether users that are created can have an
                    empty password or not.
                  type: boolean
                  default: false
                bucket:
                  description: The Couchbase Server backing bucket for the database.
                  type: string
                  default: The database name
                bucket_op_timeout_ms:
                  description: >-
                    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`.
                  type: number
                cacertpath:
                  description: The root CA cert path for X.509 bucket authentication.
                  type: string
                cache:
                  type: object
                  x-requirePropertiesSorted: true
                  properties:
                    channel_cache:
                      description: The channel cache config settings.
                      x-requirePropertiesSorted: true
                      type: object
                      properties:
                        compact_high_watermark_pct:
                          description: >-
                            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.
                          type: integer
                          default: 80
                        compact_low_watermark_pct:
                          description: >-
                            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.
                          type: integer
                          default: 60
                        expiry_seconds:
                          description: >-
                            The amount of time (in seconds) to keep entries in
                            the cache beyond the minimum retained.
                          type: integer
                          default: 60
                        max_length:
                          description: >-
                            The maximum number of entries to maintain in the
                            cache per channel.
                          type: integer
                          default: 500
                        max_num_pending:
                          description: >-
                            The maximum number of pending sequences before
                            skipping sequences.
                          type: integer
                          default: 10000
                        max_number:
                          description: >-
                            The maximum number of channel caches which can exist
                            at any one point.
                          type: integer
                          default: 50000
                        max_wait_pending:
                          description: >-
                            The maximum time (in milliseconds) for waiting for a
                            pending sequence before skipping it.
                          type: number
                          default: 5000
                        max_wait_skipped:
                          description: >-
                            The maximum amount of time (in milliseconds) to wait
                            for a skipped sequence before abandoning it.
                          type: number
                          default: 3600000
                        min_length:
                          description: >-
                            The minimum number of entries to maintain in the
                            cache per channel.
                          type: integer
                          default: 50
                        enable_star_channel:
                          description: >-
                            Since Sync Gateway 4.0, this option no longer has an
                            effect, the star channel is always enabled.

                            If this value is set to false, a database can only
                            exist in the offline state until this configuration
                            is modified.
                          type: boolean
                          default: true
                          deprecated: true
                        query_limit:
                          description: >-
                            **Deprecated in favour of the database setting
                            `query_pagination_limit`**


                            The limit used for channel queries.
                          type: integer
                          default: 5000
                          deprecated: true
                    rev_cache:
                      description: The revision cache config settings.
                      type: object
                      properties:
                        max_memory_count_mb:
                          description: >-
                            The maximum amount of memory the revision cache
                            should take up in MB, setting to 0 will disable any
                            eviction based on memory at rev cache.

                            There is a minimum value of 50 (50MB) for this
                            config option.

                            When set this memory limit will work in in hand with
                            revision cache size parameter. So you will
                            potentially get eviction at revision cache both
                            based off memory footprint and number of items in
                            the cache.

                            **This is an Enterprise Edition feature only**
                          type: integer
                          default: 0
                        shard_count:
                          description: >-
                            The number of shards the revision cache should be
                            split into.
                          type: integer
                          default: 16
                        size:
                          description: >-
                            The maximum number of revisions that can be stored
                            in the revision cache.

                            Note when running with greater than 1 shard count we
                            add 10% capacity overall to avoid early eviction
                            when some shards fill up before others, so

                            you may find that the capacity stat
                            (revision_cache_num_items) will climb to the defined
                            rev cache size + 10%.
                          type: integer
                          default: 5000
                    channel_cache_expiry:
                      description: >-
                        **Deprecated, please use the database setting
                        `cache.channel_cache.expiry_seconds` instead**


                        The time (seconds) to keep entries in cache beyond the
                        minimum retained.
                      type: integer
                      deprecated: true
                    channel_cache_max_length:
                      description: >-
                        **Deprecated, please use the database setting
                        `cache.channel_cache.max_length` instead**


                        The maximum number of entries maintained in cache per
                        channel.
                      type: number
                      deprecated: true
                    channel_cache_min_length:
                      description: >-
                        **Deprecated, please use the database setting
                        `cache.channel_cache.min_length` instead**


                        The minimum number of entries maintained in cache per
                        channel.
                      type: integer
                      deprecated: true
                    enable_star_channel:
                      description: >-
                        **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.
                      type: boolean
                      deprecated: true
                    max_num_pending:
                      description: >-
                        **Deprecated, please use the database setting
                        `cache.channel_cache.max_num_pending` instead**


                        The max number of pending sequences before skipping.
                      type: integer
                      deprecated: true
                    max_wait_pending:
                      description: >-
                        **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.
                      type: number
                      deprecated: true
                    max_wait_skipped:
                      description: >-
                        **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.
                      type: number
                      deprecated: true
                certpath:
                  description: The cert path (public key) for X.509 bucket auth.
                  type: string
                changes_request_plus:
                  type: boolean
                  default: false
                  description: >-
                    Sets the default value of `request_plus` for
                    one-shot/non-continuous changes feeds, which when true,
                    ensures all valid documents written prior to the request
                    being issued are included in the response. Setting this
                    option at the database level is required to ensure Couchbase
                    Lite utilizes this changes feed mode.


                    This also sets the default value of query param
                    `request_plus` for [GET
                    /{keyspace}/_changes](#operation/get_keyspace-_changes) or
                    `request_plus` for [POST
                    /{keyspace}/_changes](#operation/post_keyspace-_changes).
                client_partition_window_secs:
                  description: >-
                    How long (in seconds) clients can remain offline for without
                    losing replication metadata.


                    Defaults to 30 days (in seconds)
                  type: integer
                  default: 2592000
                compact_interval_days:
                  description: >-
                    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.
                  type: number
                  default: 1
                cors:
                  allOf:
                    - type: object
                      properties:
                        headers:
                          description: >-
                            List of allowed headers. These headers will be added
                            the `Access-Control-Allow-Headers` response to a
                            valid CORS request.


                            A recommended minimum set of values should be
                            `["Accept-Encoding", "Authorization",
                            "Content-Type", "If-Match"]`.
                          type: array
                          items:
                            type: string
                          example:
                            - Accept-Encoding
                            - Authorization
                            - Content-Type
                            - If-Match
                        login_origin:
                          description: >-
                            List of allowed origins to apply to public
                            `/{db}/_session` API.


                            To use cors on `/{db}/_session`, the domain must be
                            present in both `login_origin` and `origin`.


                            If configured, `Authorization` must be included in
                            headers.
                          type: array
                          items:
                            type: string
                          example:
                            - 'https://example.com'
                        max_age:
                          description: >-
                            Value for `Access-Control-Maximum-Age`. Uses 0 by
                            default.
                          type: integer
                          default: 0
                        origin:
                          description: >-
                            List of allowed origins for the public API. The
                            request `Origin` header is checked against these
                            values. If successful the `Origin` header is
                            returned in the HTTP response header as
                            `Access-Control-Allow-Origin`.
                          type: array
                          items:
                            type: string
                          example:
                            - 'https://example.com'
                      title: Cors Configuration
                    - type: object
                      description: >-
                        CORS configuration for this database; if present,
                        overrides server's config.
                delta_sync:
                  description: |-
                    Delta sync configuration settings.

                    **This is an Enterprise Edition feature only**
                  type: object
                  properties:
                    enabled:
                      description: |-
                        Whether delta sync is enabled.

                        **This is an Enterprise Edition feature only**
                      type: boolean
                      default: false
                    rev_max_age_seconds:
                      description: >-
                        The number of seconds deltas for old revisions are
                        available for.


                        This defaults to 24 hours (in seconds).
                      type: number
                      default: 86400
                disable_password_auth:
                  description: >-
                    Whether to disable username/password authentication and only
                    allow OIDC and guest access.
                  type: boolean
                  default: false
                disable_public_all_docs:
                  description: >-
                    This controls whether the [GET
                    /{keyspace}/_all_docs](#operation/get_keyspace-_all_docs)
                    REST API endpoint is publicly accessible or not.

                    Disabling this endpoint is recommended for larger datasets
                    or production workloads.

                    [GET /{keyspace}/_changes](#operation/get_keyspace-_changes)
                    or [POST
                    /{keyspace}/_bulk_get](#operation/post_keyspace-_bulk_get)
                    have more efficient implementations and should be used
                    instead.


                    If set to `true`, the endpoint will not be publicly
                    accessible, and will only be available on the Admin API.

                    Setting this to `false`, or leaving it as the default value
                    is deprecated, and may default to `true` in a future
                    release.
                  type: boolean
                  default: false
                event_handlers:
                  description: These are the settings for webhooks.
                  type: object
                  properties:
                    db_state_changed:
                      type: object
                      properties:
                        handler:
                          description: The handler type.
                          type: string
                          enum:
                            - webhook
                        url:
                          description: The URL of the webhook.
                          type: string
                        filter:
                          description: >-
                            The Javascript function to use to filter the webhook
                            events.
                          type: string
                        timeout:
                          description: >-
                            The amount of time (in seconds) to attempt connect
                            to the webhook before giving up.
                          type: number
                      title: Event-config
                    document_changed:
                      allOf:
                        - type: object
                          properties:
                            handler:
                              description: The handler type.
                              type: string
                              enum:
                                - webhook
                            url:
                              description: The URL of the webhook.
                              type: string
                            filter:
                              description: >-
                                The Javascript function to use to filter the
                                webhook events.
                              type: string
                            timeout:
                              description: >-
                                The amount of time (in seconds) to attempt
                                connect to the webhook before giving up.
                              type: number
                          title: Event-config
                        - type: object
                          properties:
                            options:
                              description: Options for the document changed event.
                              type: object
                              properties:
                                winning_rev_only:
                                  description: >-
                                    If true, only the winning revision of the
                                    document will be sent to the webhook.
                                  type: boolean
                                  default: false
                    max_processes:
                      description: >-
                        The maximum amount of concurrent event handling
                        independent functions that can be running at the same
                        time.
                      type: string
                    wait_for_process:
                      description: >-
                        The maximum amount of time (in milliseconds) to wait
                        when the even queue is full.
                      type: string
                guest:
                  description: Properties associated with a user
                  type: object
                  properties:
                    name:
                      description: >-
                        The name of the user.


                        User names can only have alphanumeric ASCII characters
                        and underscores.
                      type: string
                    password:
                      description: >-
                        The password of the user.


                        Mandatory. unless `allow_empty_password` is `true` in
                        the database configs.
                      type: string
                    admin_channels:
                      description: >-
                        A list of channels to explicitly grant to the user for
                        the default collection.

                        See `collection_access` for channels in named
                        collections.
                      type: array
                      items:
                        type: string
                    all_channels:
                      description: >-
                        All the channels that the user has been granted access
                        to for the default collection.

                        See `collection_access` for channels in named
                        collections.


                        Access could have been granted through the sync
                        function, roles, or explicitly on the user under the
                        `admin_channels` property.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    email:
                      description: The email address of the user.
                      type: string
                    disabled:
                      description: >-
                        If true, the user will not be able to login to the
                        account as it is disabled.
                      type: boolean
                      default: false
                    admin_roles:
                      description: A list of roles to explicitly grant to the user.
                      type: array
                      items:
                        type: string
                    roles:
                      description: >-
                        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.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    jwt_roles:
                      description: >-
                        The roles that the user has been added to through
                        roles_claim.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    jwt_channels:
                      description: >-
                        The channels that the user has been granted access to
                        through channels_claim for the default collection.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    jwt_issuer:
                      description: >-
                        The issuer of the last JSON Web Token that the user last
                        used to sign in.
                      type: string
                      readOnly: true
                    jwt_last_updated:
                      description: >-
                        The last time that the user's JWT roles/channels were
                        updated.
                      type: string
                      format: date-time
                      readOnly: true
                    collection_access:
                      description: >-
                        A set of access grants by scope and collection for a
                        specific collection.
                      type: object
                      additionalProperties:
                        maxProperties: 1
                        description: >-
                          An object keyed by scope, containing a set of
                          collections.
                        type: object
                        x-additionalPropertiesName: scopename
                        additionalProperties:
                          description: >-
                            An object keyed by collection name, defines access
                            collections in this scope.
                          type: object
                          x-additionalPropertiesName: collectionname
                          properties:
                            admin_channels:
                              description: >-
                                A list of channels to explicitly grant to the
                                user in this collection.
                              type: array
                              items:
                                type: string
                            all_channels:
                              description: >-
                                All the channels that the user has been granted
                                access to in this collection.


                                Access could have been granted through the sync
                                function, roles, or explicitly on the user under
                                the `admin_channels` property.
                              type: array
                              items:
                                type: string
                              readOnly: true
                            jwt_channels:
                              description: >-
                                The channels that the user has been granted
                                access to through channels_claim for this
                                collection.
                              type: array
                              items:
                                type: string
                              readOnly: true
                            jwt_last_updated:
                              description: >-
                                The last time that the user's JWT channels were
                                updated for this collection.
                              type: string
                              format: date-time
                              readOnly: true
                  title: User
                import_backup_old_rev:
                  description: >-
                    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.
                  type: boolean
                  default: false
                import_docs:
                  description: >-
                    If true, documents will be imported in to Sync Gateway from
                    the bucket in the background. 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 value requires
                    `enable_shared_bucket_access=true`.


                    This can also be set to the string `continuous` which maps
                    to true.
                  type: boolean
                import_filter:
                  description: >-
                    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.
                  type: string
                  example: >-
                    function(doc) { if (doc.type != 'mobile') { return false; }
                    return true; }
                import_partitions:
                  description: >-
                    ** 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.
                  type: number
                  default: 16
                  minimum: 1
                  maximum: 1024
                index:
                  description: Global Secondary Index Settings
                  properties:
                    num_partitions:
                      description: >-
                        The number of partitions to use for the large indexes
                        created by Sync Gateway. It is not recommended to set
                        this unless you require additional horizontal
                        scalability for individual indexes and have
                        appropriately scaled your Query nodes to handle the
                        increased query parallelism. If set, the recommended
                        number is 8 and does not need to be directly related to
                        the number of your Query nodes. Ensure documentation is
                        read to understand the performance tradeoffs and
                        instructions for migration if you have previously run
                        with only one partition. See
                        [/{db}/_index_init](#operation/post_db-_index_init) for
                        more information.


                        If not specified or 1, all indexes will be non
                        partitioned.
                      type: number
                      default: 1
                      title: Number of Index Partitions
                    num_replicas:
                      description: >-
                        This is the number of Global Secondary Indexes (GSI) to
                        use for core indexes.
                      type: number
                      default: 1
                javascript_timeout_secs:
                  description: >-
                    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.
                  type: number
                  default: 60
                keypath:
                  description: The key path (private key) for X.509 bucket auth
                  type: string
                kv_tls_port:
                  description: The Memcached TLS port.
                  type: integer
                  default: 11207
                local_doc_expiry_secs:
                  description: >-
                    The number of seconds before a `_local` document should
                    expire.
                  type: integer
                  default: 7776000
                local_jwt:
                  description: Configuration for Local JWT authentication.
                  type: object
                  additionalProperties:
                    x-additionalPropertiesName: providername
                    description: The providers name.
                    type: object
                    required:
                      - issuer
                      - client_id
                      - algorithms
                      - keys
                    properties:
                      algorithms:
                        description: >-
                          The JWT signing algorithms to accept for
                          authentication.
                        type: array
                        items:
                          type: string
                      channels_claim:
                        description: >-
                          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.
                        type: string
                      client_id:
                        description: >-
                          The value to match against the "aud" claim of JWTs.
                          Set to an empty string to disable audience validation.
                        type: string
                      disable_session:
                        description: >-
                          Disable Sync Gateway session creation on successful
                          JWT authentication.
                        type: boolean
                      issuer:
                        description: The value to match against the "iss" claim of JWTs.
                        type: string
                      keys:
                        description: The JSON Web Keys to use to validate JWTs.
                        type: array
                        items:
                          type: object
                          properties:
                            alg:
                              type: string
                              description: The algorithm intended for use with the key.
                            crv:
                              type: string
                              description: >-
                                For Elliptic Curve keys, the name of the curve
                                to use.
                              enum:
                                - P-256
                                - P-384
                                - P-521
                            e:
                              type: string
                              description: >-
                                For RSA keys, the exponent of the public key, as
                                a Base64urlUInt-encoded value.
                            kid:
                              type: string
                              description: 'The Key ID, used to identify the key to use.'
                            kty:
                              type: string
                              description: >-
                                The cryptographic algorithm family used with the
                                key, such as "RSA" or "EC"
                              enum:
                                - RSA
                                - EC
                            'n':
                              type: string
                              description: >-
                                For RSA keys, the modulus value of the key, as a
                                Base64urlUInt-encoded value.
                            use:
                              type: string
                              description: >-
                                The intended use of the public key. Only 'sig'
                                is accepted.
                              enum:
                                - sig
                            x:
                              type: string
                              description: >-
                                For Elliptic Curve keys, the X coordinate of the
                                point, as a base64url string.
                            'y':
                              type: string
                              description: >-
                                For Elliptic Curve keys, the Y coordinate of the
                                point, as a base64url string.
                      register:
                        description: >-
                          If to register a new Sync Gateway user account when a
                          user logs in with a JWT.
                        type: boolean
                      roles_claim:
                        description: >-
                          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.
                        type: string
                      user_prefix:
                        description: >-
                          This is the username prefix for all users created
                          through this provider.
                        type: string
                      username_claim:
                        description: >-
                          Allows a different OpenID Connect field to be
                          specified instead of the Subject (`sub`).


                          The field name to use can be specified here.
                        type: string
                logging:
                  description: Per-database logging configuration.
                  type: object
                  properties:
                    audit:
                      description: Audit logging configuration.
                      type: object
                      properties:
                        disabled_roles:
                          description: >-
                            List of roles for which audit logging is disabled.
                            Either cbs or sgw.
                          type: array
                          items:
                            type: object
                            properties:
                              domain:
                                description: >
                                  The domain of the role for which audit logging
                                  is disabled.
                                enum:
                                  - cbs
                                  - sgw
                                x-enumDescription:
                                  cbs: Couchbase Server RBAC
                                  sgw: Sync Gateway Role
                                type: string
                              name:
                                description: >-
                                  The name of the role for which audit logging
                                  is disabled.
                                type: string
                        disabled_users:
                          description: List of users for which audit logging is disabled.
                          type: array
                          items:
                            type: object
                            properties:
                              domain:
                                description: >
                                  The domain of the user for which audit logging
                                  is disabled.
                                type: string
                                enum:
                                  - cbs
                                  - sgw
                                x-enumDescription:
                                  cbs: Couchbase Server User
                                  sgw: Sync Gateway User
                              name:
                                description: >-
                                  The name of the user for which audit logging
                                  is disabled.
                                type: string
                        enabled:
                          description: Whether audit logging is enabled.
                          type: boolean
                          default: false
                        enabled_events:
                          description: List of enabled audit events for this database.
                          type: array
                          items:
                            type: number
                            example:
                              - 1234
                              - 5678
                    console:
                      description: Console logging configuration.
                      type: object
                      properties:
                        log_keys:
                          description: Log Keys for the console output
                          type: array
                          items:
                            type: string
                          example:
                            - CRUD
                            - HTTP
                            - Query
                        log_level:
                          description: Log Level for the console output
                          type: string
                          enum:
                            - none
                            - error
                            - warn
                            - info
                            - debug
                            - trace
                          example: debug
                max_concurrent_query_ops:
                  description: >-
                    The maximum amount of query operations that can be running
                    at any one point.
                  type: integer
                  default: 1000
                name:
                  description: The name of the database.
                  type: string
                offline:
                  description: Start the database in an offline state.
                  type: boolean
                  default: false
                oidc:
                  description: Configuration for OpenID Connect authentication.
                  type: object
                  properties:
                    default_provider:
                      description: >-
                        The default provider to use when the provider is not
                        specified in the client.
                      type: string
                    providers:
                      description: List of OpenID Connect issuers.
                      type: object
                      additionalProperties:
                        x-additionalPropertiesName: providername
                        description: The providers name.
                        type: object
                        properties:
                          InsecureSkipVerify:
                            description: >-
                              Determines whether the TLS certificate
                              verification should be disabled for this
                              provider. 
                            type: boolean
                            default: false
                          IsDefault:
                            description: >-
                              Indicates if this is the default OpenID Connect
                              provider.
                            type: boolean
                          Name:
                            description: The name of the OpenID Connect Provider.
                            type: string
                          allow_unsigned_provider_tokens:
                            description: >-
                              Allows users accept unsigned tokens from
                              providers.
                            type: boolean
                          callback_url:
                            description: >-
                              The URL that the OpenID Connect will redirect to
                              after authentication.


                              If not provided, a callback URL will be generated.
                            type: string
                          channels_claim:
                            description: >-
                              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.
                            type: string
                          client_id:
                            description: The OpenID Connect provider client ID.
                            type: string
                          disable_callback_state:
                            description: >-
                              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).**
                            type: boolean
                            default: false
                          disable_cfg_validation:
                            description: >-
                              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.
                            type: boolean
                            default: false
                          disable_session:
                            description: >-
                              Disable Sync Gateway session creation on
                              successful OpenID Connect authentication.
                            type: boolean
                          discovery_url:
                            description: The non-standard discovery endpoint.
                            type: string
                          include_access:
                            description: >-
                              This is whether the `_oidc_callback` response
                              should include the OpenID Connect access token and
                              associated fields (such as `token_type`, and
                              `expires_in`).
                            type: boolean
                          issuer:
                            description: The URL for the OpenID Connect issuer.
                            type: string
                          register:
                            description: >-
                              If to register a new Sync Gateway user account
                              when a user logs in with OpenID Connect.
                            type: boolean
                          roles_claim:
                            description: >-
                              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.
                            type: string
                          scope:
                            description: The scope sent for the OpenID Connect request.
                            type: array
                            items:
                              type: string
                          user_prefix:
                            description: >-
                              This is the username prefix for all users created
                              through this provider.
                            type: string
                          username_claim:
                            description: >-
                              Allows a different OpenID Connect field to be
                              specified instead of the Subject (`sub`).


                              The field name to use can be specified here.
                            type: string
                          validation_key:
                            description: The OpenID Connect provider client secret.
                            type: string
                old_rev_expiry_seconds:
                  description: >-
                    The number of seconds before old revisions are removed from
                    the Couchbase Server bucket.
                  type: number
                  default: 300
                password:
                  description: The password for authenticating to the server.
                  type: string
                query_pagination_limit:
                  description: >-
                    The query limit to be used during pagination of large
                    queries.
                  type: integer
                  default: 5000
                replications:
                  type: object
                  properties:
                    replication_id:
                      description: Properties of a replication
                      type: object
                      x-requirePropertiesSorted: true
                      properties:
                        adhoc:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        batch_size:
                          description: >-
                            The amount of changes to be sent in one batch of
                            replications. Changing this is an Enterprise Edition
                            only feature.
                          type: integer
                          default: 200
                        collections_enabled:
                          description: >-
                            If true, the replicator will run with collections,
                            and will replicate all collections, unless otherwise
                            limited by `collections_local`.


                            If false, the replicator will only replicate the
                            default collection.
                          type: boolean
                          default: false
                        collections_local:
                          description: >-
                            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.
                          type: array
                          items:
                            type: string
                          example:
                            - scope1.collection1
                            - scope1.collection3
                            - scope1.collection6
                          default: []
                        collections_remote:
                          description: >-
                            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.
                          type: array
                          items:
                            type: string
                            nullable: true
                          example:
                            - scope1.collectionA
                            - null
                            - scope1.collectionF
                          default: []
                        conflict_resolution_type:
                          description: >-
                            This defines what conflict resolution policy Sync
                            Gateway should use to apply when resolving
                            conflicting revisions.


                            Changing this is an Enterprise Edition only feature.
                          type: string
                          default: default
                          enum:
                            - default
                            - remoteWins
                            - localWins
                            - custom
                          x-enumDescriptions:
                            default: |-
                              This will use:
                                - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                                - The revision with the most recent timestamp wins.
                                - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                            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.
                        continuous:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        custom_conflict_resolver:
                          description: >-
                            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 document's body.
                            This can be the winning revision (for example,
                            `return conflict.LocalDocument`), a new body, or
                            `nil` to resolve as a delete.


                            Example:


                            ```javascript

                            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.


                            If a document merge is being done, the `_rev` and
                            `_cv` properties should not be included in the
                            returned document body as Sync Gateway will generate
                            new values for these.


                            This is an Enterprise Edition only feature.
                          type: string
                          default: ''
                        direction:
                          description: >-
                            This specifies which direction the replication will
                            be replicating with the `remote` replicator.
                          type: string
                          enum:
                            - push
                            - pull
                            - pushAndPull
                          x-enumDescriptions:
                            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
                        enable_delta_sync:
                          description: >-
                            This will turn on delta-sync for the replication. In
                            order to enable delta-sync for a replication, the
                            database level setting `delta_sync.enabled` must
                            also be set to true.


                            Using delta-sync is an Enterprise Edition only
                            feature.
                          type: boolean
                          default: false
                        filter:
                          description: This defines whether to filter documents.
                          type: string
                          enum:
                            - sync_gateway/bychannel
                            - ''
                          x-enumDescriptions:
                            '': Do not filter any documents.
                            sync_gateway/bychannel: >-
                              If set, a pull replication will be limited to a
                              specific set of channels specified by the
                              `query_param.channels` property.
                        initial_state:
                          description: >-
                            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`.
                          type: string
                          default: running
                          enum:
                            - running
                            - stopped
                          x-enumDescriptions:
                            running: The replication will immediately start running.
                            stopped: >-
                              The replication configuration will be created but
                              the replication will not start running until the
                              user explicitly starts it.
                        max_backoff_time:
                          description: >-
                            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.
                          type: integer
                          default: 5
                        purge_on_removal:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        query_params:
                          description: >-
                            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:

                            ```json

                            "filter":"sync_gateway/bychannel",

                            "query_params": {
                              "channels":["chanUser1"]
                            },

                            ```
                          type: array
                          items:
                            type: string
                        remote:
                          description: >-
                            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,
                            `https://localhost:4985/db`.
                          type: string
                        remote_password:
                          description: >-
                            The password to use to authenticate with the remote.
                            This password will be redacted in the replication
                            config.
                          type: string
                        remote_username:
                          description: The username to use to authenticate with the remote.
                          type: string
                        replication_id:
                          description: >-
                            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.
                          type: string
                          maximum: 160
                        run_as:
                          description: >-
                            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.
                          type: string
                        password:
                          description: >-
                            **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.
                          type: string
                          deprecated: true
                        username:
                          description: >-
                            **This has been deprecated in favour of
                            `remote_username`.**


                            This is the username to use to authenticate with the
                            remote.
                          type: string
                          deprecated: true
                      required:
                        - direction
                      title: User configurable replication properties
                revs_limit:
                  description: The maximum depth a document's revision tree can grow to.
                  type: number
                  default: 50
                  minimum: 0
                roles:
                  additionalProperties:
                    x-additionalPropertiesName: rolename
                    description: Properties associated with a role
                    type: object
                    properties:
                      name:
                        description: >-
                          The name of the role.


                          Role names can only have alphanumeric ASCII characters
                          and underscores.
                        type: string
                      admin_channels:
                        description: >-
                          A list of channels to explicitly grant to the role for
                          the default collection.

                          See `collection_access` for channels in named
                          collections.
                        type: array
                        items:
                          type: string
                      all_channels:
                        description: >-
                          All the channels that the role has been granted access
                          to for the default collection.


                          These channels could have been assigned by the Sync
                          function or using the `admin_channels` property.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      collection_access:
                        description: >-
                          A set of access grants by scope and collection for a
                          specific collection.
                        type: object
                        additionalProperties:
                          maxProperties: 1
                          description: >-
                            An object keyed by scope, containing a set of
                            collections.
                          type: object
                          x-additionalPropertiesName: scopename
                          additionalProperties:
                            description: >-
                              An object keyed by collection name, defines access
                              collections in this scope.
                            type: object
                            x-additionalPropertiesName: collectionname
                            properties:
                              admin_channels:
                                description: >-
                                  A list of channels to explicitly grant to the
                                  user in this collection.
                                type: array
                                items:
                                  type: string
                              all_channels:
                                description: >-
                                  All the channels that the user has been
                                  granted access to in this collection.


                                  Access could have been granted through the
                                  sync function, roles, or explicitly on the
                                  user under the `admin_channels` property.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_channels:
                                description: >-
                                  The channels that the user has been granted
                                  access to through channels_claim for this
                                  collection.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_last_updated:
                                description: >-
                                  The last time that the user's JWT channels
                                  were updated for this collection.
                                type: string
                                format: date-time
                                readOnly: true
                    title: Role
                scopes:
                  description: >-
                    An object keyed by scope name containing config for the
                    specific collection.
                  type: object
                  additionalProperties:
                    x-additionalPropertiesName: scopename
                    description: Scope-specific configuration.
                    type: object
                    properties:
                      collections:
                        description: >-
                          An object keyed by collection name containing config
                          for the specific collection.
                        type: object
                        additionalProperties:
                          x-additionalPropertiesName: collectionname
                          description: Collection-specific configuration.
                          type: object
                          properties:
                            sync:
                              description: >-
                                The Javascript function that newly created
                                documents in this collection are ran through.
                              type: string
                              example: 'function(doc){channel("collection name");}'
                            import_filter:
                              description: >-
                                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.
                              type: string
                              example: >-
                                function(doc) { if (doc.type != 'mobile') {
                                return false; } return true; }
                          title: Collection config
                    title: Scopes
                  maxProperties: 1
                  example:
                    scopename:
                      collections:
                        collectionname1:
                          sync: 'function(doc){channel("collection name");}'
                          import_filter: >-
                            function(doc) { if (doc.type != 'mobile') { return
                            false; } return true; }
                        collectionname2:
                          sync: 'function(doc){channel("collection name");}'
                          import_filter: >-
                            function(doc) { if (doc.type != 'mobile') { return
                            false; } return true; }
                send_www_authenticate_header:
                  description: >-
                    Controls whether to send a `WWW-Authenticate` header in `401
                    Unauthorized` HTTP responses.
                  type: boolean
                  default: true
                serve_insecure_attachment_types:
                  description: >
                    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.
                  type: boolean
                  default: false
                server:
                  description: >-
                    This is the Couchbase Server address or addresses that the
                    database connect to. 
                  type: string
                session_cookie_http_only:
                  description: >-
                    Make all session cookies for the database set the `HttpOnly`
                    flag so they are inaccessible to JavaScript.
                  type: boolean
                  default: false
                session_cookie_name:
                  description: >-
                    This can be used to define a custom per-database session
                    cookie name.
                  type: string
                session_cookie_secure:
                  description: >-
                    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`.
                  type: boolean
                sgreplicate_enabled:
                  description: >-
                    Whether the node should accept assign replications (`true`)
                    or not (`false`).
                  type: boolean
                  default: true
                sgreplicate_websocket_heartbeat_secs:
                  description: >-
                    Use a custom heartbeat interval (in seconds) for websocket
                    ping frames.
                  type: integer
                  default: 300
                slow_query_warning_threshold:
                  description: >-
                    The amount of milliseconds a N1QL query should run before
                    logging a warning. 
                  type: number
                  default: 500
                store_legacy_revtree_data:
                  description: >-
                    Controls whether Sync Gateway stores additional legacy
                    revision tree pointer data to support 3.x/early 4.x clients
                    that still use RevTree IDs (for example when used as delta
                    sources).


                    Disable this when you are confident all clients use newer
                    CV-based revisions and no longer require legacy RevTree ID
                    lookups.
                  type: boolean
                  default: true
                suspendable:
                  description: >-
                    Set to true to allow the database to be suspended.


                    Defaults to true when running in serverless mode otherwise
                    defaults to false.
                  type: boolean
                  default: false
                sync:
                  description: >-
                    The Javascript function that newly created documents are ran
                    through for the default scope and collection.


                    If `scopes` parameter is set, this is ignored.
                  type: string
                  default: 'function(doc){channel(doc.channels);}'
                unsupported:
                  description: >-
                    These are unsupported options and therefore it is not
                    recommended to use them.
                  type: object
                  properties:
                    api_endpoints:
                      type: object
                      properties:
                        enable_couchbase_bucket_flush:
                          description: >-
                            **Setting for test purposes only**


                            Whether Couchbase buckets can be flushed via Admin
                            REST API.
                          type: boolean
                    dcp_read_buffer:
                      description: Set the dcp feed to use a different read buffer size.
                      type: number
                    force_api_forbidden_errors:
                      description: Force REST API errors to return forbidden
                      type: boolean
                    guest_read_only:
                      description: Restrict GUEST document access to read-only.
                      type: boolean
                    kv_buffer:
                      description: Set the kv pool to use a different buffer size.
                      type: number
                    oidc_test_provider:
                      type: object
                      properties:
                        enabled:
                          description: >-
                            Whether the `oidc_test_provider` endpoints should be
                            exposed on the public API.
                          type: boolean
                    oidc_tls_skip_verify:
                      description: Enable self-signed certificates for OIDC testing.
                      type: boolean
                    remote_config_tls_skip_verify:
                      description: >-
                        Enable self-signed certificates for external JavaScript
                        load.
                      type: boolean
                    same_site_cookie:
                      description: >-
                        Override the session cookie SameSite behavior. By
                        default, a session cookie will have SameSite:None if
                        CORS is enabled, and will have no SameSite attribute if
                        CORS is not enabled.  Setting this property to`Default`
                        will omit the SameSite attribute from the cookie.
                      type: string
                      enum:
                        - Default
                        - Lax
                        - None
                        - Strict
                    sgr_tls_skip_verify:
                      description: >-
                        Enable self-signed certificates for SG-replicate
                        testing.
                      type: boolean
                    user_views:
                      type: object
                      properties:
                        enabled:
                          description: >-
                            Whether pass-through view query is supported through
                            public API.
                          type: boolean
                    warning_thresholds:
                      type: object
                      properties:
                        access_and_role_grants_per_doc:
                          description: >-
                            The number of access and role grants per document to
                            be used as a threshold for grant count warnings.
                          type: number
                        channel_name_size:
                          description: >-
                            The number of channel name characters to be used as
                            a threshold for channel name warnings.
                          type: number
                        channels_per_doc:
                          description: >-
                            The number of channels per document to be used as a
                            threshold for the channel count warnings.
                          type: number
                        channels_per_user:
                          description: >-
                            The number of channels per user to be used as a
                            threshold for channel count warnings.
                          type: number
                        xattr_size_bytes:
                          description: >-
                            The number of bytes to be used as a threshold for
                            xattr size limit warnings.
                          type: number
                use_views:
                  description: Force the use of views instead of GSI.
                  type: boolean
                  default: false
                user_xattr_key:
                  description: >-
                    The key to use for the user xattr that will be accessible
                    from the sync function. If empty, the feature will be
                    disabled.


                    This is an Enterprise Edition feature only.
                  type: string
                  maximum: 15
                username:
                  description: The username for authenticating to the server.
                  type: string
                users:
                  additionalProperties:
                    x-additionalPropertiesName: username
                    description: Properties associated with a user
                    type: object
                    properties:
                      name:
                        description: >-
                          The name of the user.


                          User names can only have alphanumeric ASCII characters
                          and underscores.
                        type: string
                      password:
                        description: >-
                          The password of the user.


                          Mandatory. unless `allow_empty_password` is `true` in
                          the database configs.
                        type: string
                      admin_channels:
                        description: >-
                          A list of channels to explicitly grant to the user for
                          the default collection.

                          See `collection_access` for channels in named
                          collections.
                        type: array
                        items:
                          type: string
                      all_channels:
                        description: >-
                          All the channels that the user has been granted access
                          to for the default collection.

                          See `collection_access` for channels in named
                          collections.


                          Access could have been granted through the sync
                          function, roles, or explicitly on the user under the
                          `admin_channels` property.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      email:
                        description: The email address of the user.
                        type: string
                      disabled:
                        description: >-
                          If true, the user will not be able to login to the
                          account as it is disabled.
                        type: boolean
                        default: false
                      admin_roles:
                        description: A list of roles to explicitly grant to the user.
                        type: array
                        items:
                          type: string
                      roles:
                        description: >-
                          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.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_roles:
                        description: >-
                          The roles that the user has been added to through
                          roles_claim.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_channels:
                        description: >-
                          The channels that the user has been granted access to
                          through channels_claim for the default collection.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_issuer:
                        description: >-
                          The issuer of the last JSON Web Token that the user
                          last used to sign in.
                        type: string
                        readOnly: true
                      jwt_last_updated:
                        description: >-
                          The last time that the user's JWT roles/channels were
                          updated.
                        type: string
                        format: date-time
                        readOnly: true
                      collection_access:
                        description: >-
                          A set of access grants by scope and collection for a
                          specific collection.
                        type: object
                        additionalProperties:
                          maxProperties: 1
                          description: >-
                            An object keyed by scope, containing a set of
                            collections.
                          type: object
                          x-additionalPropertiesName: scopename
                          additionalProperties:
                            description: >-
                              An object keyed by collection name, defines access
                              collections in this scope.
                            type: object
                            x-additionalPropertiesName: collectionname
                            properties:
                              admin_channels:
                                description: >-
                                  A list of channels to explicitly grant to the
                                  user in this collection.
                                type: array
                                items:
                                  type: string
                              all_channels:
                                description: >-
                                  All the channels that the user has been
                                  granted access to in this collection.


                                  Access could have been granted through the
                                  sync function, roles, or explicitly on the
                                  user under the `admin_channels` property.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_channels:
                                description: >-
                                  The channels that the user has been granted
                                  access to through channels_claim for this
                                  collection.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_last_updated:
                                description: >-
                                  The last time that the user's JWT channels
                                  were updated for this collection.
                                type: string
                                format: date-time
                                readOnly: true
                    title: User
                view_query_timeout_secs:
                  description: The number of seconds before a view query should timeout.
                  type: integer
                  default: 75
                allow_conflicts:
                  description: >-
                    Since Sync Gateway 4.0, this option has no effect.

                    If this option is set to true on an existing database, the
                    database must be modified to remove this parameter in order
                    allow the database to come online. Otherwise, the database
                    will be in the offline state.
                  type: boolean
                  default: false
                  deprecated: true
                enable_shared_bucket_access:
                  description: >-
                    Since Sync Gateway 4.0, this option has no effect.

                    If this option is set to true on an existing database, the
                    database must be modified to remove this parameter in order
                    allow the database to come online. Otherwise, the database
                    will be in the offline state.
                  type: boolean
                  default: true
                  deprecated: true
                feed_type:
                  description: >-
                    The type of feed to use to communicate with Couchbase
                    Server. This will use DCP regardless of specification.
                  type: string
                  default: DCP
                  enum:
                    - DCP
                  deprecated: true
                num_index_replicas:
                  description: >-
                    **Deprecated, please use the database setting
                    `index.num_replicas` instead**
                  deprecated: true
                  type: number
                  default: 1
                pool:
                  description: This field is unsupported and ignored.
                  type: string
                  default: default
                  deprecated: true
                rev_cache_size:
                  description: >-
                    **Deprecated, please use the database setting
                    `cache.rev_cache.size` instead**


                    The maximum number of revisions to store in the revision
                    cache.
                  type: number
                  deprecated: true
              title: Database-config
      responses:
        '201':
          description: Database configuration successfully updated
          headers:
            Etag:
              schema:
                type: string
              description: The new database configuration revision.
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '412':
          description: >-
            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.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: Precondition Failed
                reason: Provided If-Match header does not match current config version
    post:
      summary: Update database configuration
      operationId: post_db-_config
      tags:
        - Database Configuration
      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 (sync function only)
      parameters:
        - name: If-Match
          in: header
          required: false
          schema:
            type: string
          description: >-
            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.
      requestBody:
        description: The database configuration fields to update
        content:
          application/json:
            schema:
              description: The properties of a database configuration.
              type: object
              x-requirePropertiesSorted: true
              properties:
                allow_empty_password:
                  description: >-
                    This controls whether users that are created can have an
                    empty password or not.
                  type: boolean
                  default: false
                bucket:
                  description: The Couchbase Server backing bucket for the database.
                  type: string
                  default: The database name
                bucket_op_timeout_ms:
                  description: >-
                    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`.
                  type: number
                cacertpath:
                  description: The root CA cert path for X.509 bucket authentication.
                  type: string
                cache:
                  type: object
                  x-requirePropertiesSorted: true
                  properties:
                    channel_cache:
                      description: The channel cache config settings.
                      x-requirePropertiesSorted: true
                      type: object
                      properties:
                        compact_high_watermark_pct:
                          description: >-
                            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.
                          type: integer
                          default: 80
                        compact_low_watermark_pct:
                          description: >-
                            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.
                          type: integer
                          default: 60
                        expiry_seconds:
                          description: >-
                            The amount of time (in seconds) to keep entries in
                            the cache beyond the minimum retained.
                          type: integer
                          default: 60
                        max_length:
                          description: >-
                            The maximum number of entries to maintain in the
                            cache per channel.
                          type: integer
                          default: 500
                        max_num_pending:
                          description: >-
                            The maximum number of pending sequences before
                            skipping sequences.
                          type: integer
                          default: 10000
                        max_number:
                          description: >-
                            The maximum number of channel caches which can exist
                            at any one point.
                          type: integer
                          default: 50000
                        max_wait_pending:
                          description: >-
                            The maximum time (in milliseconds) for waiting for a
                            pending sequence before skipping it.
                          type: number
                          default: 5000
                        max_wait_skipped:
                          description: >-
                            The maximum amount of time (in milliseconds) to wait
                            for a skipped sequence before abandoning it.
                          type: number
                          default: 3600000
                        min_length:
                          description: >-
                            The minimum number of entries to maintain in the
                            cache per channel.
                          type: integer
                          default: 50
                        enable_star_channel:
                          description: >-
                            Since Sync Gateway 4.0, this option no longer has an
                            effect, the star channel is always enabled.

                            If this value is set to false, a database can only
                            exist in the offline state until this configuration
                            is modified.
                          type: boolean
                          default: true
                          deprecated: true
                        query_limit:
                          description: >-
                            **Deprecated in favour of the database setting
                            `query_pagination_limit`**


                            The limit used for channel queries.
                          type: integer
                          default: 5000
                          deprecated: true
                    rev_cache:
                      description: The revision cache config settings.
                      type: object
                      properties:
                        max_memory_count_mb:
                          description: >-
                            The maximum amount of memory the revision cache
                            should take up in MB, setting to 0 will disable any
                            eviction based on memory at rev cache.

                            There is a minimum value of 50 (50MB) for this
                            config option.

                            When set this memory limit will work in in hand with
                            revision cache size parameter. So you will
                            potentially get eviction at revision cache both
                            based off memory footprint and number of items in
                            the cache.

                            **This is an Enterprise Edition feature only**
                          type: integer
                          default: 0
                        shard_count:
                          description: >-
                            The number of shards the revision cache should be
                            split into.
                          type: integer
                          default: 16
                        size:
                          description: >-
                            The maximum number of revisions that can be stored
                            in the revision cache.

                            Note when running with greater than 1 shard count we
                            add 10% capacity overall to avoid early eviction
                            when some shards fill up before others, so

                            you may find that the capacity stat
                            (revision_cache_num_items) will climb to the defined
                            rev cache size + 10%.
                          type: integer
                          default: 5000
                    channel_cache_expiry:
                      description: >-
                        **Deprecated, please use the database setting
                        `cache.channel_cache.expiry_seconds` instead**


                        The time (seconds) to keep entries in cache beyond the
                        minimum retained.
                      type: integer
                      deprecated: true
                    channel_cache_max_length:
                      description: >-
                        **Deprecated, please use the database setting
                        `cache.channel_cache.max_length` instead**


                        The maximum number of entries maintained in cache per
                        channel.
                      type: number
                      deprecated: true
                    channel_cache_min_length:
                      description: >-
                        **Deprecated, please use the database setting
                        `cache.channel_cache.min_length` instead**


                        The minimum number of entries maintained in cache per
                        channel.
                      type: integer
                      deprecated: true
                    enable_star_channel:
                      description: >-
                        **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.
                      type: boolean
                      deprecated: true
                    max_num_pending:
                      description: >-
                        **Deprecated, please use the database setting
                        `cache.channel_cache.max_num_pending` instead**


                        The max number of pending sequences before skipping.
                      type: integer
                      deprecated: true
                    max_wait_pending:
                      description: >-
                        **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.
                      type: number
                      deprecated: true
                    max_wait_skipped:
                      description: >-
                        **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.
                      type: number
                      deprecated: true
                certpath:
                  description: The cert path (public key) for X.509 bucket auth.
                  type: string
                changes_request_plus:
                  type: boolean
                  default: false
                  description: >-
                    Sets the default value of `request_plus` for
                    one-shot/non-continuous changes feeds, which when true,
                    ensures all valid documents written prior to the request
                    being issued are included in the response. Setting this
                    option at the database level is required to ensure Couchbase
                    Lite utilizes this changes feed mode.


                    This also sets the default value of query param
                    `request_plus` for [GET
                    /{keyspace}/_changes](#operation/get_keyspace-_changes) or
                    `request_plus` for [POST
                    /{keyspace}/_changes](#operation/post_keyspace-_changes).
                client_partition_window_secs:
                  description: >-
                    How long (in seconds) clients can remain offline for without
                    losing replication metadata.


                    Defaults to 30 days (in seconds)
                  type: integer
                  default: 2592000
                compact_interval_days:
                  description: >-
                    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.
                  type: number
                  default: 1
                cors:
                  allOf:
                    - type: object
                      properties:
                        headers:
                          description: >-
                            List of allowed headers. These headers will be added
                            the `Access-Control-Allow-Headers` response to a
                            valid CORS request.


                            A recommended minimum set of values should be
                            `["Accept-Encoding", "Authorization",
                            "Content-Type", "If-Match"]`.
                          type: array
                          items:
                            type: string
                          example:
                            - Accept-Encoding
                            - Authorization
                            - Content-Type
                            - If-Match
                        login_origin:
                          description: >-
                            List of allowed origins to apply to public
                            `/{db}/_session` API.


                            To use cors on `/{db}/_session`, the domain must be
                            present in both `login_origin` and `origin`.


                            If configured, `Authorization` must be included in
                            headers.
                          type: array
                          items:
                            type: string
                          example:
                            - 'https://example.com'
                        max_age:
                          description: >-
                            Value for `Access-Control-Maximum-Age`. Uses 0 by
                            default.
                          type: integer
                          default: 0
                        origin:
                          description: >-
                            List of allowed origins for the public API. The
                            request `Origin` header is checked against these
                            values. If successful the `Origin` header is
                            returned in the HTTP response header as
                            `Access-Control-Allow-Origin`.
                          type: array
                          items:
                            type: string
                          example:
                            - 'https://example.com'
                      title: Cors Configuration
                    - type: object
                      description: >-
                        CORS configuration for this database; if present,
                        overrides server's config.
                delta_sync:
                  description: |-
                    Delta sync configuration settings.

                    **This is an Enterprise Edition feature only**
                  type: object
                  properties:
                    enabled:
                      description: |-
                        Whether delta sync is enabled.

                        **This is an Enterprise Edition feature only**
                      type: boolean
                      default: false
                    rev_max_age_seconds:
                      description: >-
                        The number of seconds deltas for old revisions are
                        available for.


                        This defaults to 24 hours (in seconds).
                      type: number
                      default: 86400
                disable_password_auth:
                  description: >-
                    Whether to disable username/password authentication and only
                    allow OIDC and guest access.
                  type: boolean
                  default: false
                disable_public_all_docs:
                  description: >-
                    This controls whether the [GET
                    /{keyspace}/_all_docs](#operation/get_keyspace-_all_docs)
                    REST API endpoint is publicly accessible or not.

                    Disabling this endpoint is recommended for larger datasets
                    or production workloads.

                    [GET /{keyspace}/_changes](#operation/get_keyspace-_changes)
                    or [POST
                    /{keyspace}/_bulk_get](#operation/post_keyspace-_bulk_get)
                    have more efficient implementations and should be used
                    instead.


                    If set to `true`, the endpoint will not be publicly
                    accessible, and will only be available on the Admin API.

                    Setting this to `false`, or leaving it as the default value
                    is deprecated, and may default to `true` in a future
                    release.
                  type: boolean
                  default: false
                event_handlers:
                  description: These are the settings for webhooks.
                  type: object
                  properties:
                    db_state_changed:
                      type: object
                      properties:
                        handler:
                          description: The handler type.
                          type: string
                          enum:
                            - webhook
                        url:
                          description: The URL of the webhook.
                          type: string
                        filter:
                          description: >-
                            The Javascript function to use to filter the webhook
                            events.
                          type: string
                        timeout:
                          description: >-
                            The amount of time (in seconds) to attempt connect
                            to the webhook before giving up.
                          type: number
                      title: Event-config
                    document_changed:
                      allOf:
                        - type: object
                          properties:
                            handler:
                              description: The handler type.
                              type: string
                              enum:
                                - webhook
                            url:
                              description: The URL of the webhook.
                              type: string
                            filter:
                              description: >-
                                The Javascript function to use to filter the
                                webhook events.
                              type: string
                            timeout:
                              description: >-
                                The amount of time (in seconds) to attempt
                                connect to the webhook before giving up.
                              type: number
                          title: Event-config
                        - type: object
                          properties:
                            options:
                              description: Options for the document changed event.
                              type: object
                              properties:
                                winning_rev_only:
                                  description: >-
                                    If true, only the winning revision of the
                                    document will be sent to the webhook.
                                  type: boolean
                                  default: false
                    max_processes:
                      description: >-
                        The maximum amount of concurrent event handling
                        independent functions that can be running at the same
                        time.
                      type: string
                    wait_for_process:
                      description: >-
                        The maximum amount of time (in milliseconds) to wait
                        when the even queue is full.
                      type: string
                guest:
                  description: Properties associated with a user
                  type: object
                  properties:
                    name:
                      description: >-
                        The name of the user.


                        User names can only have alphanumeric ASCII characters
                        and underscores.
                      type: string
                    password:
                      description: >-
                        The password of the user.


                        Mandatory. unless `allow_empty_password` is `true` in
                        the database configs.
                      type: string
                    admin_channels:
                      description: >-
                        A list of channels to explicitly grant to the user for
                        the default collection.

                        See `collection_access` for channels in named
                        collections.
                      type: array
                      items:
                        type: string
                    all_channels:
                      description: >-
                        All the channels that the user has been granted access
                        to for the default collection.

                        See `collection_access` for channels in named
                        collections.


                        Access could have been granted through the sync
                        function, roles, or explicitly on the user under the
                        `admin_channels` property.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    email:
                      description: The email address of the user.
                      type: string
                    disabled:
                      description: >-
                        If true, the user will not be able to login to the
                        account as it is disabled.
                      type: boolean
                      default: false
                    admin_roles:
                      description: A list of roles to explicitly grant to the user.
                      type: array
                      items:
                        type: string
                    roles:
                      description: >-
                        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.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    jwt_roles:
                      description: >-
                        The roles that the user has been added to through
                        roles_claim.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    jwt_channels:
                      description: >-
                        The channels that the user has been granted access to
                        through channels_claim for the default collection.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    jwt_issuer:
                      description: >-
                        The issuer of the last JSON Web Token that the user last
                        used to sign in.
                      type: string
                      readOnly: true
                    jwt_last_updated:
                      description: >-
                        The last time that the user's JWT roles/channels were
                        updated.
                      type: string
                      format: date-time
                      readOnly: true
                    collection_access:
                      description: >-
                        A set of access grants by scope and collection for a
                        specific collection.
                      type: object
                      additionalProperties:
                        maxProperties: 1
                        description: >-
                          An object keyed by scope, containing a set of
                          collections.
                        type: object
                        x-additionalPropertiesName: scopename
                        additionalProperties:
                          description: >-
                            An object keyed by collection name, defines access
                            collections in this scope.
                          type: object
                          x-additionalPropertiesName: collectionname
                          properties:
                            admin_channels:
                              description: >-
                                A list of channels to explicitly grant to the
                                user in this collection.
                              type: array
                              items:
                                type: string
                            all_channels:
                              description: >-
                                All the channels that the user has been granted
                                access to in this collection.


                                Access could have been granted through the sync
                                function, roles, or explicitly on the user under
                                the `admin_channels` property.
                              type: array
                              items:
                                type: string
                              readOnly: true
                            jwt_channels:
                              description: >-
                                The channels that the user has been granted
                                access to through channels_claim for this
                                collection.
                              type: array
                              items:
                                type: string
                              readOnly: true
                            jwt_last_updated:
                              description: >-
                                The last time that the user's JWT channels were
                                updated for this collection.
                              type: string
                              format: date-time
                              readOnly: true
                  title: User
                import_backup_old_rev:
                  description: >-
                    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.
                  type: boolean
                  default: false
                import_docs:
                  description: >-
                    If true, documents will be imported in to Sync Gateway from
                    the bucket in the background. 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 value requires
                    `enable_shared_bucket_access=true`.


                    This can also be set to the string `continuous` which maps
                    to true.
                  type: boolean
                import_filter:
                  description: >-
                    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.
                  type: string
                  example: >-
                    function(doc) { if (doc.type != 'mobile') { return false; }
                    return true; }
                import_partitions:
                  description: >-
                    ** 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.
                  type: number
                  default: 16
                  minimum: 1
                  maximum: 1024
                index:
                  description: Global Secondary Index Settings
                  properties:
                    num_partitions:
                      description: >-
                        The number of partitions to use for the large indexes
                        created by Sync Gateway. It is not recommended to set
                        this unless you require additional horizontal
                        scalability for individual indexes and have
                        appropriately scaled your Query nodes to handle the
                        increased query parallelism. If set, the recommended
                        number is 8 and does not need to be directly related to
                        the number of your Query nodes. Ensure documentation is
                        read to understand the performance tradeoffs and
                        instructions for migration if you have previously run
                        with only one partition. See
                        [/{db}/_index_init](#operation/post_db-_index_init) for
                        more information.


                        If not specified or 1, all indexes will be non
                        partitioned.
                      type: number
                      default: 1
                      title: Number of Index Partitions
                    num_replicas:
                      description: >-
                        This is the number of Global Secondary Indexes (GSI) to
                        use for core indexes.
                      type: number
                      default: 1
                javascript_timeout_secs:
                  description: >-
                    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.
                  type: number
                  default: 60
                keypath:
                  description: The key path (private key) for X.509 bucket auth
                  type: string
                kv_tls_port:
                  description: The Memcached TLS port.
                  type: integer
                  default: 11207
                local_doc_expiry_secs:
                  description: >-
                    The number of seconds before a `_local` document should
                    expire.
                  type: integer
                  default: 7776000
                local_jwt:
                  description: Configuration for Local JWT authentication.
                  type: object
                  additionalProperties:
                    x-additionalPropertiesName: providername
                    description: The providers name.
                    type: object
                    required:
                      - issuer
                      - client_id
                      - algorithms
                      - keys
                    properties:
                      algorithms:
                        description: >-
                          The JWT signing algorithms to accept for
                          authentication.
                        type: array
                        items:
                          type: string
                      channels_claim:
                        description: >-
                          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.
                        type: string
                      client_id:
                        description: >-
                          The value to match against the "aud" claim of JWTs.
                          Set to an empty string to disable audience validation.
                        type: string
                      disable_session:
                        description: >-
                          Disable Sync Gateway session creation on successful
                          JWT authentication.
                        type: boolean
                      issuer:
                        description: The value to match against the "iss" claim of JWTs.
                        type: string
                      keys:
                        description: The JSON Web Keys to use to validate JWTs.
                        type: array
                        items:
                          type: object
                          properties:
                            alg:
                              type: string
                              description: The algorithm intended for use with the key.
                            crv:
                              type: string
                              description: >-
                                For Elliptic Curve keys, the name of the curve
                                to use.
                              enum:
                                - P-256
                                - P-384
                                - P-521
                            e:
                              type: string
                              description: >-
                                For RSA keys, the exponent of the public key, as
                                a Base64urlUInt-encoded value.
                            kid:
                              type: string
                              description: 'The Key ID, used to identify the key to use.'
                            kty:
                              type: string
                              description: >-
                                The cryptographic algorithm family used with the
                                key, such as "RSA" or "EC"
                              enum:
                                - RSA
                                - EC
                            'n':
                              type: string
                              description: >-
                                For RSA keys, the modulus value of the key, as a
                                Base64urlUInt-encoded value.
                            use:
                              type: string
                              description: >-
                                The intended use of the public key. Only 'sig'
                                is accepted.
                              enum:
                                - sig
                            x:
                              type: string
                              description: >-
                                For Elliptic Curve keys, the X coordinate of the
                                point, as a base64url string.
                            'y':
                              type: string
                              description: >-
                                For Elliptic Curve keys, the Y coordinate of the
                                point, as a base64url string.
                      register:
                        description: >-
                          If to register a new Sync Gateway user account when a
                          user logs in with a JWT.
                        type: boolean
                      roles_claim:
                        description: >-
                          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.
                        type: string
                      user_prefix:
                        description: >-
                          This is the username prefix for all users created
                          through this provider.
                        type: string
                      username_claim:
                        description: >-
                          Allows a different OpenID Connect field to be
                          specified instead of the Subject (`sub`).


                          The field name to use can be specified here.
                        type: string
                logging:
                  description: Per-database logging configuration.
                  type: object
                  properties:
                    audit:
                      description: Audit logging configuration.
                      type: object
                      properties:
                        disabled_roles:
                          description: >-
                            List of roles for which audit logging is disabled.
                            Either cbs or sgw.
                          type: array
                          items:
                            type: object
                            properties:
                              domain:
                                description: >
                                  The domain of the role for which audit logging
                                  is disabled.
                                enum:
                                  - cbs
                                  - sgw
                                x-enumDescription:
                                  cbs: Couchbase Server RBAC
                                  sgw: Sync Gateway Role
                                type: string
                              name:
                                description: >-
                                  The name of the role for which audit logging
                                  is disabled.
                                type: string
                        disabled_users:
                          description: List of users for which audit logging is disabled.
                          type: array
                          items:
                            type: object
                            properties:
                              domain:
                                description: >
                                  The domain of the user for which audit logging
                                  is disabled.
                                type: string
                                enum:
                                  - cbs
                                  - sgw
                                x-enumDescription:
                                  cbs: Couchbase Server User
                                  sgw: Sync Gateway User
                              name:
                                description: >-
                                  The name of the user for which audit logging
                                  is disabled.
                                type: string
                        enabled:
                          description: Whether audit logging is enabled.
                          type: boolean
                          default: false
                        enabled_events:
                          description: List of enabled audit events for this database.
                          type: array
                          items:
                            type: number
                            example:
                              - 1234
                              - 5678
                    console:
                      description: Console logging configuration.
                      type: object
                      properties:
                        log_keys:
                          description: Log Keys for the console output
                          type: array
                          items:
                            type: string
                          example:
                            - CRUD
                            - HTTP
                            - Query
                        log_level:
                          description: Log Level for the console output
                          type: string
                          enum:
                            - none
                            - error
                            - warn
                            - info
                            - debug
                            - trace
                          example: debug
                max_concurrent_query_ops:
                  description: >-
                    The maximum amount of query operations that can be running
                    at any one point.
                  type: integer
                  default: 1000
                name:
                  description: The name of the database.
                  type: string
                offline:
                  description: Start the database in an offline state.
                  type: boolean
                  default: false
                oidc:
                  description: Configuration for OpenID Connect authentication.
                  type: object
                  properties:
                    default_provider:
                      description: >-
                        The default provider to use when the provider is not
                        specified in the client.
                      type: string
                    providers:
                      description: List of OpenID Connect issuers.
                      type: object
                      additionalProperties:
                        x-additionalPropertiesName: providername
                        description: The providers name.
                        type: object
                        properties:
                          InsecureSkipVerify:
                            description: >-
                              Determines whether the TLS certificate
                              verification should be disabled for this
                              provider. 
                            type: boolean
                            default: false
                          IsDefault:
                            description: >-
                              Indicates if this is the default OpenID Connect
                              provider.
                            type: boolean
                          Name:
                            description: The name of the OpenID Connect Provider.
                            type: string
                          allow_unsigned_provider_tokens:
                            description: >-
                              Allows users accept unsigned tokens from
                              providers.
                            type: boolean
                          callback_url:
                            description: >-
                              The URL that the OpenID Connect will redirect to
                              after authentication.


                              If not provided, a callback URL will be generated.
                            type: string
                          channels_claim:
                            description: >-
                              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.
                            type: string
                          client_id:
                            description: The OpenID Connect provider client ID.
                            type: string
                          disable_callback_state:
                            description: >-
                              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).**
                            type: boolean
                            default: false
                          disable_cfg_validation:
                            description: >-
                              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.
                            type: boolean
                            default: false
                          disable_session:
                            description: >-
                              Disable Sync Gateway session creation on
                              successful OpenID Connect authentication.
                            type: boolean
                          discovery_url:
                            description: The non-standard discovery endpoint.
                            type: string
                          include_access:
                            description: >-
                              This is whether the `_oidc_callback` response
                              should include the OpenID Connect access token and
                              associated fields (such as `token_type`, and
                              `expires_in`).
                            type: boolean
                          issuer:
                            description: The URL for the OpenID Connect issuer.
                            type: string
                          register:
                            description: >-
                              If to register a new Sync Gateway user account
                              when a user logs in with OpenID Connect.
                            type: boolean
                          roles_claim:
                            description: >-
                              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.
                            type: string
                          scope:
                            description: The scope sent for the OpenID Connect request.
                            type: array
                            items:
                              type: string
                          user_prefix:
                            description: >-
                              This is the username prefix for all users created
                              through this provider.
                            type: string
                          username_claim:
                            description: >-
                              Allows a different OpenID Connect field to be
                              specified instead of the Subject (`sub`).


                              The field name to use can be specified here.
                            type: string
                          validation_key:
                            description: The OpenID Connect provider client secret.
                            type: string
                old_rev_expiry_seconds:
                  description: >-
                    The number of seconds before old revisions are removed from
                    the Couchbase Server bucket.
                  type: number
                  default: 300
                password:
                  description: The password for authenticating to the server.
                  type: string
                query_pagination_limit:
                  description: >-
                    The query limit to be used during pagination of large
                    queries.
                  type: integer
                  default: 5000
                replications:
                  type: object
                  properties:
                    replication_id:
                      description: Properties of a replication
                      type: object
                      x-requirePropertiesSorted: true
                      properties:
                        adhoc:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        batch_size:
                          description: >-
                            The amount of changes to be sent in one batch of
                            replications. Changing this is an Enterprise Edition
                            only feature.
                          type: integer
                          default: 200
                        collections_enabled:
                          description: >-
                            If true, the replicator will run with collections,
                            and will replicate all collections, unless otherwise
                            limited by `collections_local`.


                            If false, the replicator will only replicate the
                            default collection.
                          type: boolean
                          default: false
                        collections_local:
                          description: >-
                            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.
                          type: array
                          items:
                            type: string
                          example:
                            - scope1.collection1
                            - scope1.collection3
                            - scope1.collection6
                          default: []
                        collections_remote:
                          description: >-
                            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.
                          type: array
                          items:
                            type: string
                            nullable: true
                          example:
                            - scope1.collectionA
                            - null
                            - scope1.collectionF
                          default: []
                        conflict_resolution_type:
                          description: >-
                            This defines what conflict resolution policy Sync
                            Gateway should use to apply when resolving
                            conflicting revisions.


                            Changing this is an Enterprise Edition only feature.
                          type: string
                          default: default
                          enum:
                            - default
                            - remoteWins
                            - localWins
                            - custom
                          x-enumDescriptions:
                            default: |-
                              This will use:
                                - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                                - The revision with the most recent timestamp wins.
                                - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                            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.
                        continuous:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        custom_conflict_resolver:
                          description: >-
                            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 document's body.
                            This can be the winning revision (for example,
                            `return conflict.LocalDocument`), a new body, or
                            `nil` to resolve as a delete.


                            Example:


                            ```javascript

                            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.


                            If a document merge is being done, the `_rev` and
                            `_cv` properties should not be included in the
                            returned document body as Sync Gateway will generate
                            new values for these.


                            This is an Enterprise Edition only feature.
                          type: string
                          default: ''
                        direction:
                          description: >-
                            This specifies which direction the replication will
                            be replicating with the `remote` replicator.
                          type: string
                          enum:
                            - push
                            - pull
                            - pushAndPull
                          x-enumDescriptions:
                            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
                        enable_delta_sync:
                          description: >-
                            This will turn on delta-sync for the replication. In
                            order to enable delta-sync for a replication, the
                            database level setting `delta_sync.enabled` must
                            also be set to true.


                            Using delta-sync is an Enterprise Edition only
                            feature.
                          type: boolean
                          default: false
                        filter:
                          description: This defines whether to filter documents.
                          type: string
                          enum:
                            - sync_gateway/bychannel
                            - ''
                          x-enumDescriptions:
                            '': Do not filter any documents.
                            sync_gateway/bychannel: >-
                              If set, a pull replication will be limited to a
                              specific set of channels specified by the
                              `query_param.channels` property.
                        initial_state:
                          description: >-
                            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`.
                          type: string
                          default: running
                          enum:
                            - running
                            - stopped
                          x-enumDescriptions:
                            running: The replication will immediately start running.
                            stopped: >-
                              The replication configuration will be created but
                              the replication will not start running until the
                              user explicitly starts it.
                        max_backoff_time:
                          description: >-
                            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.
                          type: integer
                          default: 5
                        purge_on_removal:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        query_params:
                          description: >-
                            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:

                            ```json

                            "filter":"sync_gateway/bychannel",

                            "query_params": {
                              "channels":["chanUser1"]
                            },

                            ```
                          type: array
                          items:
                            type: string
                        remote:
                          description: >-
                            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,
                            `https://localhost:4985/db`.
                          type: string
                        remote_password:
                          description: >-
                            The password to use to authenticate with the remote.
                            This password will be redacted in the replication
                            config.
                          type: string
                        remote_username:
                          description: The username to use to authenticate with the remote.
                          type: string
                        replication_id:
                          description: >-
                            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.
                          type: string
                          maximum: 160
                        run_as:
                          description: >-
                            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.
                          type: string
                        password:
                          description: >-
                            **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.
                          type: string
                          deprecated: true
                        username:
                          description: >-
                            **This has been deprecated in favour of
                            `remote_username`.**


                            This is the username to use to authenticate with the
                            remote.
                          type: string
                          deprecated: true
                      required:
                        - direction
                      title: User configurable replication properties
                revs_limit:
                  description: The maximum depth a document's revision tree can grow to.
                  type: number
                  default: 50
                  minimum: 0
                roles:
                  additionalProperties:
                    x-additionalPropertiesName: rolename
                    description: Properties associated with a role
                    type: object
                    properties:
                      name:
                        description: >-
                          The name of the role.


                          Role names can only have alphanumeric ASCII characters
                          and underscores.
                        type: string
                      admin_channels:
                        description: >-
                          A list of channels to explicitly grant to the role for
                          the default collection.

                          See `collection_access` for channels in named
                          collections.
                        type: array
                        items:
                          type: string
                      all_channels:
                        description: >-
                          All the channels that the role has been granted access
                          to for the default collection.


                          These channels could have been assigned by the Sync
                          function or using the `admin_channels` property.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      collection_access:
                        description: >-
                          A set of access grants by scope and collection for a
                          specific collection.
                        type: object
                        additionalProperties:
                          maxProperties: 1
                          description: >-
                            An object keyed by scope, containing a set of
                            collections.
                          type: object
                          x-additionalPropertiesName: scopename
                          additionalProperties:
                            description: >-
                              An object keyed by collection name, defines access
                              collections in this scope.
                            type: object
                            x-additionalPropertiesName: collectionname
                            properties:
                              admin_channels:
                                description: >-
                                  A list of channels to explicitly grant to the
                                  user in this collection.
                                type: array
                                items:
                                  type: string
                              all_channels:
                                description: >-
                                  All the channels that the user has been
                                  granted access to in this collection.


                                  Access could have been granted through the
                                  sync function, roles, or explicitly on the
                                  user under the `admin_channels` property.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_channels:
                                description: >-
                                  The channels that the user has been granted
                                  access to through channels_claim for this
                                  collection.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_last_updated:
                                description: >-
                                  The last time that the user's JWT channels
                                  were updated for this collection.
                                type: string
                                format: date-time
                                readOnly: true
                    title: Role
                scopes:
                  description: >-
                    An object keyed by scope name containing config for the
                    specific collection.
                  type: object
                  additionalProperties:
                    x-additionalPropertiesName: scopename
                    description: Scope-specific configuration.
                    type: object
                    properties:
                      collections:
                        description: >-
                          An object keyed by collection name containing config
                          for the specific collection.
                        type: object
                        additionalProperties:
                          x-additionalPropertiesName: collectionname
                          description: Collection-specific configuration.
                          type: object
                          properties:
                            sync:
                              description: >-
                                The Javascript function that newly created
                                documents in this collection are ran through.
                              type: string
                              example: 'function(doc){channel("collection name");}'
                            import_filter:
                              description: >-
                                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.
                              type: string
                              example: >-
                                function(doc) { if (doc.type != 'mobile') {
                                return false; } return true; }
                          title: Collection config
                    title: Scopes
                  maxProperties: 1
                  example:
                    scopename:
                      collections:
                        collectionname1:
                          sync: 'function(doc){channel("collection name");}'
                          import_filter: >-
                            function(doc) { if (doc.type != 'mobile') { return
                            false; } return true; }
                        collectionname2:
                          sync: 'function(doc){channel("collection name");}'
                          import_filter: >-
                            function(doc) { if (doc.type != 'mobile') { return
                            false; } return true; }
                send_www_authenticate_header:
                  description: >-
                    Controls whether to send a `WWW-Authenticate` header in `401
                    Unauthorized` HTTP responses.
                  type: boolean
                  default: true
                serve_insecure_attachment_types:
                  description: >
                    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.
                  type: boolean
                  default: false
                server:
                  description: >-
                    This is the Couchbase Server address or addresses that the
                    database connect to. 
                  type: string
                session_cookie_http_only:
                  description: >-
                    Make all session cookies for the database set the `HttpOnly`
                    flag so they are inaccessible to JavaScript.
                  type: boolean
                  default: false
                session_cookie_name:
                  description: >-
                    This can be used to define a custom per-database session
                    cookie name.
                  type: string
                session_cookie_secure:
                  description: >-
                    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`.
                  type: boolean
                sgreplicate_enabled:
                  description: >-
                    Whether the node should accept assign replications (`true`)
                    or not (`false`).
                  type: boolean
                  default: true
                sgreplicate_websocket_heartbeat_secs:
                  description: >-
                    Use a custom heartbeat interval (in seconds) for websocket
                    ping frames.
                  type: integer
                  default: 300
                slow_query_warning_threshold:
                  description: >-
                    The amount of milliseconds a N1QL query should run before
                    logging a warning. 
                  type: number
                  default: 500
                store_legacy_revtree_data:
                  description: >-
                    Controls whether Sync Gateway stores additional legacy
                    revision tree pointer data to support 3.x/early 4.x clients
                    that still use RevTree IDs (for example when used as delta
                    sources).


                    Disable this when you are confident all clients use newer
                    CV-based revisions and no longer require legacy RevTree ID
                    lookups.
                  type: boolean
                  default: true
                suspendable:
                  description: >-
                    Set to true to allow the database to be suspended.


                    Defaults to true when running in serverless mode otherwise
                    defaults to false.
                  type: boolean
                  default: false
                sync:
                  description: >-
                    The Javascript function that newly created documents are ran
                    through for the default scope and collection.


                    If `scopes` parameter is set, this is ignored.
                  type: string
                  default: 'function(doc){channel(doc.channels);}'
                unsupported:
                  description: >-
                    These are unsupported options and therefore it is not
                    recommended to use them.
                  type: object
                  properties:
                    api_endpoints:
                      type: object
                      properties:
                        enable_couchbase_bucket_flush:
                          description: >-
                            **Setting for test purposes only**


                            Whether Couchbase buckets can be flushed via Admin
                            REST API.
                          type: boolean
                    dcp_read_buffer:
                      description: Set the dcp feed to use a different read buffer size.
                      type: number
                    force_api_forbidden_errors:
                      description: Force REST API errors to return forbidden
                      type: boolean
                    guest_read_only:
                      description: Restrict GUEST document access to read-only.
                      type: boolean
                    kv_buffer:
                      description: Set the kv pool to use a different buffer size.
                      type: number
                    oidc_test_provider:
                      type: object
                      properties:
                        enabled:
                          description: >-
                            Whether the `oidc_test_provider` endpoints should be
                            exposed on the public API.
                          type: boolean
                    oidc_tls_skip_verify:
                      description: Enable self-signed certificates for OIDC testing.
                      type: boolean
                    remote_config_tls_skip_verify:
                      description: >-
                        Enable self-signed certificates for external JavaScript
                        load.
                      type: boolean
                    same_site_cookie:
                      description: >-
                        Override the session cookie SameSite behavior. By
                        default, a session cookie will have SameSite:None if
                        CORS is enabled, and will have no SameSite attribute if
                        CORS is not enabled.  Setting this property to`Default`
                        will omit the SameSite attribute from the cookie.
                      type: string
                      enum:
                        - Default
                        - Lax
                        - None
                        - Strict
                    sgr_tls_skip_verify:
                      description: >-
                        Enable self-signed certificates for SG-replicate
                        testing.
                      type: boolean
                    user_views:
                      type: object
                      properties:
                        enabled:
                          description: >-
                            Whether pass-through view query is supported through
                            public API.
                          type: boolean
                    warning_thresholds:
                      type: object
                      properties:
                        access_and_role_grants_per_doc:
                          description: >-
                            The number of access and role grants per document to
                            be used as a threshold for grant count warnings.
                          type: number
                        channel_name_size:
                          description: >-
                            The number of channel name characters to be used as
                            a threshold for channel name warnings.
                          type: number
                        channels_per_doc:
                          description: >-
                            The number of channels per document to be used as a
                            threshold for the channel count warnings.
                          type: number
                        channels_per_user:
                          description: >-
                            The number of channels per user to be used as a
                            threshold for channel count warnings.
                          type: number
                        xattr_size_bytes:
                          description: >-
                            The number of bytes to be used as a threshold for
                            xattr size limit warnings.
                          type: number
                use_views:
                  description: Force the use of views instead of GSI.
                  type: boolean
                  default: false
                user_xattr_key:
                  description: >-
                    The key to use for the user xattr that will be accessible
                    from the sync function. If empty, the feature will be
                    disabled.


                    This is an Enterprise Edition feature only.
                  type: string
                  maximum: 15
                username:
                  description: The username for authenticating to the server.
                  type: string
                users:
                  additionalProperties:
                    x-additionalPropertiesName: username
                    description: Properties associated with a user
                    type: object
                    properties:
                      name:
                        description: >-
                          The name of the user.


                          User names can only have alphanumeric ASCII characters
                          and underscores.
                        type: string
                      password:
                        description: >-
                          The password of the user.


                          Mandatory. unless `allow_empty_password` is `true` in
                          the database configs.
                        type: string
                      admin_channels:
                        description: >-
                          A list of channels to explicitly grant to the user for
                          the default collection.

                          See `collection_access` for channels in named
                          collections.
                        type: array
                        items:
                          type: string
                      all_channels:
                        description: >-
                          All the channels that the user has been granted access
                          to for the default collection.

                          See `collection_access` for channels in named
                          collections.


                          Access could have been granted through the sync
                          function, roles, or explicitly on the user under the
                          `admin_channels` property.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      email:
                        description: The email address of the user.
                        type: string
                      disabled:
                        description: >-
                          If true, the user will not be able to login to the
                          account as it is disabled.
                        type: boolean
                        default: false
                      admin_roles:
                        description: A list of roles to explicitly grant to the user.
                        type: array
                        items:
                          type: string
                      roles:
                        description: >-
                          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.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_roles:
                        description: >-
                          The roles that the user has been added to through
                          roles_claim.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_channels:
                        description: >-
                          The channels that the user has been granted access to
                          through channels_claim for the default collection.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_issuer:
                        description: >-
                          The issuer of the last JSON Web Token that the user
                          last used to sign in.
                        type: string
                        readOnly: true
                      jwt_last_updated:
                        description: >-
                          The last time that the user's JWT roles/channels were
                          updated.
                        type: string
                        format: date-time
                        readOnly: true
                      collection_access:
                        description: >-
                          A set of access grants by scope and collection for a
                          specific collection.
                        type: object
                        additionalProperties:
                          maxProperties: 1
                          description: >-
                            An object keyed by scope, containing a set of
                            collections.
                          type: object
                          x-additionalPropertiesName: scopename
                          additionalProperties:
                            description: >-
                              An object keyed by collection name, defines access
                              collections in this scope.
                            type: object
                            x-additionalPropertiesName: collectionname
                            properties:
                              admin_channels:
                                description: >-
                                  A list of channels to explicitly grant to the
                                  user in this collection.
                                type: array
                                items:
                                  type: string
                              all_channels:
                                description: >-
                                  All the channels that the user has been
                                  granted access to in this collection.


                                  Access could have been granted through the
                                  sync function, roles, or explicitly on the
                                  user under the `admin_channels` property.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_channels:
                                description: >-
                                  The channels that the user has been granted
                                  access to through channels_claim for this
                                  collection.
                                type: array
                                items:
                                  type: string
                                readOnly: true
                              jwt_last_updated:
                                description: >-
                                  The last time that the user's JWT channels
                                  were updated for this collection.
                                type: string
                                format: date-time
                                readOnly: true
                    title: User
                view_query_timeout_secs:
                  description: The number of seconds before a view query should timeout.
                  type: integer
                  default: 75
                allow_conflicts:
                  description: >-
                    Since Sync Gateway 4.0, this option has no effect.

                    If this option is set to true on an existing database, the
                    database must be modified to remove this parameter in order
                    allow the database to come online. Otherwise, the database
                    will be in the offline state.
                  type: boolean
                  default: false
                  deprecated: true
                enable_shared_bucket_access:
                  description: >-
                    Since Sync Gateway 4.0, this option has no effect.

                    If this option is set to true on an existing database, the
                    database must be modified to remove this parameter in order
                    allow the database to come online. Otherwise, the database
                    will be in the offline state.
                  type: boolean
                  default: true
                  deprecated: true
                feed_type:
                  description: >-
                    The type of feed to use to communicate with Couchbase
                    Server. This will use DCP regardless of specification.
                  type: string
                  default: DCP
                  enum:
                    - DCP
                  deprecated: true
                num_index_replicas:
                  description: >-
                    **Deprecated, please use the database setting
                    `index.num_replicas` instead**
                  deprecated: true
                  type: number
                  default: 1
                pool:
                  description: This field is unsupported and ignored.
                  type: string
                  default: default
                  deprecated: true
                rev_cache_size:
                  description: >-
                    **Deprecated, please use the database setting
                    `cache.rev_cache.size` instead**


                    The maximum number of revisions to store in the revision
                    cache.
                  type: number
                  deprecated: true
              title: Database-config
      responses:
        '201':
          description: Database configuration successfully updated
          headers:
            Etag:
              schema:
                type: string
              description: The new database configuration revision.
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Not Found
        '412':
          description: >-
            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.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: Precondition Failed
                reason: Provided If-Match header does not match current config version
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
  '/{db}/_config/audit':
    get:
      summary: Get database audit configuration
      operationId: get_db-_config-audit
      tags:
        - Database Configuration
      description: |-
        Retrieve the audit configuration for the database specified.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Architect
      parameters:
        - name: verbose
          in: query
          description: Whether to show name and description with each audit event.
          schema:
            type: boolean
            default: false
        - name: filterable
          in: query
          description: Whether to show only filterable audit events.
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Successfully retrieved database configuration
          content:
            application/json:
              schema:
                oneOf:
                  - title: Simple
                    description: A map of audit events and whether they are enabled or not.
                    properties:
                      enabled:
                        type: boolean
                      events:
                        type: object
                        additionalProperties:
                          x-additionalPropertiesName: audit_id
                          description: The audit event ID and whether it is enabled or not.
                          type: boolean
                      disabled_users:
                        description: List of users for which audit logging is disabled.
                        type: array
                        items:
                          type: object
                          properties:
                            domain:
                              description: >
                                The domain of the role for which audit logging
                                is disabled.
                              enum:
                                - cbs
                                - sgw
                              x-enumDescription:
                                cbs: Couchbase Server User
                                sgw: Sync Gateway User
                              type: string
                            name:
                              description: >-
                                The name of the user for which audit logging is
                                disabled.
                              type: string
                      disabled_roles:
                        description: >-
                          List of roles for which audit logging is disabled.
                          Either cbs or sgw.
                        type: array
                        items:
                          type: object
                          properties:
                            domain:
                              description: >
                                The domain of the role for which audit logging
                                is disabled.
                              enum:
                                - cbs
                                - sgw
                              x-enumDescription:
                                cbs: Couchbase Server RBAC
                                sgw: Sync Gateway Role
                              type: string
                            name:
                              description: >-
                                The name of the role for which audit logging is
                                disabled.
                              type: string
                  - title: Verbose
                    description: A map of detailed audit events.
                    properties:
                      enabled:
                        type: boolean
                      events:
                        type: object
                        additionalProperties:
                          x-additionalPropertiesName: audit_id
                          description: The audit event ID and whether it is enabled or not.
                          title: audit-event-verbose
                          type: object
                          properties:
                            name:
                              type: string
                              description: The name of the audit event.
                              readOnly: true
                            description:
                              type: string
                              description: The description of the audit event.
                              readOnly: true
                            enabled:
                              type: boolean
                              description: >-
                                Whether this audit event is currently enabled or
                                not.
                            filterable:
                              type: boolean
                              description: >-
                                Whether this audit event can be disabled. Some
                                audit events are always on.
                              readOnly: true
                      disabled_users:
                        description: List of users for which audit logging is disabled.
                        type: array
                        items:
                          type: object
                          properties:
                            domain:
                              description: >
                                The domain of the role for which audit logging
                                is disabled.
                              enum:
                                - cbs
                                - sgw
                              x-enumDescription:
                                cbs: Couchbase Server User
                                sgw: Sync Gateway User
                              type: string
                            name:
                              description: >-
                                The name of the user for which audit logging is
                                disabled.
                              type: string
                      disabled_roles:
                        description: >-
                          List of roles for which audit logging is disabled.
                          Either cbs or sgw.
                        type: array
                        items:
                          type: object
                          properties:
                            domain:
                              description: >
                                The domain of the role for which audit logging
                                is disabled.
                              enum:
                                - cbs
                                - sgw
                              x-enumDescription:
                                cbs: Couchbase Server RBAC
                                sgw: Sync Gateway Role
                              type: string
                            name:
                              description: >-
                                The name of the role for which audit logging is
                                disabled.
                              type: string
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    put:
      summary: Replace database audit configuration
      description: >-
        Replaces the database audit configuration with the one sent in the
        request.


        Unspecified audit events will be reset to their default enabled value.
        Use POST if you want upsert-style semantics.


        Required Sync Gateway RBAC roles:


        * Sync Gateway Architect
      requestBody:
        description: The new database audit configuration to use
        content:
          application/json:
            schema:
              oneOf:
                - title: Simple
                  description: A map of audit events and whether they are enabled or not.
                  properties:
                    enabled:
                      type: boolean
                    events:
                      type: object
                      additionalProperties:
                        x-additionalPropertiesName: audit_id
                        description: The audit event ID and whether it is enabled or not.
                        type: boolean
                    disabled_users:
                      description: List of users for which audit logging is disabled.
                      type: array
                      items:
                        type: object
                        properties:
                          domain:
                            description: >
                              The domain of the role for which audit logging is
                              disabled.
                            enum:
                              - cbs
                              - sgw
                            x-enumDescription:
                              cbs: Couchbase Server User
                              sgw: Sync Gateway User
                            type: string
                          name:
                            description: >-
                              The name of the user for which audit logging is
                              disabled.
                            type: string
                    disabled_roles:
                      description: >-
                        List of roles for which audit logging is disabled.
                        Either cbs or sgw.
                      type: array
                      items:
                        type: object
                        properties:
                          domain:
                            description: >
                              The domain of the role for which audit logging is
                              disabled.
                            enum:
                              - cbs
                              - sgw
                            x-enumDescription:
                              cbs: Couchbase Server RBAC
                              sgw: Sync Gateway Role
                            type: string
                          name:
                            description: >-
                              The name of the role for which audit logging is
                              disabled.
                            type: string
                - title: Verbose
                  description: A map of detailed audit events.
                  properties:
                    enabled:
                      type: boolean
                    events:
                      type: object
                      additionalProperties:
                        x-additionalPropertiesName: audit_id
                        description: The audit event ID and whether it is enabled or not.
                        title: audit-event-verbose
                        type: object
                        properties:
                          name:
                            type: string
                            description: The name of the audit event.
                            readOnly: true
                          description:
                            type: string
                            description: The description of the audit event.
                            readOnly: true
                          enabled:
                            type: boolean
                            description: >-
                              Whether this audit event is currently enabled or
                              not.
                          filterable:
                            type: boolean
                            description: >-
                              Whether this audit event can be disabled. Some
                              audit events are always on.
                            readOnly: true
                    disabled_users:
                      description: List of users for which audit logging is disabled.
                      type: array
                      items:
                        type: object
                        properties:
                          domain:
                            description: >
                              The domain of the role for which audit logging is
                              disabled.
                            enum:
                              - cbs
                              - sgw
                            x-enumDescription:
                              cbs: Couchbase Server User
                              sgw: Sync Gateway User
                            type: string
                          name:
                            description: >-
                              The name of the user for which audit logging is
                              disabled.
                            type: string
                    disabled_roles:
                      description: >-
                        List of roles for which audit logging is disabled.
                        Either cbs or sgw.
                      type: array
                      items:
                        type: object
                        properties:
                          domain:
                            description: >
                              The domain of the role for which audit logging is
                              disabled.
                            enum:
                              - cbs
                              - sgw
                            x-enumDescription:
                              cbs: Couchbase Server RBAC
                              sgw: Sync Gateway Role
                            type: string
                          name:
                            description: >-
                              The name of the role for which audit logging is
                              disabled.
                            type: string
      operationId: put_db-_config-audit
      tags:
        - Database Configuration
      responses:
        '200':
          description: Database audit configuration successfully updated
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    post:
      summary: Update database audit configuration
      operationId: post_db-_config-audit
      tags:
        - Database Configuration
      description: >-
        This is used to update the database configuration fields specified. Only
        the fields specified in the request will have their values replaced.


        Unspecified audit events will be unaffected. Use PUT if you want to
        reset events to their default state.


        Required Sync Gateway RBAC roles:


        * Sync Gateway Architect
      parameters:
        - name: verbose
          in: query
          description: Whether to show name and description with each audit event.
          schema:
            type: boolean
            default: false
      requestBody:
        description: The database configuration fields to update
        content:
          application/json:
            schema:
              oneOf:
                - title: Simple
                  description: A map of audit events and whether they are enabled or not.
                  properties:
                    enabled:
                      type: boolean
                    events:
                      type: object
                      additionalProperties:
                        x-additionalPropertiesName: audit_id
                        description: The audit event ID and whether it is enabled or not.
                        type: boolean
                    disabled_users:
                      description: List of users for which audit logging is disabled.
                      type: array
                      items:
                        type: object
                        properties:
                          domain:
                            description: >
                              The domain of the role for which audit logging is
                              disabled.
                            enum:
                              - cbs
                              - sgw
                            x-enumDescription:
                              cbs: Couchbase Server User
                              sgw: Sync Gateway User
                            type: string
                          name:
                            description: >-
                              The name of the user for which audit logging is
                              disabled.
                            type: string
                    disabled_roles:
                      description: >-
                        List of roles for which audit logging is disabled.
                        Either cbs or sgw.
                      type: array
                      items:
                        type: object
                        properties:
                          domain:
                            description: >
                              The domain of the role for which audit logging is
                              disabled.
                            enum:
                              - cbs
                              - sgw
                            x-enumDescription:
                              cbs: Couchbase Server RBAC
                              sgw: Sync Gateway Role
                            type: string
                          name:
                            description: >-
                              The name of the role for which audit logging is
                              disabled.
                            type: string
                - title: Verbose
                  description: A map of detailed audit events.
                  properties:
                    enabled:
                      type: boolean
                    events:
                      type: object
                      additionalProperties:
                        x-additionalPropertiesName: audit_id
                        description: The audit event ID and whether it is enabled or not.
                        title: audit-event-verbose
                        type: object
                        properties:
                          name:
                            type: string
                            description: The name of the audit event.
                            readOnly: true
                          description:
                            type: string
                            description: The description of the audit event.
                            readOnly: true
                          enabled:
                            type: boolean
                            description: >-
                              Whether this audit event is currently enabled or
                              not.
                          filterable:
                            type: boolean
                            description: >-
                              Whether this audit event can be disabled. Some
                              audit events are always on.
                            readOnly: true
                    disabled_users:
                      description: List of users for which audit logging is disabled.
                      type: array
                      items:
                        type: object
                        properties:
                          domain:
                            description: >
                              The domain of the role for which audit logging is
                              disabled.
                            enum:
                              - cbs
                              - sgw
                            x-enumDescription:
                              cbs: Couchbase Server User
                              sgw: Sync Gateway User
                            type: string
                          name:
                            description: >-
                              The name of the user for which audit logging is
                              disabled.
                            type: string
                    disabled_roles:
                      description: >-
                        List of roles for which audit logging is disabled.
                        Either cbs or sgw.
                      type: array
                      items:
                        type: object
                        properties:
                          domain:
                            description: >
                              The domain of the role for which audit logging is
                              disabled.
                            enum:
                              - cbs
                              - sgw
                            x-enumDescription:
                              cbs: Couchbase Server RBAC
                              sgw: Sync Gateway Role
                            type: string
                          name:
                            description: >-
                              The name of the role for which audit logging is
                              disabled.
                            type: string
      responses:
        '200':
          description: Database audit configuration successfully updated
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Not Found
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
  '/{keyspace}/_config/sync':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
    get:
      summary: Get database sync function
      operationId: get_keyspace-_config-sync
      tags:
        - Database Configuration
      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
      responses:
        '200':
          description: Successfully retrieved the sync function
          headers:
            Etag:
              schema:
                type: string
              description: The database configuration revision.
          content:
            application/javascript:
              schema:
                type: string
              example: |-
                function (doc, oldDoc) {
                  channel(doc.channels);
                }
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    put:
      summary: Set database sync function
      operationId: put_keyspace-_config-sync
      tags:
        - Database Configuration
      description: |-
        This will allow you to update the sync function.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Architect
      parameters:
        - name: If-Match
          in: header
          required: false
          schema:
            type: string
          description: >-
            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.
        - name: disable_oidc_validation
          in: query
          required: false
          description: >-
            If set, will not attempt to validate the configured OpenID Connect
            providers are reachable.
          schema:
            type: boolean
            default: false
      requestBody:
        description: The new sync function to use
        content:
          application/javascript:
            schema:
              type: string
            example: |-
              function (doc, oldDoc) {
                channel(doc.channels);
              }
      responses:
        '200':
          description: Updated sync function successfully
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '412':
          description: >-
            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.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: Precondition Failed
                reason: Provided If-Match header does not match current config version
    delete:
      summary: Remove custom sync function
      operationId: delete_keyspace-_config-sync
      tags:
        - Database Configuration
      description: >-
        This will remove the custom sync function from the database
        configuration.


        The default sync function is equivalent to:

        ```javascript

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

        ```


        Required Sync Gateway RBAC roles:


        * Sync Gateway Architect
      parameters:
        - name: If-Match
          in: header
          required: false
          schema:
            type: string
          description: >-
            An optimistic concurrency control (OCC) value used to prevent
            conflicts. Use the value returned in the ETag response header of the
            GET request for the resource being updated, or the latest known
            Revision Tree ID or Current Version of the document.
      responses:
        '200':
          description: Successfully reset the sync function
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '412':
          description: >-
            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.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: Precondition Failed
                reason: Provided If-Match header does not match current config version
  '/{keyspace}/_config/import_filter':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
    get:
      summary: Get database import filter
      operationId: get_keyspace-_config-import_filter
      tags:
        - Database Configuration
      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
      responses:
        '200':
          description: Successfully retrieved the import filter
          headers:
            Etag:
              schema:
                type: string
              description: The database configuration revision.
          content:
            application/javascript:
              schema:
                type: string
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    put:
      summary: Set database import filter
      operationId: put_keyspace-_config-import_filter
      tags:
        - Database Configuration
      description: |-
        This will allow you to update the database's import filter.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Architect
      parameters:
        - name: If-Match
          in: header
          required: false
          schema:
            type: string
          description: >-
            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.
        - name: disable_oidc_validation
          in: query
          required: false
          description: >-
            If set, will not attempt to validate the configured OpenID Connect
            providers are reachable.
          schema:
            type: boolean
            default: false
      requestBody:
        description: The import filter to use
        content:
          application/javascript:
            schema:
              type: string
      responses:
        '200':
          description: Updated import filter successfully
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '412':
          description: >-
            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.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: Precondition Failed
                reason: Provided If-Match header does not match current config version
    delete:
      summary: Delete import filter
      operationId: delete_keyspace-_config-import_filter
      tags:
        - Database Configuration
      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:
        - name: If-Match
          in: header
          required: false
          schema:
            type: string
          description: >-
            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.
      responses:
        '200':
          description: Successfully deleted the import filter
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '412':
          description: >-
            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.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: Precondition Failed
                reason: Provided If-Match header does not match current config version
  '/{db}/_resync':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: Get resync status
      operationId: get_db-_resync
      tags:
        - Database Management
      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
      responses:
        '200':
          description: successfully retrieved the most recent resync operation status
          content:
            application/json:
              schema:
                description: The status of a resync operation
                type: object
                properties:
                  status:
                    description: The status of the current operation.
                    type: string
                    enum:
                      - running
                      - completed
                      - stopping
                      - stopped
                      - error
                  start_time:
                    description: >-
                      The ISO-8601 date and time the resync operation was
                      started.
                    type: string
                  last_error:
                    description: >-
                      The last error that occurred in the resync operation (if
                      any).
                    type: string
                  docs_changed:
                    description: >-
                      The amount of documents that have been changed as a result
                      of the resync operation.
                    type: integer
                  docs_processed:
                    description: >-
                      The amount of docs that have been processed so far in the
                      resync operation.
                    type: integer
                  collections_processing:
                    description: The collections that the resync operation is running on.
                    allOf:
                      - description: >-
                          scope name with one or more collection names for which
                          resync will be triggered
                        type: object
                        additionalProperties:
                          allOf:
                            - description: List of collection names
                              type: array
                              items:
                                type: string
                                example:
                                  - collection1
                                  - collection2
                        example:
                          scopeName:
                            - collection1
                            - collection2
                required:
                  - status
                  - start_time
                  - last_error
                  - docs_changed
                  - docs_processed
                title: Resync-status
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    post:
      summary: Start or stop Resync
      operationId: post_db-_resync
      tags:
        - Database Management
      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 [POST
        /{db}/_config](#operation/post_db-_config) with `{"offline": true}` to
        set the database to offline.


        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:
        - name: action
          in: query
          description: This is whether to start a new resync job or stop an existing one.
          schema:
            type: string
            default: start
            enum:
              - start
              - stop
        - name: regenerate_sequences
          in: query
          description: >-
            **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.
          schema:
            type: boolean
        - name: reset
          in: query
          description: >-
            This forces a fresh resync run instead of trying to resume the
            previous resync operation
          schema:
            type: boolean
            default: false
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                scopes:
                  description: This controls for which collections resync will run
                  type: object
                  allOf:
                    - description: >-
                        scope name with one or more collection names for which
                        resync will be triggered
                      type: object
                      additionalProperties:
                        allOf:
                          - description: List of collection names
                            type: array
                            items:
                              type: string
                              example:
                                - collection1
                                - collection2
                      example:
                        scopeName:
                          - collection1
                          - collection2
                regenerate_sequences:
                  description: >-
                    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.
                  type: boolean
                  default: false
      responses:
        '200':
          description: successfully changed the status of the resync operation
          content:
            application/json:
              schema:
                description: The status of a resync operation
                type: object
                properties:
                  status:
                    description: The status of the current operation.
                    type: string
                    enum:
                      - running
                      - completed
                      - stopping
                      - stopped
                      - error
                  start_time:
                    description: >-
                      The ISO-8601 date and time the resync operation was
                      started.
                    type: string
                  last_error:
                    description: >-
                      The last error that occurred in the resync operation (if
                      any).
                    type: string
                  docs_changed:
                    description: >-
                      The amount of documents that have been changed as a result
                      of the resync operation.
                    type: integer
                  docs_processed:
                    description: >-
                      The amount of docs that have been processed so far in the
                      resync operation.
                    type: integer
                  collections_processing:
                    description: The collections that the resync operation is running on.
                    allOf:
                      - description: >-
                          scope name with one or more collection names for which
                          resync will be triggered
                        type: object
                        additionalProperties:
                          allOf:
                            - description: List of collection names
                              type: array
                              items:
                                type: string
                                example:
                                  - collection1
                                  - collection2
                        example:
                          scopeName:
                            - collection1
                            - collection2
                required:
                  - status
                  - start_time
                  - last_error
                  - docs_changed
                  - docs_processed
                title: Resync-status
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  '/{db}/_index_init':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    post:
      summary: Start asynchronous index initialization
      operationId: post_db-_index_init
      tags:
        - Database Management
      description: >
        This can be used to start index initialization with different parameters
        from a running database. The typical workflow is:


        1. Start the process of creating new indexes with [POST
        /{db}/_index_init](#operation/post_db-_index_init).

        2. Wait for index initialization to complete with [GET
        /{db}/_index_init](#operation/get_db-_index_init).

        3. Update the database configuration to use these new indexes with [POST
        /{db}/_config](#operation/post_db-_config).

        4. Call [POST /_post_upgrade](#operation/post__post_upgrade) to remove
        the original indexes.


        This operation will start creation of indexes, and the creation of
        indexes can not be stopped on Couchbase Server once it has been started.


        Required Sync Gateway RBAC roles:


        * Sync Gateway Architect
      parameters:
        - name: action
          in: query
          description: >-
            Defines whether the index creation operation is being started or
            stopped.
          schema:
            type: string
            default: start
            enum:
              - start
              - stop
            x-enumDescriptions:
              start: Starts the creation of indexes.
              stop: >-
                Stops tracking the index creation by Sync Gateway. These indexes
                will still be created on Couchbase Server.
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - type: object
                  description: Settings for Global Secondary Indexes (GSI).
                  properties:
                    create_separate_principal_indexes:
                      description: >-
                        Whether to create separate indexes for users and roles
                        instead of a single larger syncDocs index.


                        The separate principal indexes are smaller and used
                        automatically for new database deployments. To remove
                        the syncDocs index, wait for this to complete, restart
                        all Sync Gateway instances and run  [POST
                        /_post_upgrade](#operation/post__post_upgrade).
                      type: boolean
                      default: false
                    num_partitions:
                      description: >-
                        The number of partitions to use for the large indexes
                        created by Sync Gateway. It is not recommended to set
                        this unless you require additional horizontal
                        scalability for individual indexes and have
                        appropriately scaled your Query nodes to handle the
                        increased query parallelism. If set, the recommended
                        number is 8 and does not need to be directly related to
                        the number of your Query nodes. Ensure documentation is
                        read to understand the performance tradeoffs and
                        instructions for migration if you have previously run
                        with only one partition. See
                        [/{db}/_index_init](#operation/post_db-_index_init) for
                        more information.


                        If not specified or 1, all indexes will be non
                        partitioned.
                      type: number
                      default: 1
                      title: Number of Index Partitions
      responses:
        '200':
          description: >-
            successfully changed the status of the index initialization
            operation
          content:
            application/json:
              schema:
                description: >-
                  The status of an asynchronous indexes initialization
                  operation.
                type: object
                properties:
                  status:
                    description: The status of the current operation.
                    type: string
                    enum:
                      - completed
                      - error
                      - running
                      - stopped
                      - stopping
                    x-enumDescriptions:
                      running: Indexes are being created.
                      completed: All indexes were created.
                      error: The index initialization operation has failed.
                      stopped: >-
                        The index initialization operation has been stopped.
                        These indexes may still exist on Couchbase Server.
                      stopping: >-
                        The index initialization operation is in the process of
                        being stopped.
                  start_time:
                    description: >-
                      The ISO-8601 date and time the index initialization
                      operation was started.
                    type: string
                  last_error:
                    description: >-
                      The last error that occurred in the index initialization
                      operation (if any).
                    type: string
                  index_status:
                    description: >-
                      scope name with one or more collection names and the
                      status of their index creation
                    type: object
                    additionalProperties:
                      x-additionalPropertiesName: scopename
                      description: >-
                        An object keyed by scope, containing a set of
                        collections and the status of their index creation.
                      type: object
                      additionalProperties:
                        x-additionalPropertiesName: collectionname
                        type: string
                        enum:
                          - queued
                          - in progress
                          - ready
                          - error
                        x-enumDescriptions:
                          queued: Indexes are queued for creation.
                          in progress: Indexes are being created.
                          ready: All indexes were created.
                          error: The index creation operation has failed.
                  settings:
                    allOf:
                      - type: object
                        description: Settings for Global Secondary Indexes (GSI).
                        properties:
                          create_separate_principal_indexes:
                            description: >-
                              Whether to create separate indexes for users and
                              roles instead of a single larger syncDocs index.


                              The separate principal indexes are smaller and
                              used automatically for new database deployments.
                              To remove the syncDocs index, wait for this to
                              complete, restart all Sync Gateway instances and
                              run  [POST
                              /_post_upgrade](#operation/post__post_upgrade).
                            type: boolean
                            default: false
                          num_partitions:
                            description: >-
                              The number of partitions to use for the large
                              indexes created by Sync Gateway. It is not
                              recommended to set this unless you require
                              additional horizontal scalability for individual
                              indexes and have appropriately scaled your Query
                              nodes to handle the increased query parallelism.
                              If set, the recommended number is 8 and does not
                              need to be directly related to the number of your
                              Query nodes. Ensure documentation is read to
                              understand the performance tradeoffs and
                              instructions for migration if you have previously
                              run with only one partition. See
                              [/{db}/_index_init](#operation/post_db-_index_init)
                              for more information.


                              If not specified or 1, all indexes will be non
                              partitioned.
                            type: number
                            default: 1
                            title: Number of Index Partitions
                required:
                  - status
                  - start_time
                  - last_error
                  - index_status
                title: IndexInitStatus
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
    get:
      summary: Get status of index initialization
      operationId: get_db-_index_init
      tags:
        - Database Management
      description: >-
        This will retrieve the status of last index initialization operation
        (whether it is running or not) in the Sync Gateway cluster.


        Required Sync Gateway RBAC roles:


        * Sync Gateway Architect
      responses:
        '200':
          description: successfully retrieved the most recent index initialization
          content:
            application/json:
              schema:
                description: >-
                  The status of an asynchronous indexes initialization
                  operation.
                type: object
                properties:
                  status:
                    description: The status of the current operation.
                    type: string
                    enum:
                      - completed
                      - error
                      - running
                      - stopped
                      - stopping
                    x-enumDescriptions:
                      running: Indexes are being created.
                      completed: All indexes were created.
                      error: The index initialization operation has failed.
                      stopped: >-
                        The index initialization operation has been stopped.
                        These indexes may still exist on Couchbase Server.
                      stopping: >-
                        The index initialization operation is in the process of
                        being stopped.
                  start_time:
                    description: >-
                      The ISO-8601 date and time the index initialization
                      operation was started.
                    type: string
                  last_error:
                    description: >-
                      The last error that occurred in the index initialization
                      operation (if any).
                    type: string
                  index_status:
                    description: >-
                      scope name with one or more collection names and the
                      status of their index creation
                    type: object
                    additionalProperties:
                      x-additionalPropertiesName: scopename
                      description: >-
                        An object keyed by scope, containing a set of
                        collections and the status of their index creation.
                      type: object
                      additionalProperties:
                        x-additionalPropertiesName: collectionname
                        type: string
                        enum:
                          - queued
                          - in progress
                          - ready
                          - error
                        x-enumDescriptions:
                          queued: Indexes are queued for creation.
                          in progress: Indexes are being created.
                          ready: All indexes were created.
                          error: The index creation operation has failed.
                  settings:
                    allOf:
                      - type: object
                        description: Settings for Global Secondary Indexes (GSI).
                        properties:
                          create_separate_principal_indexes:
                            description: >-
                              Whether to create separate indexes for users and
                              roles instead of a single larger syncDocs index.


                              The separate principal indexes are smaller and
                              used automatically for new database deployments.
                              To remove the syncDocs index, wait for this to
                              complete, restart all Sync Gateway instances and
                              run  [POST
                              /_post_upgrade](#operation/post__post_upgrade).
                            type: boolean
                            default: false
                          num_partitions:
                            description: >-
                              The number of partitions to use for the large
                              indexes created by Sync Gateway. It is not
                              recommended to set this unless you require
                              additional horizontal scalability for individual
                              indexes and have appropriately scaled your Query
                              nodes to handle the increased query parallelism.
                              If set, the recommended number is 8 and does not
                              need to be directly related to the number of your
                              Query nodes. Ensure documentation is read to
                              understand the performance tradeoffs and
                              instructions for migration if you have previously
                              run with only one partition. See
                              [/{db}/_index_init](#operation/post_db-_index_init)
                              for more information.


                              If not specified or 1, all indexes will be non
                              partitioned.
                            type: number
                            default: 1
                            title: Number of Index Partitions
                required:
                  - status
                  - start_time
                  - last_error
                  - index_status
                title: IndexInitStatus
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{keyspace}/_purge':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
    post:
      summary: Purge a document
      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
      requestBody:
        description: Purge request body
        content:
          application/json:
            schema:
              type: object
              additionalProperties:
                x-additionalPropertiesName: doc_id
                description: >-
                  The document ID to purge. The array must only be 1 element
                  which is `*`.


                  All revisions will be permanently removed for that document.
                type: array
                items:
                  type: string
                  enum:
                    - '*'
            examples:
              single:
                summary: Single document
                value:
                  doc_id:
                    - '*'
              multiple:
                summary: Multiple documents
                value:
                  doc_id_1:
                    - '*'
                  doc_id_2:
                    - '*'
      operationId: post_keyspace-_purge
      tags:
        - Document
      responses:
        '200':
          description: >-
            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).
          content:
            application/json:
              schema:
                type: object
                properties:
                  purged:
                    type: object
                    additionalProperties:
                      x-additionalPropertiesName: doc_id
                      description: >-
                        The document ID that was purged. The array will only
                        contain `*` to indicate that the document was purged.
                      type: array
                      items:
                        type: string
                        enum:
                          - '*'
                required:
                  - purged
              examples:
                single:
                  summary: Single document
                  value:
                    purged:
                      doc_id:
                        - '*'
                multiple:
                  summary: Multiple documents
                  value:
                    purged:
                      doc_id_1:
                        - '*'
                      doc_id_2:
                        - '*'
        '400':
          description: >-
            Bad request. This could be due to the documents listed in the
            request body not having the `["*"]` value for each document ID.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_flush':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    post:
      summary: Flush the entire database bucket | Unsupported
      operationId: post_db-_flush
      tags:
        - Unsupported
      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
      responses:
        '200':
          description: Successfully flushed the bucket
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '503':
          description: The bucket does not support flush or delete
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  '/{db}/_online':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    post:
      summary: Bring the database online
      description: >-
        This will bring the database online on this node only so the Public and
        full Admin REST API requests can be served.


        If using persistent config, call [POST
        /{db}/_config](#operation/post_db-_config) with `{"offline": false}` to
        set the database to online.


        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
      requestBody:
        description: Add an optional delay to wait before bringing the database online
        content:
          application/json:
            schema:
              type: object
              properties:
                delay:
                  description: The amount of seconds to delay bringing the database online.
                  type: integer
                  default: 0
      operationId: post_db-_online
      tags:
        - Database Management
      responses:
        '200':
          description: >-
            Database will be brought online immediately or with the specified
            delay
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '503':
          description: An error occurred
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  '/{db}/_offline':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    post:
      summary: Take the database offline
      operationId: post_db-_offline
      tags:
        - Database Management
      description: >-
        This will take the database offline on this node only. Actions can be
        taken without disrupting current operations ungracefully or having the
        restart the Sync Gateway instance.


        If using persistent config, call [POST
        /{db}/_config](#operation/post_db-_config) with `{"offline": true}` to
        set the database to offline.


        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
      responses:
        '200':
          description: Database has been taken offline successfully
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '503':
          description: An error occurred while trying to take the database offline
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  '/{db}/_dump/{view}':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
      - name: view
        in: path
        required: true
        schema:
          type: string
        description: The view to target.
    get:
      summary: Dump a view | Unsupported
      operationId: get_db-_dump-view
      tags:
        - Unsupported
      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
      responses:
        '200':
          description: Retrieved view successfully
          content:
            text/html:
              schema:
                type: string
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  '/{db}/_view/{view}':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
      - name: view
        in: path
        required: true
        schema:
          type: string
        description: The view to target.
    get:
      summary: Query a view on the default design document | Unsupported
      operationId: get_db-_view-view
      tags:
        - Unsupported
      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:
        - name: inclusive_end
          in: query
          required: false
          description: >-
            Indicates whether the specified end key should be included in the
            result.
          schema:
            type: boolean
        - name: descending
          in: query
          required: false
          description: Return documents in descending order.
          schema:
            type: boolean
        - name: include_docs
          in: query
          required: false
          description: >-
            Only works when using Couchbase Server 3.0 and earlier. Indicates
            whether to include the full content of the documents in the
            response.
          schema:
            type: boolean
        - name: reduce
          in: query
          required: false
          description: Whether to execute a reduce function on the response or not.
          schema:
            type: boolean
        - name: group
          in: query
          required: false
          description: >-
            Group the results using the reduce function to a group or single
            row.
          schema:
            type: boolean
        - name: skip
          in: query
          required: false
          description: >-
            Skip the specified number of documents before starting to return
            results.
          schema:
            type: integer
        - name: limit
          in: query
          required: false
          description: Return only the specified number of documents
          schema:
            type: integer
        - name: group_level
          in: query
          required: false
          description: Specify the group level to be used.
          schema:
            type: integer
        - name: startkey_docid
          in: query
          required: false
          description: Return documents starting with the specified document identifier.
          schema:
            type: string
        - name: endkey_docid
          in: query
          required: false
          description: >-
            Stop returning records when the specified document identifier is
            reached.
          schema:
            type: string
        - name: stale
          in: query
          required: false
          description: >-
            Allow the results from a stale view to be used, without triggering a
            rebuild of all views within the encompassing design document.
          schema:
            type: string
            enum:
              - ok
              - update_after
        - name: startkey
          in: query
          required: false
          schema:
            type: string
          description: Return records starting with the specified key.
        - name: endkey
          in: query
          required: false
          schema:
            type: string
          description: Stop returning records when this key is reached.
        - name: key
          in: query
          required: false
          description: Return only the document that matches the specified key.
          schema:
            type: string
        - name: keys
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          description: An array of document ID strings to filter by.
      responses:
        '200':
          description: Returned view successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  total_rows:
                    type: integer
                  rows:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        key:
                          type: object
                        value:
                          type: object
                        doc:
                          type: object
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        From:
                          type: string
                        Reason:
                          type: string
                required:
                  - total_rows
                  - rows
        '403':
          description: Forbidden
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{keyspace}/_dumpchannel/{channel}':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
      - name: channel
        in: path
        description: The channel to dump all the documents from.
        required: true
        schema:
          type: string
    get:
      summary: Dump all the documents in a channel | Unsupported
      operationId: get_keyspace-_dumpchannel-channel
      tags:
        - Unsupported
      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:
        - name: since
          in: query
          description: >-
            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.
          schema:
            type: string
      responses:
        '200':
          description: Successfully got all documents in the channel
          content:
            text/html:
              schema:
                type: string
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_repair':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    post:
      summary: Disabled endpoint
      operationId: post_db-_repair
      tags:
        - Unsupported
      description: |-
        This endpoint is disabled.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Architect
      responses:
        '500':
          description: This endpoint is disabled
  '/{db}/_compact':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    post:
      summary: Manage a compact operation
      operationId: post_db-_compact
      tags:
        - Database Management
      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:
        - name: type
          in: query
          required: false
          schema:
            type: string
            default: tombstone
            enum:
              - attachment
              - tombstone
          description: |-
            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.'
        - name: action
          in: query
          description: Defines whether the compact operation is being started or stopped.
          schema:
            type: string
            default: start
            enum:
              - start
              - stop
        - name: reset
          in: query
          description: >-
            **Attachment compaction only**


            This forces a fresh compact start instead of trying to resume the
            previous failed compact operation.
          schema:
            type: boolean
        - name: dry_run
          in: query
          description: >-
            **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.'
          schema:
            type: boolean
      responses:
        '200':
          description: Started or stopped compact operation successfully
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '503':
          description: >-
            Cannot start compaction due to another compaction operation still
            running.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
    get:
      summary: Get the status of the most recent compact operation
      operationId: get_db-_compact
      tags:
        - Database Management
      description: >-
        This will retrieve the current status of the most recent compact
        operation.


        Required Sync Gateway RBAC roles:


        * Sync Gateway Architect
      parameters:
        - name: type
          in: query
          required: false
          schema:
            type: string
            default: tombstone
            enum:
              - attachment
              - tombstone
          description: |-
            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.'
      responses:
        '200':
          description: Compaction status retrieved successfully
          content:
            application/json:
              schema:
                description: The status returned from a compaction.
                type: object
                properties:
                  status:
                    description: The status of the current operation.
                    type: string
                  start_time:
                    description: >-
                      The ISO-8601 date and time the compact operation was
                      started.
                    type: string
                  last_error:
                    description: >-
                      The last error that occurred in the compact operation (if
                      any).
                    type: string
                  docs_purged:
                    description: >-
                      **Applicable to tombstone compaction only**


                      This is the amount of documents that have been purged so
                      far.
                    type: string
                  marked_attachments:
                    description: >-
                      **Applicable to attachment compaction only**


                      This is the number of references there are to legacy
                      attachments.
                    type: string
                  purged_attachments:
                    description: >-
                      **Applicable to attachment compaction only**


                      This is the amount of attachments that have been purged so
                      far.
                    type: string
                  compact_id:
                    description: |-
                      **Applicable to attachment compaction only**

                      This is the ID of the compaction.
                    type: string
                  phase:
                    description: >-
                      **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).
                    type: string
                  dry_run:
                    description: |
                      **Applicable to attachment compaction only**
                    type: string
                    enum:
                      - mark
                      - sweep
                      - cleanup
                required:
                  - status
                  - start_time
                  - last_error
                title: Compact-status
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_attachment_migration':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    post:
      summary: Manage a attachment migration operation
      operationId: post_db-_attachment_migration
      tags:
        - Database Management
      description: >-
        This allows a new attachment migration operation to be done on the
        database, or to stop an existing running attachment migration operation.


        Attachment Migration is a single node process and can only one node can
        be running it at one point.


        Required Sync Gateway RBAC roles:


        * Sync Gateway Architect
      parameters:
        - name: action
          in: query
          description: >-
            Defines whether the an attachment migration operation is being
            started or stopped.
          schema:
            type: string
            default: start
            enum:
              - start
              - stop
        - name: reset
          in: query
          description: >-
            This forces a fresh attachment migration start instead of trying to
            resume the previous failed migration operation.
          schema:
            type: boolean
      responses:
        '200':
          description: Started or stopped compact operation successfully
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '503':
          description: >-
            Cannot start attachment migration due to another migration operation
            still running.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
    get:
      summary: Get the status of the most recent attachment migration operation
      operationId: get_db-_attachment_migration
      tags:
        - Database Management
      description: >-
        This will retrieve the current status of the most recent attachment
        migration operation.


        Required Sync Gateway RBAC roles:


        * Sync Gateway Architect
      responses:
        '200':
          description: Attachment migration status retrieved successfully
          content:
            application/json:
              schema:
                description: The status of a attachment migration operation
                type: object
                properties:
                  status:
                    description: The status of the current attachment migration operation.
                    type: string
                    enum:
                      - running
                      - completed
                      - stopping
                      - stopped
                      - error
                  start_time:
                    description: >-
                      The ISO-8601 date and time the attachment migration
                      operation was started.
                    type: string
                  last_error:
                    description: >-
                      The last error that occurred in the attachment migration
                      operation (if any).
                    type: string
                  migration_id:
                    description: The UUID given to the attachment migration operation.
                    type: string
                  docs_changed:
                    description: >-
                      The amount of documents that have had attachment metadata
                      migrated as a result of attachment migration operation.
                    type: integer
                  docs_processed:
                    description: >-
                      The amount of docs that have been processed through the
                      attachment migration operation.
                    type: integer
                  docs_failed:
                    description: >-
                      The amount of docs that have failed to be processed
                      through the attachment migration operation.
                    type: integer
                required:
                  - status
                  - start_time
                  - last_error
                  - docs_changed
                  - docs_processed
                title: Attachment-Migration-status
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{keyspace}/':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
    post:
      summary: Create a new document
      operationId: post_keyspace-
      tags:
        - Document
      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:
        - name: roundtrip
          in: query
          required: false
          schema:
            type: boolean
          description: Block until document has been received by change cache
      requestBody:
        content:
          application/json:
            schema:
              description: The configurable Sync Gateway properties of a document.
              type: object
              additionalProperties: true
              properties:
                _id:
                  description: The ID of the document.
                  type: string
                _rev:
                  description: The revision of the document.
                  type: string
                _exp:
                  description: >-
                    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.
                  type: string
                _deleted:
                  description: >-
                    Whether the document is a tombstone or not. If true, it is a
                    tombstone.
                  type: boolean
                _revisions:
                  type: object
                  properties:
                    start:
                      description: Prefix number for the latest revision.
                      type: number
                    ids:
                      description: >-
                        Array of valid Revision Tree IDs, in reverse order
                        (latest first).
                      type: array
                      items:
                        type: string
                _attachments:
                  type: object
                  additionalProperties:
                    x-additionalPropertiesName: attachmentname
                    description: The name of the attachment.
                    type: object
                    properties:
                      content_type:
                        description: Content type of the attachment.
                        type: string
                      data:
                        description: The data in the attachment in base64.
                        type: string
      responses:
        '200':
          description: New document revision created successfully.
          headers:
            Etag:
              schema:
                type: string
              description: The revision ID of the newly created document.
            Location:
              schema:
                type: string
              description: The document ID of the newly created document.
          content:
            application/json:
              schema:
                description: Properties returned when a new document revision is created
                type: object
                properties:
                  id:
                    description: The ID of the document.
                    type: string
                  ok:
                    description: Whether the request completed successfully.
                    type: boolean
                  rev:
                    description: The Revision Tree ID of the document.
                    type: string
                  cv:
                    description: The CV of the document.
                    type: string
                required:
                  - id
                  - ok
                  - rev
                title: New-revision
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '409':
          description: Resource already exists under that name
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '415':
          description: Invalid content type
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  /_expvar:
    get:
      summary: Get all Sync Gateway statistics in JSON format
      operationId: get__expvar
      tags:
        - Metrics
      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
      responses:
        '200':
          description: |-
            Successfully returned statistics.
            For details, see [JSON Metrics](stats-monitoring-json.html).
          content:
            application/json:
              schema:
                type: object
                properties:
                  cmdline:
                    description: >-
                      Built-in variables from the Go runtime, lists the
                      command-line arguments
                    type: object
                  memstats:
                    description: >-
                      Dumps a large amount of information about the memory heap
                      and garbage collector
                    type: object
                  cb:
                    description: >-
                      Variables reported by the Couchbase SDK (go_couchbase
                      package)
                    type: object
                  mc:
                    description: >-
                      Variables reported by the low-level memcached API
                      (gomemcached package)
                    type: object
                  syncGateway_changeCache:
                    type: object
                    properties:
                      maxPending:
                        description: >-
                          Max number of sequences waiting on a missing earlier
                          sequence number
                        type: object
                      lag-tap-0000ms:
                        description: >-
                          Histogram of delay from doc save till it shows up in
                          Tap feed
                        type: object
                      lag-queue-0000ms:
                        description: >-
                          Histogram of delay from Tap feed till doc is posted to
                          changes feed
                        type: object
                      lag-total-0000ms:
                        description: >-
                          Histogram of total delay from doc save till posted to
                          changes feed
                        type: object
                      outOfOrder:
                        description: Number of out-of-order sequences posted
                        type: object
                      view_queries:
                        description: Number of queries to channels view
                        type: object
                  syncGateway_db:
                    type: object
                    properties:
                      channelChangesFeeds:
                        description: >-
                          Number of calls to db.changesFeed, i.e. generating a
                          changes feed for a single channel.
                        type: object
                      channelLogAdds:
                        description: Number of entries added to channel logs
                        type: object
                      channelLogAppends:
                        description: >-
                          Number of times entries were written to channel logs
                          using an APPEND operation
                        type: object
                      channelLogCacheHits:
                        description: >-
                          Number of requests for channel-logs that were
                          fulfilled from the in-memory cache
                        type: object
                      channelLogRewrites:
                        description: >-
                          Number of times entries were written to channel logs
                          using a SET operation (rewriting the entire log)
                        type: object
                      channelLogRewriteCollisions:
                        description: >-
                          Number of collisions while attempting to rewrite
                          channel logs using SET
                        type: object
                      document_gets:
                        description: Number of times a document was read from the database
                        type: object
                      revisionCache_adds:
                        description: Number of revisions added to the revision cache
                        type: object
                      revisionCache_hits:
                        description: Number of times a revision-cache lookup succeeded
                        type: object
                      revisionCache_misses:
                        description: Number of times a revision-cache lookup failed
                        type: object
                      revs_added:
                        description: >-
                          Number of revisions added to the database (including
                          deletions)
                        type: object
                      sequence_gets:
                        description: Number of times the database's lastSequence was read
                        type: object
                      sequence_reserves:
                        description: >-
                          Number of times the database's lastSequence was
                          incremented
                        type: object
                  syncgateway:
                    description: Monitoring stats
                    type: object
                    properties:
                      global:
                        description: Global Sync Gateway stats
                        type: object
                        properties:
                          resource_utilization:
                            description: Resource utilization stats
                            type: object
                            properties:
                              admin_net_bytes_recv:
                                type: integer
                                description: >-
                                  The total number of bytes received (since node
                                  start-up) on the network interface to which
                                  the Sync Gateway api.admin_interface is bound.
                              admin_net_bytes_sent:
                                type: integer
                                description: >-
                                  The total number of bytes sent (since node
                                  start-up) on the network interface to which
                                  the Sync Gateway api.admin_interface is bound.
                              error_count:
                                type: integer
                                description: The total number of errors logged.
                              go_memstats_heapalloc:
                                type: integer
                                description: >-
                                  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).
                              go_memstats_heapidle:
                                type: integer
                                description: >-
                                  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.
                              go_memstats_heapinuse:
                                type: integer
                                description: >-
                                  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.
                              go_memstats_heapreleased:
                                type: integer
                                description: >-
                                  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.
                              go_memstats_pausetotalns:
                                type: integer
                                description: >-
                                  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.
                              go_memstats_stackinuse:
                                type: integer
                                description: >-
                                  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).
                              go_memstats_stacksys:
                                type: integer
                                description: >-
                                  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).
                              go_memstats_sys:
                                type: integer
                                description: >-
                                  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.
                              goroutines_high_watermark:
                                type: integer
                                description: >-
                                  Peak number of go routines since process
                                  start.
                              num_goroutines:
                                type: integer
                                description: The total number of goroutines.
                              num_idle_kv_ops:
                                type: integer
                                description: The total number of idle kv operations.
                              num_idle_query_ops:
                                type: integer
                                description: The total number of idle query operations.
                              process_cpu_percent_utilization:
                                type: number
                                format: float
                                description: >-
                                  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.
                              node_cpu_percent_utilization:
                                type: number
                                format: float
                                description: >-
                                  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.
                              process_memory_resident:
                                type: integer
                                description: >-
                                  The memory utilization (Resident Set Size) for
                                  the process, in bytes.
                              pub_net_bytes_recv:
                                type: integer
                                description: >-
                                  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
                              pub_net_bytes_sent:
                                type: integer
                                description: >-
                                  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.
                              system_memory_total:
                                type: integer
                                description: >-
                                  The total memory available on the system in
                                  bytes.
                              warn_count:
                                type: integer
                                description: The total number of warnings logged.
                              uptime:
                                type: integer
                                description: The total uptime.
                      per_db:
                        description: >-
                          This array contains stats for all databases declared
                          in the config file &mdash; see [View Statistics and
                          Metrics](stats-monitoring.html) for more details on
                          the metrics collected and reported by Sync Gateway.


                          The statistics for each 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`
                        type: array
                        items:
                          type: object
                          properties:
                            cache:
                              type: object
                            database:
                              type: object
                            per_replication:
                              type: object
                            collections:
                              type: object
                            security:
                              type: object
                      per_replication:
                        description: >-
                          An array of stats for each replication declared in the
                          config file

                          **Deprecated @ 2.8**: used only by inter-sync-gateway
                          replications version 1.
                        type: array
                        items:
                          type: object
                          description: Stats for a given replication_id
                          properties:
                            $replication_id:
                              type: object
                              properties:
                                sgr_active:
                                  description: >-
                                    Whether the replication is active at this
                                    time.

                                    **Deprecated @ 2.8**: used only by
                                    inter-sync-gateway replications version 1.
                                  type: boolean
                                sgr_docs_checked_sent:
                                  description: >-
                                    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.
                                  type: integer
                                sgr_num_attachments_transferred:
                                  description: >-
                                    The total number of attachments transferred
                                    since replication started.

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

                                    **Deprecated @ 2.8**: used only by
                                    inter-sync-gateway replications version 1.
                                  type: integer
                                sgr_num_docs_failed_to_push:
                                  description: >-
                                    The total number of documents that failed to
                                    be pushed since replication started.

                                    Used by versions 1 and 2.
                                  type: integer
                                sgr_num_docs_pushed:
                                  description: >-
                                    The total number of documents that were
                                    pushed since replication started.

                                    Used by versions 1 and 2.
                                  type: integer
                        deprecated: true
  /:
    get:
      summary: Get server information
      operationId: get_-
      tags:
        - Server
      description: Returns information about the Sync Gateway node.
      responses:
        '200':
          description: Returned server information
          content:
            application/json:
              schema:
                type: object
                properties:
                  ADMIN:
                    description: >-
                      `true` if the request is from the Admin API - otherwise
                      omitted.
                    type: boolean
                    example: true
                  couchdb:
                    description: CouchDB welcome
                    type: string
                    example: Welcome
                  vendor:
                    allOf:
                      - description: Product vendor
                        type: object
                        properties:
                          name:
                            description: Product name
                            type: string
                            example: Couchbase Sync Gateway
                          version:
                            description: |-
                              API version.
                              Omitted if `api.hide_product_version=true`
                            type: string
                            example: 3.1
                        required:
                          - name
                        title: Vendor
                  version:
                    description: >-
                      Product version, including the build number and edition
                      (i.e. `EE` or `CE`)

                      Omitted if `api.hide_product_version=true`
                    type: string
                    example: Couchbase Sync Gateway/3.1.0(1;a765231) EE
                  persistent_config:
                    description: >-
                      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.
                    type: boolean
                    example: true
                required:
                  - couchdb
                  - vendor
    head:
      summary: Check if server online
      operationId: head_-
      tags:
        - Server
      description: Check if the server is online by checking the status code of response.
      responses:
        '200':
          description: Server is online
  /_ping:
    get:
      summary: Check if API is available
      operationId: get__ping
      tags:
        - Server
      description: Returns OK status if API is available.
      responses:
        '200':
          description: Returned status
          content:
            text/plain:
              schema:
                type: string
              example: OK
  '/{keyspace}/_changes':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
    get:
      summary: Get changes list
      operationId: get_keyspace-_changes
      tags:
        - Document
      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:
        - name: limit
          in: query
          description: Maximum number of changes to return.
          schema:
            type: integer
        - name: since
          in: query
          description: >-
            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.
          schema:
            type: string
        - name: style
          in: query
          description: >-
            Controls whether to return the current winning revision
            (`main_only`) or all the leaf revision including conflicts and
            deleted former conflicts (`all_docs`).
          schema:
            type: string
            default: main_only
            enum:
              - main_only
              - all_docs
        - name: active_only
          in: query
          description: >-
            Set true to exclude deleted documents and notifications for
            documents the user no longer has access to from the changes feed.
          schema:
            type: boolean
            default: false
        - name: include_docs
          in: query
          required: false
          schema:
            type: boolean
          description: Include the body associated with each document.
        - name: revocations
          in: query
          description: 'If true, revocation messages will be sent on the changes feed.'
          schema:
            type: boolean
        - name: filter
          in: query
          description: Set a filter to either filter by channels or document IDs.
          schema:
            type: string
            enum:
              - sync_gateway/bychannel
              - _doc_ids
        - name: channels
          in: query
          description: >-
            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`.
          schema:
            type: string
        - name: doc_ids
          in: query
          description: >-
            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.
          schema:
            type: array
            items:
              type: string
        - name: heartbeat
          in: query
          description: >-
            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. If heartbeat is non zero, it must be at
            least 25000 milliseconds.
          schema:
            type: integer
            default: 0
        - name: timeout
          in: query
          description: >-
            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.
          schema:
            type: integer
            default: 300000
            maximum: 900000
            minimum: 0
        - name: feed
          in: query
          description: 'The type of changes feed to use. '
          schema:
            type: string
            default: normal
            enum:
              - normal
              - longpoll
              - continuous
              - websocket
        - name: request_plus
          in: query
          description: >-
            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.
          schema:
            type: boolean
            default: false
        - name: version_type
          in: query
          description: >-
            The preferred type of document versioning to use for the changes
            feed.
          schema:
            type: string
            default: rev
            enum:
              - rev
              - cv
            x-enumDescriptions:
              rev: >-
                Revision Tree IDs. For example:
                1-293a80ce8f4874724732f27d35b3959a13cd96e0
              cv: >-
                Current Version. For example:
                1854e4e557cc0000@zTWkmBiYZgNQo7BHVZrB/Q
      responses:
        '200':
          description: Successfully returned the changes feed
          content:
            application/json:
              schema:
                description: Properties of a changes feed
                type: object
                properties:
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        seq:
                          description: The change sequence number.
                          type: number
                        id:
                          description: The document ID the change happened on.
                          type: string
                        changes:
                          description: >-
                            List of document leafs with each leaf containing
                            only a `rev` or `cv` field.
                          type: array
                          items:
                            oneOf:
                              - type: object
                                properties:
                                  rev:
                                    description: >-
                                      The Revision Tree ID associated with the
                                      change. This may be returned even when the
                                      `version_type` preference is set to `cv`
                                      if this document was an old revision
                                      written prior to upgrading to SG 4.0+
                                    type: string
                                title: Revision Tree ID
                              - type: object
                                properties:
                                  cv:
                                    description: >-
                                      The Current Version associated with the
                                      change. This value requires the
                                      `version_type` preference set to `cv` and
                                      this document revision being written
                                      through SG 4.0+
                                    type: string
                                title: Current Version
                          uniqueItems: true
                    uniqueItems: true
                  last_seq:
                    description: The last change sequence number.
                    type: string
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    post:
      summary: Get changes list
      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
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                limit:
                  description: Maximum number of changes to return.
                  type: string
                style:
                  description: >-
                    Controls whether to return the current winning revision
                    (`main_only`) or all the leaf revision including conflicts
                    and deleted former conflicts (`all_docs`).
                  type: string
                active_only:
                  description: >-
                    Set true to exclude deleted documents and notifications for
                    documents the user no longer has access to from the changes
                    feed.
                  type: string
                include_docs:
                  description: Include the body associated with each document.
                  type: string
                revocations:
                  description: >-
                    If true, revocation messages will be sent on the changes
                    feed.
                  type: string
                filter:
                  description: Set a filter to either filter by channels or document IDs.
                  type: string
                channels:
                  description: >-
                    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`.
                  type: string
                doc_ids:
                  description: >-
                    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`.
                  type: string
                heartbeat:
                  description: >-
                    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.
                  type: string
                timeout:
                  description: >-
                    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.
                  type: string
                feed:
                  description: 'The type of changes feed to use. '
                  type: string
                request_plus:
                  description: >-
                    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.
                  type: boolean
                  default: false
                version_type:
                  description: >-
                    The preferred type of document versioning to use for the
                    changes feed.
                  type: string
                  default: rev
                  enum:
                    - rev
                    - cv
                  x-enumDescriptions:
                    rev: >-
                      Revision Tree IDs. For example:
                      1-293a80ce8f4874724732f27d35b3959a13cd96e0
                    cv: >-
                      Current Version. For example:
                      1854e4e557cc0000@zTWkmBiYZgNQo7BHVZrB/Q
      operationId: post_keyspace-_changes
      tags:
        - Document
      responses:
        '200':
          description: Successfully returned the changes feed
          content:
            application/json:
              schema:
                description: Properties of a changes feed
                type: object
                properties:
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        seq:
                          description: The change sequence number.
                          type: number
                        id:
                          description: The document ID the change happened on.
                          type: string
                        changes:
                          description: >-
                            List of document leafs with each leaf containing
                            only a `rev` or `cv` field.
                          type: array
                          items:
                            oneOf:
                              - type: object
                                properties:
                                  rev:
                                    description: >-
                                      The Revision Tree ID associated with the
                                      change. This may be returned even when the
                                      `version_type` preference is set to `cv`
                                      if this document was an old revision
                                      written prior to upgrading to SG 4.0+
                                    type: string
                                title: Revision Tree ID
                              - type: object
                                properties:
                                  cv:
                                    description: >-
                                      The Current Version associated with the
                                      change. This value requires the
                                      `version_type` preference set to `cv` and
                                      this document revision being written
                                      through SG 4.0+
                                    type: string
                                title: Current Version
                          uniqueItems: true
                    uniqueItems: true
                  last_seq:
                    description: The last change sequence number.
                    type: string
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_design/{ddoc}':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
      - name: ddoc
        in: path
        required: true
        schema:
          type: string
        description: The design document name.
    get:
      summary: Get views of a design document | Unsupported
      operationId: get_db-_design-ddoc
      tags:
        - Unsupported
      description: |-
        **This is unsupported**

        Query a design document.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Application
        * Sync Gateway Application Read Only
      responses:
        '200':
          description: Successfully returned design document.
          content:
            application/json:
              schema:
                description: Properties of a design document
                type: object
                properties:
                  language:
                    type: string
                  views:
                    type: object
                    additionalProperties:
                      x-additionalPropertiesName: viewname
                      description: The name of the view.
                      type: object
                      properties:
                        map:
                          type: string
                        reduce:
                          type: string
                  options:
                    type: object
                    properties:
                      local_seq:
                        type: string
                      include_design:
                        type: string
                      raw:
                        type: string
                      index_xattr_on_deleted_docs:
                        type: string
        '403':
          description: >-
            Forbidden access possibly due to not using the Admin API or the
            design document is a built-in Sync Gateway one.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    put:
      summary: Update views of a design document | Unsupported
      description: |-
        **This is unsupported**

        Update the views of a design document.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Application
      requestBody:
        content:
          application/json:
            schema:
              description: Properties of a design document
              type: object
              properties:
                language:
                  type: string
                views:
                  type: object
                  additionalProperties:
                    x-additionalPropertiesName: viewname
                    description: The name of the view.
                    type: object
                    properties:
                      map:
                        type: string
                      reduce:
                        type: string
                options:
                  type: object
                  properties:
                    local_seq:
                      type: string
                    include_design:
                      type: string
                    raw:
                      type: string
                    index_xattr_on_deleted_docs:
                      type: string
      operationId: put_db-_design-ddoc
      tags:
        - Unsupported
      responses:
        '200':
          description: Design document changes successfully
        '403':
          description: >-
            Forbidden access possibly due to not using the Admin API or the
            design document is a built-in Sync Gateway one.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    delete:
      summary: Delete a design document | Unsupported
      operationId: delete_db-_design-ddoc
      tags:
        - Unsupported
      description: |-
        **This is unsupported**

        Delete a design document.

        Required Sync Gateway RBAC roles:

        * Sync Gateway Application
      responses:
        '200':
          description: Design document deleted successfully
        '403':
          description: >-
            Forbidden access possibly due to not using the Admin API or the
            design document is a built-in Sync Gateway one.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    head:
      summary: Check if view of design document exists | Unsupported
      operationId: head_db-_design-ddoc
      tags:
        - Unsupported
      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
      responses:
        '200':
          description: Design document exists
        '403':
          description: >-
            Forbidden access possibly due to not using the Admin API or the
            design document is a built-in Sync Gateway one.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_design/{ddoc}/_view/{view}':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
      - name: ddoc
        in: path
        required: true
        schema:
          type: string
        description: The design document name.
      - name: view
        in: path
        required: true
        schema:
          type: string
        description: The view to target.
    get:
      summary: Query a view on a design document | Unsupported
      operationId: get_db-_design-ddoc-_view-view
      tags:
        - Unsupported
      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:
        - name: inclusive_end
          in: query
          required: false
          description: >-
            Indicates whether the specified end key should be included in the
            result.
          schema:
            type: boolean
        - name: descending
          in: query
          required: false
          description: Return documents in descending order.
          schema:
            type: boolean
        - name: include_docs
          in: query
          required: false
          description: >-
            Only works when using Couchbase Server 3.0 and earlier. Indicates
            whether to include the full content of the documents in the
            response.
          schema:
            type: boolean
        - name: reduce
          in: query
          required: false
          description: Whether to execute a reduce function on the response or not.
          schema:
            type: boolean
        - name: group
          in: query
          required: false
          description: >-
            Group the results using the reduce function to a group or single
            row.
          schema:
            type: boolean
        - name: skip
          in: query
          required: false
          description: >-
            Skip the specified number of documents before starting to return
            results.
          schema:
            type: integer
        - name: limit
          in: query
          required: false
          description: Return only the specified number of documents
          schema:
            type: integer
        - name: group_level
          in: query
          required: false
          description: Specify the group level to be used.
          schema:
            type: integer
        - name: startkey_docid
          in: query
          required: false
          description: Return documents starting with the specified document identifier.
          schema:
            type: string
        - name: endkey_docid
          in: query
          required: false
          description: >-
            Stop returning records when the specified document identifier is
            reached.
          schema:
            type: string
        - name: stale
          in: query
          required: false
          description: >-
            Allow the results from a stale view to be used, without triggering a
            rebuild of all views within the encompassing design document.
          schema:
            type: string
            enum:
              - ok
              - update_after
        - name: startkey
          in: query
          required: false
          schema:
            type: string
          description: Return records starting with the specified key.
        - name: endkey
          in: query
          required: false
          schema:
            type: string
          description: Stop returning records when this key is reached.
        - name: key
          in: query
          required: false
          description: Return only the document that matches the specified key.
          schema:
            type: string
        - name: keys
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          description: An array of document ID strings to filter by.
      responses:
        '200':
          description: Returned view successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  total_rows:
                    type: integer
                  rows:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        key:
                          type: object
                        value:
                          type: object
                        doc:
                          type: object
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        From:
                          type: string
                        Reason:
                          type: string
                required:
                  - total_rows
                  - rows
        '403':
          description: Forbidden
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{keyspace}/_revs_diff':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
    post:
      summary: Compare revisions to what is in the database
      description: >-
        Takes a set of document IDs, each with a set of Revision Tree 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
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                docid:
                  description: >-
                    The document ID with an array of revisions to use for the
                    comparison.
                  type: array
                  items:
                    type: string
      operationId: post_keyspace-_revs_diff
      tags:
        - Document
      responses:
        '200':
          description: Comparisons successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  docid:
                    description: The document ID.
                    type: object
                    properties:
                      missing:
                        description: >-
                          The revisions that are not in the database (and
                          therefore `missing`).
                        type: array
                        items:
                          type: string
                      possible_ancestors:
                        description: >-
                          An array of known revisions that might be the recent
                          ancestors.
                        type: array
                        items:
                          type: string
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{keyspace}/_local/{docid}':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
      - name: docid
        in: path
        description: The name of the local document ID excluding the `_local/` prefix.
        required: true
        schema:
          type: string
    get:
      summary: Get local document
      operationId: get_keyspace-_local-docid
      tags:
        - Document
      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
      responses:
        '200':
          description: Successfully found local document
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    put:
      summary: Upsert a local document
      description: >-
        This request creates or updates a local document. Updating a local
        document requires that the Revision Tree 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
      requestBody:
        description: The body of the document
        content:
          application/json:
            schema:
              type: object
              properties:
                _rev:
                  description: >-
                    Revision to replace. Required if updating existing local
                    document.
                  type: string
                  example: 2-5145e1086bb8d1d71a531e9f6b543c58
      operationId: put_keyspace-_local-docid
      tags:
        - Document
      responses:
        '201':
          description: >-
            Document successfully written. The document ID will be prefixed with
            `_local/`.
          content:
            application/json:
              schema:
                description: Properties returned when a new document revision is created
                type: object
                properties:
                  id:
                    description: The ID of the document.
                    type: string
                  ok:
                    description: Whether the request completed successfully.
                    type: boolean
                  rev:
                    description: The Revision Tree ID of the document.
                    type: string
                  cv:
                    description: The CV of the document.
                    type: string
                required:
                  - id
                  - ok
                  - rev
                title: New-revision
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '409':
          description: A conflict would result from updating this document revision.
    delete:
      summary: Delete a local document
      operationId: delete_keyspace-_local-docid
      tags:
        - Document
      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:
        - name: rev
          in: query
          description: The Revision Tree ID of the revision to delete.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successfully removed the local document.
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '409':
          description: A conflict would result from deleting this document revision.
    head:
      summary: Check if local document exists
      operationId: head_keyspace-_local-docid
      tags:
        - Document
      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
      responses:
        '200':
          description: Document exists
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{keyspace}/{docid}':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
      - name: docid
        in: path
        required: true
        schema:
          type: string
        example: doc1
        description: The document ID to run the operation against.
    get:
      summary: Get a document
      operationId: get_keyspace-docid
      tags:
        - Document
      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:
        - name: rev
          in: query
          required: false
          schema:
            type: string
          example: 2-5145e1086bb8d1d71a531e9f6b543c58
          description: >-
            The document revision to target. This can be a RevTree ID or a CV
            (Current Version) ID. If this is a CV value, ensure the query
            parameter is URL encoded (`+`->`%2B`, `@`->`%40`, etc.)
        - name: open_revs
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          description: >-
            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.
        - name: show_exp
          in: query
          required: false
          schema:
            type: boolean
          description: Whether to show the expiry property (`_exp`) in the response.
        - name: revs_from
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          description: >-
            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`.
        - name: atts_since
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          description: >-
            Include attachments only since specified revisions. Excludes the
            attachments for the specified revisions. Only gets used if
            `attachments=true`.
        - name: revs_limit
          in: query
          required: false
          schema:
            type: integer
          description: Maximum amount of revisions to return for each document.
        - name: attachments
          in: query
          required: false
          schema:
            type: boolean
          description: Include attachment bodies in response.
        - name: replicator2
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            Returns the document with the required properties for replication.
            This is an enterprise-edition only feature.
      responses:
        '200':
          description: Document found and returned successfully
          headers:
            Etag:
              schema:
                type: string
              description: The document revision ID if only returning 1 revision.
          content:
            application/json:
              schema:
                type: object
                properties:
                  _id:
                    description: The ID of the document.
                    type: string
                  _rev:
                    description: The Revision Tree ID of the document.
                    type: string
                additionalProperties: true
              example:
                FailedLoginAttempts: 5
                Friends:
                  - Bob
                _id: AliceSettings
                _rev: 1-64d4a1f179db5c1848fe52967b47c166
                _cv: 1@src
        '400':
          description: >-
            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 ("_").
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '501':
          description: >-
            Not Implemented. It is likely this error was caused due to trying to
            use an enterprise-only feature on the community edition.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
    put:
      summary: Upsert a document
      operationId: put_keyspace-docid
      tags:
        - Document
      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 previous known version must be provided if targeting an
        existing document to prevent conflicts.


        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:
        - name: roundtrip
          in: query
          required: false
          schema:
            type: boolean
          description: Block until document has been received by change cache
        - name: replicator2
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            Returns the document with the required properties for replication.
            This is an enterprise-edition only feature.
        - name: new_edits
          in: query
          required: false
          schema:
            type: boolean
            default: true
          description: >-
            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.
        - name: rev
          in: query
          required: false
          schema:
            type: string
          example: 2-5145e1086bb8d1d71a531e9f6b543c58
          description: >-
            The document revision to target. This can be a RevTree ID or a CV
            (Current Version) ID. If this is a CV value, ensure the query
            parameter is URL encoded (`+`->`%2B`, `@`->`%40`, etc.)
        - name: If-Match
          in: header
          required: false
          schema:
            type: string
          description: >-
            An optimistic concurrency control (OCC) value used to prevent
            conflicts. Use the value returned in the ETag response header of the
            GET request for the resource being updated, or the latest known
            Revision Tree ID or Current Version of the document.
      requestBody:
        content:
          application/json:
            schema:
              description: The configurable Sync Gateway properties of a document.
              type: object
              additionalProperties: true
              properties:
                _id:
                  description: The ID of the document.
                  type: string
                _rev:
                  description: The revision of the document.
                  type: string
                _exp:
                  description: >-
                    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.
                  type: string
                _deleted:
                  description: >-
                    Whether the document is a tombstone or not. If true, it is a
                    tombstone.
                  type: boolean
                _revisions:
                  type: object
                  properties:
                    start:
                      description: Prefix number for the latest revision.
                      type: number
                    ids:
                      description: >-
                        Array of valid Revision Tree IDs, in reverse order
                        (latest first).
                      type: array
                      items:
                        type: string
                _attachments:
                  type: object
                  additionalProperties:
                    x-additionalPropertiesName: attachmentname
                    description: The name of the attachment.
                    type: object
                    properties:
                      content_type:
                        description: Content type of the attachment.
                        type: string
                      data:
                        description: The data in the attachment in base64.
                        type: string
      responses:
        '201':
          description: Created
          headers:
            Etag:
              schema:
                type: string
              description: >-
                The revision of the written document. Not set if query option
                `new_edits` is true.
          content:
            application/json:
              schema:
                description: Properties returned when a new document revision is created
                type: object
                properties:
                  id:
                    description: The ID of the document.
                    type: string
                  ok:
                    description: Whether the request completed successfully.
                    type: boolean
                  rev:
                    description: The Revision Tree ID of the document.
                    type: string
                  cv:
                    description: The CV of the document.
                    type: string
                required:
                  - id
                  - ok
                  - rev
                title: New-revision
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '409':
          description: Resource already exists under that name
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '415':
          description: Invalid content type
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
    delete:
      summary: Delete a document
      operationId: delete_keyspace-docid
      tags:
        - Document
      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:
        - name: rev
          in: query
          required: false
          schema:
            type: string
          example: 2-5145e1086bb8d1d71a531e9f6b543c58
          description: >-
            The document revision to target. This can be a RevTree ID or a CV
            (Current Version) ID. If this is a CV value, ensure the query
            parameter is URL encoded (`+`->`%2B`, `@`->`%40`, etc.)
        - name: If-Match
          in: header
          required: false
          schema:
            type: string
          description: >-
            An optimistic concurrency control (OCC) value used to prevent
            conflicts. Use the value returned in the ETag response header of the
            GET request for the resource being updated, or the latest known
            Revision Tree ID or Current Version of the document.
      responses:
        '200':
          description: New revision created successfully
          content:
            application/json:
              schema:
                description: Properties returned when a new document revision is created
                type: object
                properties:
                  id:
                    description: The ID of the document.
                    type: string
                  ok:
                    description: Whether the request completed successfully.
                    type: boolean
                  rev:
                    description: The Revision Tree ID of the document.
                    type: string
                  cv:
                    description: The CV of the document.
                    type: string
                required:
                  - id
                  - ok
                  - rev
                title: New-revision
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    head:
      summary: Check if a document exists
      operationId: head_keyspace-docid
      tags:
        - Document
      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:
        - name: rev
          in: query
          required: false
          schema:
            type: string
          example: 2-5145e1086bb8d1d71a531e9f6b543c58
          description: >-
            The document revision to target. This can be a RevTree ID or a CV
            (Current Version) ID. If this is a CV value, ensure the query
            parameter is URL encoded (`+`->`%2B`, `@`->`%40`, etc.)
        - name: open_revs
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          description: >-
            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.
        - name: show_exp
          in: query
          required: false
          schema:
            type: boolean
          description: Whether to show the expiry property (`_exp`) in the response.
        - name: revs_from
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          description: >-
            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`.
        - name: atts_since
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          description: >-
            Include attachments only since specified revisions. Excludes the
            attachments for the specified revisions. Only gets used if
            `attachments=true`.
        - name: revs_limit
          in: query
          required: false
          schema:
            type: integer
          description: Maximum amount of revisions to return for each document.
        - name: attachments
          in: query
          required: false
          schema:
            type: boolean
          description: Include attachment bodies in response.
        - name: replicator2
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            Returns the document with the required properties for replication.
            This is an enterprise-edition only feature.
      responses:
        '200':
          description: Document exists
        '400':
          description: >-
            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 ("_").
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{keyspace}/{docid}/{attach}':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
      - name: docid
        in: path
        required: true
        schema:
          type: string
        example: doc1
        description: The document ID to run the operation against.
      - name: attach
        in: path
        description: >-
          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](https://www.urlencoder.org/)).
        required: true
        schema:
          type: string
    get:
      summary: Get an attachment from a document
      operationId: get_keyspace-docid-attach
      tags:
        - Document
      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:
        - name: rev
          in: query
          required: false
          schema:
            type: string
          example: 2-5145e1086bb8d1d71a531e9f6b543c58
          description: >-
            The document revision to target. This can be a RevTree ID or a CV
            (Current Version) ID. If this is a CV value, ensure the query
            parameter is URL encoded (`+`->`%2B`, `@`->`%40`, etc.)
        - name: content_encoding
          in: query
          description: Set to false to disable the `Content-Encoding` response header.
          schema:
            type: boolean
            default: true
        - name: Range
          in: header
          description: RFC-2616 bytes range header.
          schema:
            type: string
          example: bytes=123-456
        - name: meta
          in: query
          description: Return only the metadata of the attachment in the response body.
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Found attachment successfully.
          headers:
            Content-Length:
              schema:
                type: number
              description: Length of the attachment in bytes
            Etag:
              schema:
                type: string
              description: >-
                The attachment digest. Does not get set when request
                `meta=true`. 
        '206':
          description: Partial attachment content returned
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '416':
          description: Requested range exceeds content length
    put:
      summary: Create or update an attachment on a document
      operationId: put_keyspace-docid-attach
      tags:
        - Document
      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:
        - name: Content-Type
          in: header
          description: The content type of the attachment.
          schema:
            type: string
            default: application/octet-stream
        - name: rev
          in: query
          description: >-
            The existing document revision ID to modify. Required only when
            modifying an existing document.
          schema:
            type: string
        - name: If-Match
          in: header
          description: An alternative way of specifying the document revision ID.
          schema:
            type: string
      requestBody:
        description: The attachment data
        content:
          Attachment content type:
            schema:
              description: The content to store in the body
              type: string
      responses:
        '201':
          description: Attachment added to new or existing document successfully
          headers:
            Etag:
              schema:
                type: string
              description: The ID of the new revision.
          content:
            application/json:
              schema:
                description: Properties returned when a new document revision is created
                type: object
                properties:
                  id:
                    description: The ID of the document.
                    type: string
                  ok:
                    description: Whether the request completed successfully.
                    type: boolean
                  rev:
                    description: The Revision Tree ID of the document.
                    type: string
                  cv:
                    description: The CV of the document.
                    type: string
                required:
                  - id
                  - ok
                  - rev
                title: New-revision
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '409':
          description: Resource already exists under that name
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
    head:
      summary: Check if attachment exists
      operationId: head_keyspace-docid-attach
      tags:
        - Document
      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:
        - name: rev
          in: query
          required: false
          schema:
            type: string
          example: 2-5145e1086bb8d1d71a531e9f6b543c58
          description: >-
            The document revision to target. This can be a RevTree ID or a CV
            (Current Version) ID. If this is a CV value, ensure the query
            parameter is URL encoded (`+`->`%2B`, `@`->`%40`, etc.)
      responses:
        '200':
          description: The document exists and the attachment exists on the document.
          headers:
            Content-Length:
              schema:
                description: Length of the attachment in bytes
                type: number
            Etag:
              schema:
                type: string
              description: The attachment digest.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    delete:
      summary: Delete an attachment on a document
      operationId: delete_keyspace-docid-attach
      tags:
        - Document
      description: >-
        This request deletes an attachment associated with the document.


        If the attachment exists, the attachment will be removed from the
        document.
      parameters:
        - name: rev
          in: query
          description: The existing document revision ID to modify.
          schema:
            type: string
        - name: If-Match
          in: header
          description: An alternative way of specifying the document revision ID.
          schema:
            type: string
      responses:
        '200':
          description: Attachment removed from the document successfully
          headers:
            Etag:
              schema:
                type: string
              description: The ID of the new revision.
          content:
            application/json:
              schema:
                description: Properties returned when a new document revision is created
                type: object
                properties:
                  id:
                    description: The ID of the document.
                    type: string
                  ok:
                    description: Whether the request completed successfully.
                    type: boolean
                  rev:
                    description: The Revision Tree ID of the document.
                    type: string
                  cv:
                    description: The CV of the document.
                    type: string
                required:
                  - id
                  - ok
                  - rev
                title: New-revision
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '409':
          description: Resource already exists under that name
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  '/{keyspace}/_all_docs':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
    get:
      summary: Gets all the documents in the database with the given parameters
      operationId: get_keyspace-_all_docs
      tags:
        - Document
      description: >-
        Returns all documents in the database based on the specified parameters.


        This endpoint is not recommended for larger datasets or production
        workloads.

        [GET /{keyspace}/_changes](#operation/get_keyspace-_changes) or [POST
        /{keyspace}/_bulk_get](#operation/post_keyspace-_bulk_get) have more
        efficient implementations and should be used instead.


        Required Sync Gateway RBAC roles:


        * Sync Gateway Application

        * Sync Gateway Application Read Only
      parameters:
        - name: include_docs
          in: query
          required: false
          schema:
            type: boolean
          description: Include the body associated with each document.
        - name: channels
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            Include the channels each document is part of that the calling user
            also has access too.
        - name: access
          in: query
          required: false
          schema:
            type: boolean
          description: Include what user/roles that each document grants access too.
        - name: revs
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            Include all the revisions for each document under the `_revisions`
            property.
        - name: update_seq
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            Include the document sequence number `update_seq` property for each
            document.
        - name: keys
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          description: An array of document ID strings to filter by.
        - name: startkey
          in: query
          required: false
          schema:
            type: string
          description: Return records starting with the specified key.
        - name: endkey
          in: query
          required: false
          schema:
            type: string
          description: Stop returning records when this key is reached.
        - name: limit
          in: query
          required: false
          schema:
            type: number
          description: >-
            This limits the number of result rows returned. Using a value of `0`
            has the same effect as the value `1`.
      responses:
        '200':
          description: Operation ran successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  rows:
                    type: array
                    items:
                      type: object
                      properties:
                        key:
                          type: string
                        id:
                          type: string
                        value:
                          type: object
                          properties:
                            rev:
                              type: string
                            cv:
                              type: string
                    uniqueItems: true
                  total_rows:
                    type: number
                  update_seq:
                    type: number
                required:
                  - rows
                  - total_rows
                  - update_seq
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    post:
      summary: Get all the documents in the database using a built-in view
      operationId: post_keyspace-_all_docs
      tags:
        - Document
      description: >-
        Returns all documents in the database based on the specified parameters.


        This endpoint is not recommended for larger datasets or production
        workloads.

        [GET /{keyspace}/_changes](#operation/get_keyspace-_changes) or [POST
        /{keyspace}/_bulk_get](#operation/post_keyspace-_bulk_get) have more
        efficient implementations and should be used instead.


        Required Sync Gateway RBAC roles:


        * Sync Gateway Application

        * Sync Gateway Application Read Only
      parameters:
        - name: include_docs
          in: query
          required: false
          schema:
            type: boolean
          description: Include the body associated with each document.
        - name: channels
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            Include the channels each document is part of that the calling user
            also has access too.
        - name: access
          in: query
          required: false
          schema:
            type: boolean
          description: Include what user/roles that each document grants access too.
        - name: revs
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            Include all the revisions for each document under the `_revisions`
            property.
        - name: update_seq
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            Include the document sequence number `update_seq` property for each
            document.
        - name: startkey
          in: query
          required: false
          schema:
            type: string
          description: Return records starting with the specified key.
        - name: endkey
          in: query
          required: false
          schema:
            type: string
          description: Stop returning records when this key is reached.
        - name: limit
          in: query
          required: false
          schema:
            type: number
          description: >-
            This limits the number of result rows returned. Using a value of `0`
            has the same effect as the value `1`.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                keys:
                  description: List of the documents to retrieve.
                  type: array
                  items:
                    type: string
              required:
                - keys
      responses:
        '200':
          description: Operation ran successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  rows:
                    type: array
                    items:
                      type: object
                      properties:
                        key:
                          type: string
                        id:
                          type: string
                        value:
                          type: object
                          properties:
                            rev:
                              type: string
                            cv:
                              type: string
                    uniqueItems: true
                  total_rows:
                    type: number
                  update_seq:
                    type: number
                required:
                  - rows
                  - total_rows
                  - update_seq
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{keyspace}/_bulk_docs':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
    post:
      summary: Bulk document operations
      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 Tree ID (`_rev`) as well as the new body values.


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


        Required Sync Gateway RBAC roles:


        * Sync Gateway Application
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                new_edits:
                  description: >-
                    This controls whether to assign new revision identifiers to
                    new edits (`true`) or use the existing ones (`false`).
                  type: boolean
                  default: true
                docs:
                  type: array
                  items:
                    description: The configurable Sync Gateway properties of a document.
                    type: object
                    additionalProperties: true
                    properties:
                      _id:
                        description: The ID of the document.
                        type: string
                      _rev:
                        description: The revision of the document.
                        type: string
                      _exp:
                        description: >-
                          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.
                        type: string
                      _deleted:
                        description: >-
                          Whether the document is a tombstone or not. If true,
                          it is a tombstone.
                        type: boolean
                      _revisions:
                        type: object
                        properties:
                          start:
                            description: Prefix number for the latest revision.
                            type: number
                          ids:
                            description: >-
                              Array of valid Revision Tree IDs, in reverse order
                              (latest first).
                            type: array
                            items:
                              type: string
                      _attachments:
                        type: object
                        additionalProperties:
                          x-additionalPropertiesName: attachmentname
                          description: The name of the attachment.
                          type: object
                          properties:
                            content_type:
                              description: Content type of the attachment.
                              type: string
                            data:
                              description: The data in the attachment in base64.
                              type: string
              required:
                - docs
            example:
              new_edits: true
              docs:
                - _id: FooBar
                  foo: bar
                - _id: AliceSettings
                  _rev: 5-832a6db48ed130adadede928aee54576
                  FailedLoginAttempts: 7
                - _id: BobSettings
                  _rev: 1-fa76ba41ee5fdfee1b91fc478ed09e59
                  _deleted: true
      operationId: post_keyspace-_bulk_docs
      tags:
        - Document
      responses:
        '201':
          description: >-
            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.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      description: >-
                        The ID of the document that the operation was performed
                        on.
                      type: string
                    rev:
                      description: >-
                        The new revision of the document if the operation was a
                        success.
                      type: string
                    error:
                      description: The error type if the operation of the document failed.
                      type: string
                    reason:
                      description: The reason the operation failed.
                      type: string
                    status:
                      description: The HTTP status code for why the operation failed.
                      type: integer
                  required:
                    - id
                uniqueItems: true
              examples:
                Success:
                  value:
                    - id: FooBar
                      rev: 1-cd809becc169215072fd567eebd8b8de
                    - id: AliceSettings
                      rev: 6-b3e8dcf825b71ccee112f3572ec4323c
                    - id: BobSettings
                      rev: 2-5145e1086bb8d1d71a531e9f6b543c58
                PartialSuccess:
                  summary: PartialSuccess
                  value:
                    - error: conflict
                      id: FooBar
                      reason: Document exists
                      status: 409
                    - id: AliceSettings
                      rev: 6-b3e8dcf825b71ccee112f3572ec4323c
                    - error: conflict
                      id: BobSettings
                      reason: Document revision conflict
                      status: 409
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{keyspace}/_bulk_get':
    parameters:
      - name: keyspace
        in: path
        required: true
        schema:
          type: string
        examples:
          default:
            summary: Default scope and collection
            value: db1
            description: Default scope and collection
          namedInDefault:
            summary: Named collection within the default scope
            value: db1.collection1
            description: Named collection within the default scope
          fullyQualified:
            summary: Fully-qualified scope and collection
            value: db1.scope1.collection1
            description: Fully-qualified scope and collection
        description: >-
          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.
    post:
      summary: Get multiple documents in a MIME multipart response
      operationId: post_keyspace-_bulk_get
      tags:
        - Document
      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:
        - name: attachments
          in: query
          description: >-
            This is for whether to include attachments in each of the documents
            returned or not.
          schema:
            type: boolean
            default: false
        - name: revs
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            Include all the revisions for each document under the `_revisions`
            property.
        - name: revs_limit
          in: query
          description: >-
            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.
          schema:
            type: integer
        - name: X-Accept-Part-Encoding
          in: header
          description: >-
            If this header includes `gzip` then the part HTTP compression
            encoding will be done.
          schema:
            type: string
        - name: Accept-Encoding
          in: header
          description: >-
            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.
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                docs:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        description: ID of the document to retrieve.
                        type: string
                    required:
                      - id
              required:
                - docs
            example:
              docs:
                - id: FooBar
                - id: attachment
                - id: AliceSettings
      responses:
        '200':
          description: Returned the requested docs as `multipart/mixed` response type
        '400':
          description: Bad Request
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_oidc':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: OpenID Connect authentication initiation via Location header redirect
      operationId: get_db-_oidc
      tags:
        - Authentication
      description: >-
        Called by clients to initiate the OpenID Connect Authorization Code
        Flow. Redirects to the OpenID Connect provider if successful. 
      parameters:
        - name: provider
          in: query
          required: false
          schema:
            type: string
          description: >-
            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.
        - name: offline
          in: query
          required: false
          schema:
            type: string
          description: >-
            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.
      responses:
        '302':
          description: >-
            Successfully connected with the OpenID Connect provider so now
            redirecting to the requested OIDC provider for authentication.
          headers:
            Location:
              schema:
                type: string
              description: The link to redirect to so the client can authenticate.
        '400':
          description: >-
            The provider provided is not defined in the Sync Gateway config. If
            no provided was specified then there is no default provider set. 
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '500':
          description: >-
            Unable to connect and validate with the OpenID Connect provider
            requested
  '/{db}/_oidc_challenge':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: OpenID Connect authentication initiation via WWW-Authenticate header
      operationId: get_db-_oidc_challenge
      tags:
        - Authentication
      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:
        - name: provider
          in: query
          required: false
          schema:
            type: string
          description: >-
            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.
        - name: offline
          in: query
          required: false
          schema:
            type: string
          description: >-
            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.
      responses:
        '400':
          description: >-
            The provider provided is not defined in the Sync Gateway config. If
            no provided was specified then there is no default provider set. 
        '401':
          description: >-
            Successfully connected with the OpenID Connect provider so now the
            client can login.
          headers:
            WWW-Authenticate:
              schema:
                type: string
              description: The OpenID Connect authentication URL.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '500':
          description: >-
            Unable to connect and validate with the OpenID Connect provider
            requested
  '/{db}/_oidc_callback':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: OpenID Connect authentication callback
      operationId: get_db-_oidc_callback
      tags:
        - Authentication
      description: >-
        The callback URL that the client is redirected to after authenticating
        with the OpenID Connect provider.
      parameters:
        - name: error
          in: query
          description: 'The OpenID Connect error, if any occurred.'
          schema:
            type: string
        - name: code
          in: query
          required: true
          schema:
            type: string
          description: The OpenID Connect authentication code.
        - name: provider
          in: query
          required: false
          schema:
            type: string
          description: >-
            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.
        - name: state
          in: query
          required: false
          schema:
            type: string
          description: >-
            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).
      responses:
        '200':
          description: Successfully authenticated with OpenID Connect.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id_token:
                    description: The OpenID Connect ID token
                    type: string
                  refresh_token:
                    description: The OpenID Connect ID refresh token
                    type: string
                  session_id:
                    description: The Sync Gateway session token
                    type: string
                  name:
                    description: The Sync Gateway user
                    type: string
                  access_token:
                    description: The OpenID Connect access token
                    type: string
                  token_type:
                    description: The OpenID Connect ID token type
                    type: string
                  expires_in:
                    description: The time until the id_token expires (TTL).
                    type: number
                title: OpenID Connect callback properties
        '400':
          description: A problem occurred when reading the callback request body
        '401':
          description: >-
            An error was received from the OpenID Connect provider. This means
            the error query parameter was filled.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '500':
          description: A problem occurred in regards to the token
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  reason:
                    type: string
  '/{db}/_oidc_refresh':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: OpenID Connect token refresh
      operationId: get_db-_oidc_refresh
      tags:
        - Authentication
      description: Refresh the OpenID Connect token based on the provided refresh token.
      parameters:
        - name: refresh_token
          in: query
          description: The OpenID Connect refresh token.
          required: true
          schema:
            type: string
        - name: provider
          in: query
          required: false
          schema:
            type: string
          description: >-
            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.
      responses:
        '200':
          description: Successfully authenticated with OpenID Connect.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id_token:
                    description: The OpenID Connect ID token
                    type: string
                  refresh_token:
                    description: The OpenID Connect ID refresh token
                    type: string
                  session_id:
                    description: The Sync Gateway session token
                    type: string
                  name:
                    description: The Sync Gateway user
                    type: string
                  access_token:
                    description: The OpenID Connect access token
                    type: string
                  token_type:
                    description: The OpenID Connect ID token type
                    type: string
                  expires_in:
                    description: The time until the id_token expires (TTL).
                    type: number
                title: OpenID Connect callback properties
        '400':
          description: >-
            The provider provided is not defined in the Sync Gateway config. If
            no provided was specified then there is no default provider set. 
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '500':
          description: >-
            Unable to connect and validate with the OpenID Connect provider
            requested
  '/{db}/_oidc_testing/.well-known/openid-configuration':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: OpenID Connect mock provider
      operationId: get_db-_oidc_testing-.well-known-openid-configuration
      tags:
        - Unsupported
      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.
      responses:
        '200':
          description: 'Successfully generated OpenID Connect provider mock response. '
          headers:
            Expiry:
              schema:
                type: string
              description: the time until the response expires.
          content:
            application/json:
              schema:
                type: object
                properties:
                  issuer:
                    type: string
                  authorization_endpoint:
                    type: string
                  token_endpoint:
                    type: string
                  jwks_uri:
                    type: string
                  userinfo_endpoint:
                    type: string
                  id_token_signing_alg_values_supported:
                    type: string
                  response_types_supported:
                    type: string
                  subject_types_supported:
                    type: string
                  scopes_supported:
                    type: string
                  claims_supported:
                    type: string
                  token_endpoint_auth_methods_supported:
                    type: string
        '403':
          description: >-
            The OpenID Connect unsupported config option `oidc_test_provider` is
            not enabled. To use this endpoint, this option must be enabled.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_oidc_testing/authorize':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: OpenID Connect mock login page
      operationId: get_db-_oidc_testing-authorize
      tags:
        - Unsupported
      description: Show a mock OpenID Connect login page for the client to log in to.
      parameters:
        - name: scope
          in: query
          required: true
          schema:
            type: string
          description: The OpenID Connect authentication scope.
      responses:
        '200':
          description: OK
        '400':
          description: A validation error occurred with the scope.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '403':
          description: >-
            The OpenID Connect unsupported config option `oidc_test_provider` is
            not enabled. To use this endpoint, this option must be enabled.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '500':
          description: An error occurred.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
    post:
      summary: OpenID Connect mock login page
      operationId: post_db-_oidc_testing-authorize
      tags:
        - Unsupported
      description: Show a mock OpenID Connect login page for the client to log in to.
      parameters:
        - name: scope
          in: query
          required: true
          schema:
            type: string
          description: The OpenID Connect authentication scope.
      responses:
        '200':
          description: OK
        '400':
          description: A validation error occurred with the scope.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
        '403':
          description: >-
            The OpenID Connect unsupported config option `oidc_test_provider` is
            not enabled. To use this endpoint, this option must be enabled.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '500':
          description: An error occurred.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
  '/{db}/_oidc_testing/token':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    post:
      summary: OpenID Connect mock token
      description: Return a mock OpenID Connect token for the OIDC authentication flow.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                grant_type:
                  description: >-
                    The grant type of the token to request. Can either be an
                    `authorization_code` or `refresh_token`.
                  type: string
                code:
                  description: >-
                    **`grant_type=authorization_code` only**: The OpenID Connect
                    authentication token.
                  type: string
                refresh_token:
                  description: >-
                    **`grant_type=refresh_token` only**: The OpenID Connect
                    refresh token.
                  type: string
              required:
                - grant_type
      operationId: post_db-_oidc_testing-token
      tags:
        - Unsupported
      responses:
        '200':
          description: >-
            Properties expected back from an OpenID Connect provider after
            successful authentication
          content:
            application/json:
              schema:
                description: >-
                  Properties expected back from an OpenID Connect provider after
                  successful authentication
                type: object
                properties:
                  access_token:
                    type: string
                  token_type:
                    type: string
                  refresh_token:
                    type: string
                  expires_in:
                    type: string
                  id_token:
                    type: string
                title: OIDC-token
        '400':
          description: Invalid token provided
        '403':
          description: >-
            The OpenID Connect unsupported config option `oidc_test_provider` is
            not enabled. To use this endpoint, this option must be enabled.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_oidc_testing/certs':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: OpenID Connect public certificates for signing keys
      operationId: get_db-_oidc_testing-certs
      tags:
        - Unsupported
      description: Return a mock OpenID Connect public key to be used as signing keys.
      responses:
        '200':
          description: Returned public key successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  keys:
                    type: array
                    items:
                      type: object
                      properties:
                        Key:
                          type: object
                        KeyID:
                          type: string
                        Use:
                          type: string
                        Certificates:
                          type: array
                          items:
                            type: object
                        Algorithm:
                          type: string
                      required:
                        - Key
                        - KeyID
                        - Use
                required:
                  - keys
        '403':
          description: >-
            The OpenID Connect unsupported config option `oidc_test_provider` is
            not enabled. To use this endpoint, this option must be enabled.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '500':
          description: An error occurred while getting the private RSA key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  reason:
                    type: string
  '/{db}/_oidc_testing/authenticate':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: OpenID Connect mock login page handler
      operationId: get_db-_oidc_testing-authenticate
      tags:
        - Unsupported
      description: >-
        Used to handle the login page displayed for the `GET
        /{db}/_oidc_testing/authorize` endpoint.
      parameters:
        - name: redirect_uri
          in: query
          required: false
          schema:
            type: string
          description: The Sync Gateway OpenID Connect callback URL.
        - name: scope
          in: query
          required: true
          schema:
            type: string
          description: The OpenID Connect authentication scope.
        - name: username
          in: query
          required: true
          schema:
            type: string
        - name: tokenttl
          in: query
          required: true
          schema:
            type: integer
        - name: identity-token-formats
          in: query
          required: true
          schema:
            type: string
        - name: authenticated
          in: query
          required: true
          schema:
            type: string
      responses:
        '302':
          description: Redirecting to Sync Gateway OpenID Connect callback URL
          headers:
            Location:
              schema:
                type: string
              description: The location to the Sync Gateway OpenID Connect callback URL.
        '403':
          description: >-
            The OpenID Connect unsupported config option `oidc_test_provider` is
            not enabled. To use this endpoint, this option must be enabled.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
    post:
      summary: OpenID Connect mock login page handler
      operationId: post_db-_oidc_testing-authenticate
      tags:
        - Unsupported
      description: >-
        Used to handle the login page displayed for the `GET
        /{db}/_oidc_testing/authorize` endpoint.
      parameters:
        - name: redirect_uri
          in: query
          required: false
          schema:
            type: string
          description: The Sync Gateway OpenID Connect callback URL.
        - name: scope
          in: query
          required: true
          schema:
            type: string
          description: The OpenID Connect authentication scope.
      requestBody:
        content:
          application/json:
            schema:
              description: >-
                Properties passed from the OpenID Connect mock login page to the
                handler
              type: object
              properties:
                username:
                  type: string
                tokenttl:
                  type: string
                identity-token-formats:
                  type: string
                authenticated:
                  type: string
              required:
                - username
                - tokenttl
                - identity-token-formats
                - authenticated
        description: >-
          Properties passed from the OpenID Connect mock login page to the
          handler
      responses:
        '302':
          description: Redirecting to Sync Gateway OpenID Connect callback URL
          headers:
            Location:
              schema:
                type: string
              description: The location to the Sync Gateway OpenID Connect callback URL.
        '403':
          description: >-
            The OpenID Connect unsupported config option `oidc_test_provider` is
            not enabled. To use this endpoint, this option must be enabled.
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
  '/{db}/_blipsync':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    get:
      summary: Handle incoming BLIP Sync web socket request
      operationId: get_db-_blipsync
      tags:
        - Replication
      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:
        - name: client
          in: query
          description: >-
            This is the client type that is making the BLIP Sync request. Used
            to control client-type specific replication behaviour.
          schema:
            type: string
            default: cbl2
            enum:
              - cbl2
              - sgr2
      responses:
        '101':
          description: Upgraded to a web socket connection
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '426':
          description: Cannot upgrade connection to a web socket connection
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: Upgrade Required
                reason: Can't upgrade this request to websocket connection
  '/{db}/_facebook':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    post:
      summary: Create a new Facebook-based session
      operationId: 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 `Origin` header is passed to this endpoint, the `Origin` header must
        match both the `cors.login_origin` and `cors.origin` configuration
        options.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                access_token:
                  description: Facebook access token to base the new session on.
                  type: string
              required:
                - access_token
      responses:
        '200':
          description: Session created successfully
        '400':
          description: >-
            Value of `Origin` is not in the approved list of allowed origins in
            `LoginOrigin` of Sync Gateway bootstrap or database configuration.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: Bad Request
                reason: No CORS
        '401':
          description: Received error from Facebook verifier
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  reason:
                    type: string
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '502':
          description: Received invalid response from the Facebook verifier
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  reason:
                    type: string
        '504':
          description: Unable to send request to Facebook API
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  reason:
                    type: string
      deprecated: true
      tags:
        - Authentication
  '/{db}/_google':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    post:
      summary: Create a new Google-based session
      operationId: 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 `Origin` header is passed to this endpoint, the `Origin` header must
        match both the `cors.login_origin` and `cors.origin` configuration
        options.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                id_token:
                  description: Google ID token to base the new session on.
                  type: string
              required:
                - id_token
      responses:
        '200':
          description: Session created successfully
        '400':
          description: >-
            Value of `Origin` is not in the approved list of allowed origins in
            `LoginOrigin` of Sync Gateway bootstrap or database configuration.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: Bad Request
                reason: No CORS
        '401':
          description: >-
            Received error from Google token verifier or invalid application ID
            in the config
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  reason:
                    type: string
        '404':
          description: Resource could not be found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
              example:
                error: not_found
                reason: no such database "invalid-db"
        '502':
          description: Received invalid response from the Google token verifier
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  reason:
                    type: string
        '504':
          description: Unable to send request to the Google token verifier
      deprecated: true
      tags:
        - Authentication
  '/{db}/_ensure_full_commit':
    parameters:
      - name: db
        in: path
        required: true
        schema:
          type: string
        example: db1
        description: The name of the database to run the operation against.
    post:
      summary: Ensure Full Commit
      description: >-
        This endpoint is non-functional but is present for CouchDB
        compatibility. This was deprecated in CouchDB 3.0.


        Required Sync Gateway RBAC roles:


        * Sync Gateway Application

        * Sync Gateway Application Read Only
      deprecated: true
      operationId: post_db-_ensure_full_commit
      tags:
        - Database Management
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  instance_start_time:
                    description: >-
                      Timestamp of when the database opened, in microseconds
                      since the Unix epoch.
                    type: integer
                    example: 1644600082279583
                  ok:
                    type: boolean
                    example: true
                    default: true
  /_logging:
    get:
      summary: Get console logging settings
      operationId: 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
      responses:
        '200':
          description: Returned map of console log keys
          content:
            application/json:
              schema:
                description: A map of log keys and whether they are enabled or not.
                type: object
                example:
                  HTTP: true
                  CRUD: false
                  Changes: true
                additionalProperties:
                  description: The log key and whether it is enabled or not.
                  type: boolean
      deprecated: true
      tags:
        - Server
    put:
      summary: Set console logging settings
      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:
        - name: logLevel
          in: query
          required: false
          schema:
            type: string
            enum:
              - none
              - error
              - warn
              - info
              - debug
              - trace
          description: The is what to set the console log level too.
        - name: level
          in: query
          required: false
          schema:
            type: integer
            maximum: 3
            minimum: 1
          deprecated: true
          description: >-
            **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`.'
      requestBody:
        description: The map of log keys to use for console logging.
        content:
          application/json:
            schema:
              description: A map of log keys and whether they are enabled or not.
              type: object
              example:
                HTTP: true
                CRUD: false
                Changes: true
              additionalProperties:
                description: The log key and whether it is enabled or not.
                type: boolean
      responses:
        '200':
          description: Log keys successfully replaced.
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
      deprecated: true
      operationId: put__logging
      tags:
        - Server
    post:
      summary: Update console logging settings
      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:
        - name: logLevel
          in: query
          required: false
          schema:
            type: string
            enum:
              - none
              - error
              - warn
              - info
              - debug
              - trace
          description: The is what to set the console log level too.
        - name: level
          in: query
          required: false
          schema:
            type: integer
            maximum: 3
            minimum: 1
          deprecated: true
          description: >-
            **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`.'
      requestBody:
        description: The console log keys to upsert.
        content:
          application/json:
            schema:
              description: A map of log keys and whether they are enabled or not.
              type: object
              example:
                HTTP: true
                CRUD: false
                Changes: true
              additionalProperties:
                description: The log key and whether it is enabled or not.
                type: boolean
      responses:
        '200':
          description: Log keys successfully updated.
        '400':
          description: There was a problem with your request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    description: The error name.
                    type: string
                  reason:
                    description: The error description.
                    type: string
                required:
                  - error
                  - reason
                title: HTTP-Error
      deprecated: true
      operationId: post__logging
      tags:
        - Server
components:
  parameters:
    db:
      name: db
      in: path
      required: true
      schema:
        type: string
      example: db1
      description: The name of the database to run the operation against.
    sessionid:
      name: sessionid
      in: path
      required: true
      schema:
        type: string
      description: The ID of the session to target.
    keyspace:
      name: keyspace
      in: path
      required: true
      schema:
        type: string
      examples:
        default:
          summary: Default scope and collection
          value: db1
          description: Default scope and collection
        namedInDefault:
          summary: Named collection within the default scope
          value: db1.collection1
          description: Named collection within the default scope
        fullyQualified:
          summary: Fully-qualified scope and collection
          value: db1.scope1.collection1
          description: Fully-qualified scope and collection
      description: >-
        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.
    docid:
      name: docid
      in: path
      required: true
      schema:
        type: string
      example: doc1
      description: The document ID to run the operation against.
    include_doc:
      name: include_doc
      in: query
      required: false
      schema:
        type: string
      description: Include the body associated with the document.
    disable_oidc_validation:
      name: disable_oidc_validation
      in: query
      required: false
      description: >-
        If set, will not attempt to validate the configured OpenID Connect
        providers are reachable.
      schema:
        type: boolean
        default: false
    usersNameOnly:
      name: name_only
      in: query
      required: false
      schema:
        type: boolean
        default: true
      description: >-
        Whether to return user names only, or more detailed information for each
        user.
    usersLimit:
      name: limit
      in: query
      required: false
      schema:
        type: integer
      description: How many results to return. Using a value of `0` results in no limit.
    user-name:
      name: name
      in: path
      required: true
      schema:
        type: string
      description: The name of the user.
    role-name:
      name: name
      in: path
      required: true
      schema:
        type: string
      description: The name of the role.
    replicationid:
      name: replicationid
      in: path
      required: true
      schema:
        type: string
        minimum: 1
        maximum: 160
      description: What replication to target based on its replication ID.
    replication-active-only:
      name: activeOnly
      in: query
      required: false
      schema:
        type: boolean
        default: false
      description: Only return replications that are actively running (`state=running`).
    replication-local-only:
      name: localOnly
      in: query
      required: false
      schema:
        type: boolean
        default: false
      description: >-
        Only return replications that were started on the current Sync Gateway
        node.
    replication-include-error:
      name: includeError
      in: query
      required: false
      schema:
        type: boolean
        default: true
      description: Include replications that have stopped due to an error (`state=error`).
    replication-include-config:
      name: includeConfig
      in: query
      required: false
      schema:
        type: boolean
        default: false
      description: >-
        Include the replication configuration with each replicator status in the
        response.
    deprecated-redact:
      name: redact
      in: query
      deprecated: true
      required: false
      schema:
        type: boolean
        default: true
      description: No longer supported field.
    pprof-seconds:
      name: seconds
      in: query
      description: >-
        If set, collect a delta profile for the given duration, instead of a
        snapshot.
      schema:
        type: integer
    debug-profile-seconds:
      name: seconds
      in: query
      required: false
      schema:
        type: integer
        default: 30
        minimum: 0
      description: The amount of seconds to run the profiler for.
    include_runtime:
      name: include_runtime
      in: query
      required: false
      schema:
        type: boolean
        default: false
      description: 'Whether to include the values set at runtime, and default values.'
    DB-config-If-Match:
      name: If-Match
      in: header
      required: false
      schema:
        type: string
      description: >-
        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.
    Document-If-Match:
      name: If-Match
      in: header
      required: false
      schema:
        type: string
      description: >-
        An optimistic concurrency control (OCC) value used to prevent conflicts.
        Use the value returned in the ETag response header of the GET request
        for the resource being updated, or the latest known Revision Tree ID or
        Current Version of the document.
    view:
      name: view
      in: path
      required: true
      schema:
        type: string
      description: The view to target.
    inclusive_end:
      name: inclusive_end
      in: query
      required: false
      description: >-
        Indicates whether the specified end key should be included in the
        result.
      schema:
        type: boolean
    descending:
      name: descending
      in: query
      required: false
      description: Return documents in descending order.
      schema:
        type: boolean
    include_docs-cbs3:
      name: include_docs
      in: query
      required: false
      description: >-
        Only works when using Couchbase Server 3.0 and earlier. Indicates
        whether to include the full content of the documents in the response.
      schema:
        type: boolean
    reduce:
      name: reduce
      in: query
      required: false
      description: Whether to execute a reduce function on the response or not.
      schema:
        type: boolean
    group:
      name: group
      in: query
      required: false
      description: Group the results using the reduce function to a group or single row.
      schema:
        type: boolean
    skip:
      name: skip
      in: query
      required: false
      description: >-
        Skip the specified number of documents before starting to return
        results.
      schema:
        type: integer
    limit:
      name: limit
      in: query
      required: false
      description: Return only the specified number of documents
      schema:
        type: integer
    group_level:
      name: group_level
      in: query
      required: false
      description: Specify the group level to be used.
      schema:
        type: integer
    startkey_docid:
      name: startkey_docid
      in: query
      required: false
      description: Return documents starting with the specified document identifier.
      schema:
        type: string
    endkey_docid:
      name: endkey_docid
      in: query
      required: false
      description: >-
        Stop returning records when the specified document identifier is
        reached.
      schema:
        type: string
    stale:
      name: stale
      in: query
      required: false
      description: >-
        Allow the results from a stale view to be used, without triggering a
        rebuild of all views within the encompassing design document.
      schema:
        type: string
        enum:
          - ok
          - update_after
    startkey:
      name: startkey
      in: query
      required: false
      schema:
        type: string
      description: Return records starting with the specified key.
    endkey:
      name: endkey
      in: query
      required: false
      schema:
        type: string
      description: Stop returning records when this key is reached.
    key:
      name: key
      in: query
      required: false
      description: Return only the document that matches the specified key.
      schema:
        type: string
    keys:
      name: keys
      in: query
      required: false
      schema:
        type: array
        items:
          type: string
      description: An array of document ID strings to filter by.
    compact-type:
      name: type
      in: query
      required: false
      schema:
        type: string
        default: tombstone
        enum:
          - attachment
          - tombstone
      description: |-
        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.'
    roundtrip:
      name: roundtrip
      in: query
      required: false
      schema:
        type: boolean
      description: Block until document has been received by change cache
    include_docs:
      name: include_docs
      in: query
      required: false
      schema:
        type: boolean
      description: Include the body associated with each document.
    ddoc:
      name: ddoc
      in: path
      required: true
      schema:
        type: string
      description: The design document name.
    rev:
      name: rev
      in: query
      required: false
      schema:
        type: string
      example: 2-5145e1086bb8d1d71a531e9f6b543c58
      description: >-
        The document revision to target. This can be a RevTree ID or a CV
        (Current Version) ID. If this is a CV value, ensure the query parameter
        is URL encoded (`+`->`%2B`, `@`->`%40`, etc.)
    open_revs:
      name: open_revs
      in: query
      required: false
      schema:
        type: array
        items:
          type: string
      description: >-
        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.
    show_exp:
      name: show_exp
      in: query
      required: false
      schema:
        type: boolean
      description: Whether to show the expiry property (`_exp`) in the response.
    revs_from:
      name: revs_from
      in: query
      required: false
      schema:
        type: array
        items:
          type: string
      description: >-
        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`.
    atts_since:
      name: atts_since
      in: query
      required: false
      schema:
        type: array
        items:
          type: string
      description: >-
        Include attachments only since specified revisions. Excludes the
        attachments for the specified revisions. Only gets used if
        `attachments=true`.
    revs_limit:
      name: revs_limit
      in: query
      required: false
      schema:
        type: integer
      description: Maximum amount of revisions to return for each document.
    includeAttachments:
      name: attachments
      in: query
      required: false
      schema:
        type: boolean
      description: Include attachment bodies in response.
    replicator2:
      name: replicator2
      in: query
      required: false
      schema:
        type: boolean
      description: >-
        Returns the document with the required properties for replication. This
        is an enterprise-edition only feature.
    new_edits:
      name: new_edits
      in: query
      required: false
      schema:
        type: boolean
        default: true
      description: >-
        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.
    Include-channels:
      name: channels
      in: query
      required: false
      schema:
        type: boolean
      description: >-
        Include the channels each document is part of that the calling user also
        has access too.
    include-access:
      name: access
      in: query
      required: false
      schema:
        type: boolean
      description: Include what user/roles that each document grants access too.
    include-revs:
      name: revs
      in: query
      required: false
      schema:
        type: boolean
      description: >-
        Include all the revisions for each document under the `_revisions`
        property.
    include-seqs:
      name: update_seq
      in: query
      required: false
      schema:
        type: boolean
      description: >-
        Include the document sequence number `update_seq` property for each
        document.
    limit-result-rows:
      name: limit
      in: query
      required: false
      schema:
        type: number
      description: >-
        This limits the number of result rows returned. Using a value of `0` has
        the same effect as the value `1`.
    provider:
      name: provider
      in: query
      required: false
      schema:
        type: string
      description: >-
        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.
    offline:
      name: offline
      in: query
      required: false
      schema:
        type: string
      description: >-
        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.
    oidc-code:
      name: code
      in: query
      required: true
      schema:
        type: string
      description: The OpenID Connect authentication code.
    oidc-state:
      name: state
      in: query
      required: false
      schema:
        type: string
      description: >-
        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).
    oidc-scope:
      name: scope
      in: query
      required: true
      schema:
        type: string
      description: The OpenID Connect authentication scope.
    oidc-redirect_uri:
      name: redirect_uri
      in: query
      required: false
      schema:
        type: string
      description: The Sync Gateway OpenID Connect callback URL.
    log-level:
      name: logLevel
      in: query
      required: false
      schema:
        type: string
        enum:
          - none
          - error
          - warn
          - info
          - debug
          - trace
      description: The is what to set the console log level too.
    log-level-int:
      name: level
      in: query
      required: false
      schema:
        type: integer
        maximum: 3
        minimum: 1
      deprecated: true
      description: >-
        **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`.'
  schemas:
    User-session-information:
      type: object
      properties:
        authentication_handlers:
          description: >-
            The ways authentication can be established to authenticate as a
            user. Used for CouchDB compatibility. Always contains "default" and
            "cookie".
          type: array
          enum:
            - - default
              - cookie
          default:
            - default
            - cookie
        ok:
          description: Used for CouchDB compatibility. Always true.
          type: boolean
          enum:
            - true
        userCtx:
          type: object
          properties:
            channels:
              description: >-
                A map of the channels in the default collection that the user is
                in along with the sequence number the user was granted access.
                This does not include inherited channels through roles.
              type: object
              additionalProperties:
                x-additionalPropertiesName: channelName
                type: number
                minimum: 1
                description: The sequence number the user was granted access.
                title: sequence number
              example:
                '!': 1
                channelA: 2
            name:
              description: The name of the user.
              type: string
              minLength: 1
          required:
            - channels
            - name
      required:
        - authentication_handlers
        - ok
        - userCtx
      title: User Session Information
    HTTP-Error:
      type: object
      properties:
        error:
          description: The error name.
          type: string
        reason:
          description: The error description.
          type: string
      required:
        - error
        - reason
      title: HTTP-Error
    DatabaseState:
      description: The state of the database.
      type: string
      enum:
        - Online
        - Offline
        - Starting
        - Stopping
        - Resyncing
      x-enumDescriptions:
        Online: The database is online and available for use.
        Offline: >-
          The database is offline, resync and other offline only endpoints are
          allowed.
        Starting: The database is in the process of going online.
        Stopping: >-
          The database is no longer accepting connections and is being taken
          offline or deleted.
        Resyncing: The database is offline and performing a resync operation.
    CORS:
      type: object
      properties:
        headers:
          description: >-
            List of allowed headers. These headers will be added the
            `Access-Control-Allow-Headers` response to a valid CORS request.


            A recommended minimum set of values should be `["Accept-Encoding",
            "Authorization", "Content-Type", "If-Match"]`.
          type: array
          items:
            type: string
          example:
            - Accept-Encoding
            - Authorization
            - Content-Type
            - If-Match
        login_origin:
          description: >-
            List of allowed origins to apply to public `/{db}/_session` API.


            To use cors on `/{db}/_session`, the domain must be present in both
            `login_origin` and `origin`.


            If configured, `Authorization` must be included in headers.
          type: array
          items:
            type: string
          example:
            - 'https://example.com'
        max_age:
          description: Value for `Access-Control-Maximum-Age`. Uses 0 by default.
          type: integer
          default: 0
        origin:
          description: >-
            List of allowed origins for the public API. The request `Origin`
            header is checked against these values. If successful the `Origin`
            header is returned in the HTTP response header as
            `Access-Control-Allow-Origin`.
          type: array
          items:
            type: string
          example:
            - 'https://example.com'
      title: Cors Configuration
    Event-config:
      type: object
      properties:
        handler:
          description: The handler type.
          type: string
          enum:
            - webhook
        url:
          description: The URL of the webhook.
          type: string
        filter:
          description: The Javascript function to use to filter the webhook events.
          type: string
        timeout:
          description: >-
            The amount of time (in seconds) to attempt connect to the webhook
            before giving up.
          type: number
      title: Event-config
    User:
      description: Properties associated with a user
      type: object
      properties:
        name:
          description: >-
            The name of the user.


            User names can only have alphanumeric ASCII characters and
            underscores.
          type: string
        password:
          description: >-
            The password of the user.


            Mandatory. unless `allow_empty_password` is `true` in the database
            configs.
          type: string
        admin_channels:
          description: >-
            A list of channels to explicitly grant to the user for the default
            collection.

            See `collection_access` for channels in named collections.
          type: array
          items:
            type: string
        all_channels:
          description: >-
            All the channels that the user has been granted access to for the
            default collection.

            See `collection_access` for channels in named collections.


            Access could have been granted through the sync function, roles, or
            explicitly on the user under the `admin_channels` property.
          type: array
          items:
            type: string
          readOnly: true
        email:
          description: The email address of the user.
          type: string
        disabled:
          description: >-
            If true, the user will not be able to login to the account as it is
            disabled.
          type: boolean
          default: false
        admin_roles:
          description: A list of roles to explicitly grant to the user.
          type: array
          items:
            type: string
        roles:
          description: >-
            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.
          type: array
          items:
            type: string
          readOnly: true
        jwt_roles:
          description: The roles that the user has been added to through roles_claim.
          type: array
          items:
            type: string
          readOnly: true
        jwt_channels:
          description: >-
            The channels that the user has been granted access to through
            channels_claim for the default collection.
          type: array
          items:
            type: string
          readOnly: true
        jwt_issuer:
          description: >-
            The issuer of the last JSON Web Token that the user last used to
            sign in.
          type: string
          readOnly: true
        jwt_last_updated:
          description: The last time that the user's JWT roles/channels were updated.
          type: string
          format: date-time
          readOnly: true
        collection_access:
          description: >-
            A set of access grants by scope and collection for a specific
            collection.
          type: object
          additionalProperties:
            maxProperties: 1
            description: 'An object keyed by scope, containing a set of collections.'
            type: object
            x-additionalPropertiesName: scopename
            additionalProperties:
              description: >-
                An object keyed by collection name, defines access collections
                in this scope.
              type: object
              x-additionalPropertiesName: collectionname
              properties:
                admin_channels:
                  description: >-
                    A list of channels to explicitly grant to the user in this
                    collection.
                  type: array
                  items:
                    type: string
                all_channels:
                  description: >-
                    All the channels that the user has been granted access to in
                    this collection.


                    Access could have been granted through the sync function,
                    roles, or explicitly on the user under the `admin_channels`
                    property.
                  type: array
                  items:
                    type: string
                  readOnly: true
                jwt_channels:
                  description: >-
                    The channels that the user has been granted access to
                    through channels_claim for this collection.
                  type: array
                  items:
                    type: string
                  readOnly: true
                jwt_last_updated:
                  description: >-
                    The last time that the user's JWT channels were updated for
                    this collection.
                  type: string
                  format: date-time
                  readOnly: true
      title: User
    NumIndexPartitions:
      description: >-
        The number of partitions to use for the large indexes created by Sync
        Gateway. It is not recommended to set this unless you require additional
        horizontal scalability for individual indexes and have appropriately
        scaled your Query nodes to handle the increased query parallelism. If
        set, the recommended number is 8 and does not need to be directly
        related to the number of your Query nodes. Ensure documentation is read
        to understand the performance tradeoffs and instructions for migration
        if you have previously run with only one partition. See
        [/{db}/_index_init](#operation/post_db-_index_init) for more
        information.


        If not specified or 1, all indexes will be non partitioned.
      type: number
      default: 1
      title: Number of Index Partitions
    Replication:
      description: Properties of a replication
      type: object
      x-requirePropertiesSorted: true
      properties:
        adhoc:
          description: >-
            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.
          type: boolean
          default: false
        batch_size:
          description: >-
            The amount of changes to be sent in one batch of replications.
            Changing this is an Enterprise Edition only feature.
          type: integer
          default: 200
        collections_enabled:
          description: >-
            If true, the replicator will run with collections, and will
            replicate all collections, unless otherwise limited by
            `collections_local`.


            If false, the replicator will only replicate the default collection.
          type: boolean
          default: false
        collections_local:
          description: >-
            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.
          type: array
          items:
            type: string
          example:
            - scope1.collection1
            - scope1.collection3
            - scope1.collection6
          default: []
        collections_remote:
          description: >-
            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.
          type: array
          items:
            type: string
            nullable: true
          example:
            - scope1.collectionA
            - null
            - scope1.collectionF
          default: []
        conflict_resolution_type:
          description: >-
            This defines what conflict resolution policy Sync Gateway should use
            to apply when resolving conflicting revisions.


            Changing this is an Enterprise Edition only feature.
          type: string
          default: default
          enum:
            - default
            - remoteWins
            - localWins
            - custom
          x-enumDescriptions:
            default: |-
              This will use:
                - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                - The revision with the most recent timestamp wins.
                - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
            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.
        continuous:
          description: >-
            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.
          type: boolean
          default: false
        custom_conflict_resolver:
          description: >-
            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 document's body. This can be the
            winning revision (for example, `return conflict.LocalDocument`), a
            new body, or `nil` to resolve as a delete.


            Example:


            ```javascript

            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.


            If a document merge is being done, the `_rev` and `_cv` properties
            should not be included in the returned document body as Sync Gateway
            will generate new values for these.


            This is an Enterprise Edition only feature.
          type: string
          default: ''
        direction:
          description: >-
            This specifies which direction the replication will be replicating
            with the `remote` replicator.
          type: string
          enum:
            - push
            - pull
            - pushAndPull
          x-enumDescriptions:
            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
        enable_delta_sync:
          description: >-
            This will turn on delta-sync for the replication. In order to enable
            delta-sync for a replication, the database level setting
            `delta_sync.enabled` must also be set to true.


            Using delta-sync is an Enterprise Edition only feature.
          type: boolean
          default: false
        filter:
          description: This defines whether to filter documents.
          type: string
          enum:
            - sync_gateway/bychannel
            - ''
          x-enumDescriptions:
            '': Do not filter any documents.
            sync_gateway/bychannel: >-
              If set, a pull replication will be limited to a specific set of
              channels specified by the `query_param.channels` property.
        initial_state:
          description: >-
            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`.
          type: string
          default: running
          enum:
            - running
            - stopped
          x-enumDescriptions:
            running: The replication will immediately start running.
            stopped: >-
              The replication configuration will be created but the replication
              will not start running until the user explicitly starts it.
        max_backoff_time:
          description: >-
            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.
          type: integer
          default: 5
        purge_on_removal:
          description: >-
            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.
          type: boolean
          default: false
        query_params:
          description: >-
            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:

            ```json

            "filter":"sync_gateway/bychannel",

            "query_params": {
              "channels":["chanUser1"]
            },

            ```
          type: array
          items:
            type: string
        remote:
          description: >-
            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, `https://localhost:4985/db`.
          type: string
        remote_password:
          description: >-
            The password to use to authenticate with the remote. This password
            will be redacted in the replication config.
          type: string
        remote_username:
          description: The username to use to authenticate with the remote.
          type: string
        replication_id:
          description: >-
            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.
          type: string
          maximum: 160
        run_as:
          description: >-
            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.
          type: string
        password:
          description: >-
            **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.
          type: string
          deprecated: true
        username:
          description: |-
            **This has been deprecated in favour of `remote_username`.**

            This is the username to use to authenticate with the remote.
          type: string
          deprecated: true
      required:
        - direction
      title: User configurable replication properties
    Role:
      description: Properties associated with a role
      type: object
      properties:
        name:
          description: >-
            The name of the role.


            Role names can only have alphanumeric ASCII characters and
            underscores.
          type: string
        admin_channels:
          description: >-
            A list of channels to explicitly grant to the role for the default
            collection.

            See `collection_access` for channels in named collections.
          type: array
          items:
            type: string
        all_channels:
          description: >-
            All the channels that the role has been granted access to for the
            default collection.


            These channels could have been assigned by the Sync function or
            using the `admin_channels` property.
          type: array
          items:
            type: string
          readOnly: true
        collection_access:
          description: >-
            A set of access grants by scope and collection for a specific
            collection.
          type: object
          additionalProperties:
            maxProperties: 1
            description: 'An object keyed by scope, containing a set of collections.'
            type: object
            x-additionalPropertiesName: scopename
            additionalProperties:
              description: >-
                An object keyed by collection name, defines access collections
                in this scope.
              type: object
              x-additionalPropertiesName: collectionname
              properties:
                admin_channels:
                  description: >-
                    A list of channels to explicitly grant to the user in this
                    collection.
                  type: array
                  items:
                    type: string
                all_channels:
                  description: >-
                    All the channels that the user has been granted access to in
                    this collection.


                    Access could have been granted through the sync function,
                    roles, or explicitly on the user under the `admin_channels`
                    property.
                  type: array
                  items:
                    type: string
                  readOnly: true
                jwt_channels:
                  description: >-
                    The channels that the user has been granted access to
                    through channels_claim for this collection.
                  type: array
                  items:
                    type: string
                  readOnly: true
                jwt_last_updated:
                  description: >-
                    The last time that the user's JWT channels were updated for
                    this collection.
                  type: string
                  format: date-time
                  readOnly: true
      title: Role
    CollectionConfig:
      description: Collection-specific configuration.
      type: object
      properties:
        sync:
          description: >-
            The Javascript function that newly created documents in this
            collection are ran through.
          type: string
          example: 'function(doc){channel("collection name");}'
        import_filter:
          description: >-
            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.
          type: string
          example: >-
            function(doc) { if (doc.type != 'mobile') { return false; } return
            true; }
      title: Collection config
    Scopes:
      description: Scope-specific configuration.
      type: object
      properties:
        collections:
          description: >-
            An object keyed by collection name containing config for the
            specific collection.
          type: object
          additionalProperties:
            x-additionalPropertiesName: collectionname
            description: Collection-specific configuration.
            type: object
            properties:
              sync:
                description: >-
                  The Javascript function that newly created documents in this
                  collection are ran through.
                type: string
                example: 'function(doc){channel("collection name");}'
              import_filter:
                description: >-
                  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.
                type: string
                example: >-
                  function(doc) { if (doc.type != 'mobile') { return false; }
                  return true; }
            title: Collection config
      title: Scopes
    Database:
      description: The properties of a database configuration.
      type: object
      x-requirePropertiesSorted: true
      properties:
        allow_empty_password:
          description: >-
            This controls whether users that are created can have an empty
            password or not.
          type: boolean
          default: false
        bucket:
          description: The Couchbase Server backing bucket for the database.
          type: string
          default: The database name
        bucket_op_timeout_ms:
          description: >-
            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`.
          type: number
        cacertpath:
          description: The root CA cert path for X.509 bucket authentication.
          type: string
        cache:
          type: object
          x-requirePropertiesSorted: true
          properties:
            channel_cache:
              description: The channel cache config settings.
              x-requirePropertiesSorted: true
              type: object
              properties:
                compact_high_watermark_pct:
                  description: >-
                    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.
                  type: integer
                  default: 80
                compact_low_watermark_pct:
                  description: >-
                    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.
                  type: integer
                  default: 60
                expiry_seconds:
                  description: >-
                    The amount of time (in seconds) to keep entries in the cache
                    beyond the minimum retained.
                  type: integer
                  default: 60
                max_length:
                  description: >-
                    The maximum number of entries to maintain in the cache per
                    channel.
                  type: integer
                  default: 500
                max_num_pending:
                  description: >-
                    The maximum number of pending sequences before skipping
                    sequences.
                  type: integer
                  default: 10000
                max_number:
                  description: >-
                    The maximum number of channel caches which can exist at any
                    one point.
                  type: integer
                  default: 50000
                max_wait_pending:
                  description: >-
                    The maximum time (in milliseconds) for waiting for a pending
                    sequence before skipping it.
                  type: number
                  default: 5000
                max_wait_skipped:
                  description: >-
                    The maximum amount of time (in milliseconds) to wait for a
                    skipped sequence before abandoning it.
                  type: number
                  default: 3600000
                min_length:
                  description: >-
                    The minimum number of entries to maintain in the cache per
                    channel.
                  type: integer
                  default: 50
                enable_star_channel:
                  description: >-
                    Since Sync Gateway 4.0, this option no longer has an effect,
                    the star channel is always enabled.

                    If this value is set to false, a database can only exist in
                    the offline state until this configuration is modified.
                  type: boolean
                  default: true
                  deprecated: true
                query_limit:
                  description: >-
                    **Deprecated in favour of the database setting
                    `query_pagination_limit`**


                    The limit used for channel queries.
                  type: integer
                  default: 5000
                  deprecated: true
            rev_cache:
              description: The revision cache config settings.
              type: object
              properties:
                max_memory_count_mb:
                  description: >-
                    The maximum amount of memory the revision cache should take
                    up in MB, setting to 0 will disable any eviction based on
                    memory at rev cache.

                    There is a minimum value of 50 (50MB) for this config
                    option.

                    When set this memory limit will work in in hand with
                    revision cache size parameter. So you will potentially get
                    eviction at revision cache both based off memory footprint
                    and number of items in the cache.

                    **This is an Enterprise Edition feature only**
                  type: integer
                  default: 0
                shard_count:
                  description: >-
                    The number of shards the revision cache should be split
                    into.
                  type: integer
                  default: 16
                size:
                  description: >-
                    The maximum number of revisions that can be stored in the
                    revision cache.

                    Note when running with greater than 1 shard count we add 10%
                    capacity overall to avoid early eviction when some shards
                    fill up before others, so

                    you may find that the capacity stat
                    (revision_cache_num_items) will climb to the defined rev
                    cache size + 10%.
                  type: integer
                  default: 5000
            channel_cache_expiry:
              description: >-
                **Deprecated, please use the database setting
                `cache.channel_cache.expiry_seconds` instead**


                The time (seconds) to keep entries in cache beyond the minimum
                retained.
              type: integer
              deprecated: true
            channel_cache_max_length:
              description: >-
                **Deprecated, please use the database setting
                `cache.channel_cache.max_length` instead**


                The maximum number of entries maintained in cache per channel.
              type: number
              deprecated: true
            channel_cache_min_length:
              description: >-
                **Deprecated, please use the database setting
                `cache.channel_cache.min_length` instead**


                The minimum number of entries maintained in cache per channel.
              type: integer
              deprecated: true
            enable_star_channel:
              description: >-
                **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.
              type: boolean
              deprecated: true
            max_num_pending:
              description: >-
                **Deprecated, please use the database setting
                `cache.channel_cache.max_num_pending` instead**


                The max number of pending sequences before skipping.
              type: integer
              deprecated: true
            max_wait_pending:
              description: >-
                **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.
              type: number
              deprecated: true
            max_wait_skipped:
              description: >-
                **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.
              type: number
              deprecated: true
        certpath:
          description: The cert path (public key) for X.509 bucket auth.
          type: string
        changes_request_plus:
          type: boolean
          default: false
          description: >-
            Sets the default value of `request_plus` for one-shot/non-continuous
            changes feeds, which when true, ensures all valid documents written
            prior to the request being issued are included in the response.
            Setting this option at the database level is required to ensure
            Couchbase Lite utilizes this changes feed mode.


            This also sets the default value of query param `request_plus` for
            [GET /{keyspace}/_changes](#operation/get_keyspace-_changes) or
            `request_plus` for [POST
            /{keyspace}/_changes](#operation/post_keyspace-_changes).
        client_partition_window_secs:
          description: >-
            How long (in seconds) clients can remain offline for without losing
            replication metadata.


            Defaults to 30 days (in seconds)
          type: integer
          default: 2592000
        compact_interval_days:
          description: >-
            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.
          type: number
          default: 1
        cors:
          allOf:
            - type: object
              properties:
                headers:
                  description: >-
                    List of allowed headers. These headers will be added the
                    `Access-Control-Allow-Headers` response to a valid CORS
                    request.


                    A recommended minimum set of values should be
                    `["Accept-Encoding", "Authorization", "Content-Type",
                    "If-Match"]`.
                  type: array
                  items:
                    type: string
                  example:
                    - Accept-Encoding
                    - Authorization
                    - Content-Type
                    - If-Match
                login_origin:
                  description: >-
                    List of allowed origins to apply to public `/{db}/_session`
                    API.


                    To use cors on `/{db}/_session`, the domain must be present
                    in both `login_origin` and `origin`.


                    If configured, `Authorization` must be included in headers.
                  type: array
                  items:
                    type: string
                  example:
                    - 'https://example.com'
                max_age:
                  description: Value for `Access-Control-Maximum-Age`. Uses 0 by default.
                  type: integer
                  default: 0
                origin:
                  description: >-
                    List of allowed origins for the public API. The request
                    `Origin` header is checked against these values. If
                    successful the `Origin` header is returned in the HTTP
                    response header as `Access-Control-Allow-Origin`.
                  type: array
                  items:
                    type: string
                  example:
                    - 'https://example.com'
              title: Cors Configuration
            - type: object
              description: >-
                CORS configuration for this database; if present, overrides
                server's config.
        delta_sync:
          description: |-
            Delta sync configuration settings.

            **This is an Enterprise Edition feature only**
          type: object
          properties:
            enabled:
              description: |-
                Whether delta sync is enabled.

                **This is an Enterprise Edition feature only**
              type: boolean
              default: false
            rev_max_age_seconds:
              description: >-
                The number of seconds deltas for old revisions are available
                for.


                This defaults to 24 hours (in seconds).
              type: number
              default: 86400
        disable_password_auth:
          description: >-
            Whether to disable username/password authentication and only allow
            OIDC and guest access.
          type: boolean
          default: false
        disable_public_all_docs:
          description: >-
            This controls whether the [GET
            /{keyspace}/_all_docs](#operation/get_keyspace-_all_docs) REST API
            endpoint is publicly accessible or not.

            Disabling this endpoint is recommended for larger datasets or
            production workloads.

            [GET /{keyspace}/_changes](#operation/get_keyspace-_changes) or
            [POST /{keyspace}/_bulk_get](#operation/post_keyspace-_bulk_get)
            have more efficient implementations and should be used instead.


            If set to `true`, the endpoint will not be publicly accessible, and
            will only be available on the Admin API.

            Setting this to `false`, or leaving it as the default value is
            deprecated, and may default to `true` in a future release.
          type: boolean
          default: false
        event_handlers:
          description: These are the settings for webhooks.
          type: object
          properties:
            db_state_changed:
              type: object
              properties:
                handler:
                  description: The handler type.
                  type: string
                  enum:
                    - webhook
                url:
                  description: The URL of the webhook.
                  type: string
                filter:
                  description: The Javascript function to use to filter the webhook events.
                  type: string
                timeout:
                  description: >-
                    The amount of time (in seconds) to attempt connect to the
                    webhook before giving up.
                  type: number
              title: Event-config
            document_changed:
              allOf:
                - type: object
                  properties:
                    handler:
                      description: The handler type.
                      type: string
                      enum:
                        - webhook
                    url:
                      description: The URL of the webhook.
                      type: string
                    filter:
                      description: >-
                        The Javascript function to use to filter the webhook
                        events.
                      type: string
                    timeout:
                      description: >-
                        The amount of time (in seconds) to attempt connect to
                        the webhook before giving up.
                      type: number
                  title: Event-config
                - type: object
                  properties:
                    options:
                      description: Options for the document changed event.
                      type: object
                      properties:
                        winning_rev_only:
                          description: >-
                            If true, only the winning revision of the document
                            will be sent to the webhook.
                          type: boolean
                          default: false
            max_processes:
              description: >-
                The maximum amount of concurrent event handling independent
                functions that can be running at the same time.
              type: string
            wait_for_process:
              description: >-
                The maximum amount of time (in milliseconds) to wait when the
                even queue is full.
              type: string
        guest:
          description: Properties associated with a user
          type: object
          properties:
            name:
              description: >-
                The name of the user.


                User names can only have alphanumeric ASCII characters and
                underscores.
              type: string
            password:
              description: >-
                The password of the user.


                Mandatory. unless `allow_empty_password` is `true` in the
                database configs.
              type: string
            admin_channels:
              description: >-
                A list of channels to explicitly grant to the user for the
                default collection.

                See `collection_access` for channels in named collections.
              type: array
              items:
                type: string
            all_channels:
              description: >-
                All the channels that the user has been granted access to for
                the default collection.

                See `collection_access` for channels in named collections.


                Access could have been granted through the sync function, roles,
                or explicitly on the user under the `admin_channels` property.
              type: array
              items:
                type: string
              readOnly: true
            email:
              description: The email address of the user.
              type: string
            disabled:
              description: >-
                If true, the user will not be able to login to the account as it
                is disabled.
              type: boolean
              default: false
            admin_roles:
              description: A list of roles to explicitly grant to the user.
              type: array
              items:
                type: string
            roles:
              description: >-
                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.
              type: array
              items:
                type: string
              readOnly: true
            jwt_roles:
              description: The roles that the user has been added to through roles_claim.
              type: array
              items:
                type: string
              readOnly: true
            jwt_channels:
              description: >-
                The channels that the user has been granted access to through
                channels_claim for the default collection.
              type: array
              items:
                type: string
              readOnly: true
            jwt_issuer:
              description: >-
                The issuer of the last JSON Web Token that the user last used to
                sign in.
              type: string
              readOnly: true
            jwt_last_updated:
              description: The last time that the user's JWT roles/channels were updated.
              type: string
              format: date-time
              readOnly: true
            collection_access:
              description: >-
                A set of access grants by scope and collection for a specific
                collection.
              type: object
              additionalProperties:
                maxProperties: 1
                description: 'An object keyed by scope, containing a set of collections.'
                type: object
                x-additionalPropertiesName: scopename
                additionalProperties:
                  description: >-
                    An object keyed by collection name, defines access
                    collections in this scope.
                  type: object
                  x-additionalPropertiesName: collectionname
                  properties:
                    admin_channels:
                      description: >-
                        A list of channels to explicitly grant to the user in
                        this collection.
                      type: array
                      items:
                        type: string
                    all_channels:
                      description: >-
                        All the channels that the user has been granted access
                        to in this collection.


                        Access could have been granted through the sync
                        function, roles, or explicitly on the user under the
                        `admin_channels` property.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    jwt_channels:
                      description: >-
                        The channels that the user has been granted access to
                        through channels_claim for this collection.
                      type: array
                      items:
                        type: string
                      readOnly: true
                    jwt_last_updated:
                      description: >-
                        The last time that the user's JWT channels were updated
                        for this collection.
                      type: string
                      format: date-time
                      readOnly: true
          title: User
        import_backup_old_rev:
          description: >-
            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.
          type: boolean
          default: false
        import_docs:
          description: >-
            If true, documents will be imported in to Sync Gateway from the
            bucket in the background. 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 value requires `enable_shared_bucket_access=true`.


            This can also be set to the string `continuous` which maps to true.
          type: boolean
        import_filter:
          description: >-
            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.
          type: string
          example: >-
            function(doc) { if (doc.type != 'mobile') { return false; } return
            true; }
        import_partitions:
          description: >-
            ** 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.
          type: number
          default: 16
          minimum: 1
          maximum: 1024
        index:
          description: Global Secondary Index Settings
          properties:
            num_partitions:
              description: >-
                The number of partitions to use for the large indexes created by
                Sync Gateway. It is not recommended to set this unless you
                require additional horizontal scalability for individual indexes
                and have appropriately scaled your Query nodes to handle the
                increased query parallelism. If set, the recommended number is 8
                and does not need to be directly related to the number of your
                Query nodes. Ensure documentation is read to understand the
                performance tradeoffs and instructions for migration if you have
                previously run with only one partition. See
                [/{db}/_index_init](#operation/post_db-_index_init) for more
                information.


                If not specified or 1, all indexes will be non partitioned.
              type: number
              default: 1
              title: Number of Index Partitions
            num_replicas:
              description: >-
                This is the number of Global Secondary Indexes (GSI) to use for
                core indexes.
              type: number
              default: 1
        javascript_timeout_secs:
          description: >-
            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.
          type: number
          default: 60
        keypath:
          description: The key path (private key) for X.509 bucket auth
          type: string
        kv_tls_port:
          description: The Memcached TLS port.
          type: integer
          default: 11207
        local_doc_expiry_secs:
          description: The number of seconds before a `_local` document should expire.
          type: integer
          default: 7776000
        local_jwt:
          description: Configuration for Local JWT authentication.
          type: object
          additionalProperties:
            x-additionalPropertiesName: providername
            description: The providers name.
            type: object
            required:
              - issuer
              - client_id
              - algorithms
              - keys
            properties:
              algorithms:
                description: The JWT signing algorithms to accept for authentication.
                type: array
                items:
                  type: string
              channels_claim:
                description: >-
                  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.
                type: string
              client_id:
                description: >-
                  The value to match against the "aud" claim of JWTs. Set to an
                  empty string to disable audience validation.
                type: string
              disable_session:
                description: >-
                  Disable Sync Gateway session creation on successful JWT
                  authentication.
                type: boolean
              issuer:
                description: The value to match against the "iss" claim of JWTs.
                type: string
              keys:
                description: The JSON Web Keys to use to validate JWTs.
                type: array
                items:
                  type: object
                  properties:
                    alg:
                      type: string
                      description: The algorithm intended for use with the key.
                    crv:
                      type: string
                      description: 'For Elliptic Curve keys, the name of the curve to use.'
                      enum:
                        - P-256
                        - P-384
                        - P-521
                    e:
                      type: string
                      description: >-
                        For RSA keys, the exponent of the public key, as a
                        Base64urlUInt-encoded value.
                    kid:
                      type: string
                      description: 'The Key ID, used to identify the key to use.'
                    kty:
                      type: string
                      description: >-
                        The cryptographic algorithm family used with the key,
                        such as "RSA" or "EC"
                      enum:
                        - RSA
                        - EC
                    'n':
                      type: string
                      description: >-
                        For RSA keys, the modulus value of the key, as a
                        Base64urlUInt-encoded value.
                    use:
                      type: string
                      description: >-
                        The intended use of the public key. Only 'sig' is
                        accepted.
                      enum:
                        - sig
                    x:
                      type: string
                      description: >-
                        For Elliptic Curve keys, the X coordinate of the point,
                        as a base64url string.
                    'y':
                      type: string
                      description: >-
                        For Elliptic Curve keys, the Y coordinate of the point,
                        as a base64url string.
              register:
                description: >-
                  If to register a new Sync Gateway user account when a user
                  logs in with a JWT.
                type: boolean
              roles_claim:
                description: >-
                  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.
                type: string
              user_prefix:
                description: >-
                  This is the username prefix for all users created through this
                  provider.
                type: string
              username_claim:
                description: >-
                  Allows a different OpenID Connect field to be specified
                  instead of the Subject (`sub`).


                  The field name to use can be specified here.
                type: string
        logging:
          description: Per-database logging configuration.
          type: object
          properties:
            audit:
              description: Audit logging configuration.
              type: object
              properties:
                disabled_roles:
                  description: >-
                    List of roles for which audit logging is disabled. Either
                    cbs or sgw.
                  type: array
                  items:
                    type: object
                    properties:
                      domain:
                        description: >
                          The domain of the role for which audit logging is
                          disabled.
                        enum:
                          - cbs
                          - sgw
                        x-enumDescription:
                          cbs: Couchbase Server RBAC
                          sgw: Sync Gateway Role
                        type: string
                      name:
                        description: >-
                          The name of the role for which audit logging is
                          disabled.
                        type: string
                disabled_users:
                  description: List of users for which audit logging is disabled.
                  type: array
                  items:
                    type: object
                    properties:
                      domain:
                        description: >
                          The domain of the user for which audit logging is
                          disabled.
                        type: string
                        enum:
                          - cbs
                          - sgw
                        x-enumDescription:
                          cbs: Couchbase Server User
                          sgw: Sync Gateway User
                      name:
                        description: >-
                          The name of the user for which audit logging is
                          disabled.
                        type: string
                enabled:
                  description: Whether audit logging is enabled.
                  type: boolean
                  default: false
                enabled_events:
                  description: List of enabled audit events for this database.
                  type: array
                  items:
                    type: number
                    example:
                      - 1234
                      - 5678
            console:
              description: Console logging configuration.
              type: object
              properties:
                log_keys:
                  description: Log Keys for the console output
                  type: array
                  items:
                    type: string
                  example:
                    - CRUD
                    - HTTP
                    - Query
                log_level:
                  description: Log Level for the console output
                  type: string
                  enum:
                    - none
                    - error
                    - warn
                    - info
                    - debug
                    - trace
                  example: debug
        max_concurrent_query_ops:
          description: >-
            The maximum amount of query operations that can be running at any
            one point.
          type: integer
          default: 1000
        name:
          description: The name of the database.
          type: string
        offline:
          description: Start the database in an offline state.
          type: boolean
          default: false
        oidc:
          description: Configuration for OpenID Connect authentication.
          type: object
          properties:
            default_provider:
              description: >-
                The default provider to use when the provider is not specified
                in the client.
              type: string
            providers:
              description: List of OpenID Connect issuers.
              type: object
              additionalProperties:
                x-additionalPropertiesName: providername
                description: The providers name.
                type: object
                properties:
                  InsecureSkipVerify:
                    description: >-
                      Determines whether the TLS certificate verification should
                      be disabled for this provider. 
                    type: boolean
                    default: false
                  IsDefault:
                    description: Indicates if this is the default OpenID Connect provider.
                    type: boolean
                  Name:
                    description: The name of the OpenID Connect Provider.
                    type: string
                  allow_unsigned_provider_tokens:
                    description: Allows users accept unsigned tokens from providers.
                    type: boolean
                  callback_url:
                    description: >-
                      The URL that the OpenID Connect will redirect to after
                      authentication.


                      If not provided, a callback URL will be generated.
                    type: string
                  channels_claim:
                    description: >-
                      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.
                    type: string
                  client_id:
                    description: The OpenID Connect provider client ID.
                    type: string
                  disable_callback_state:
                    description: >-
                      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).**
                    type: boolean
                    default: false
                  disable_cfg_validation:
                    description: >-
                      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.
                    type: boolean
                    default: false
                  disable_session:
                    description: >-
                      Disable Sync Gateway session creation on successful OpenID
                      Connect authentication.
                    type: boolean
                  discovery_url:
                    description: The non-standard discovery endpoint.
                    type: string
                  include_access:
                    description: >-
                      This is whether the `_oidc_callback` response should
                      include the OpenID Connect access token and associated
                      fields (such as `token_type`, and `expires_in`).
                    type: boolean
                  issuer:
                    description: The URL for the OpenID Connect issuer.
                    type: string
                  register:
                    description: >-
                      If to register a new Sync Gateway user account when a user
                      logs in with OpenID Connect.
                    type: boolean
                  roles_claim:
                    description: >-
                      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.
                    type: string
                  scope:
                    description: The scope sent for the OpenID Connect request.
                    type: array
                    items:
                      type: string
                  user_prefix:
                    description: >-
                      This is the username prefix for all users created through
                      this provider.
                    type: string
                  username_claim:
                    description: >-
                      Allows a different OpenID Connect field to be specified
                      instead of the Subject (`sub`).


                      The field name to use can be specified here.
                    type: string
                  validation_key:
                    description: The OpenID Connect provider client secret.
                    type: string
        old_rev_expiry_seconds:
          description: >-
            The number of seconds before old revisions are removed from the
            Couchbase Server bucket.
          type: number
          default: 300
        password:
          description: The password for authenticating to the server.
          type: string
        query_pagination_limit:
          description: The query limit to be used during pagination of large queries.
          type: integer
          default: 5000
        replications:
          type: object
          properties:
            replication_id:
              description: Properties of a replication
              type: object
              x-requirePropertiesSorted: true
              properties:
                adhoc:
                  description: >-
                    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.
                  type: boolean
                  default: false
                batch_size:
                  description: >-
                    The amount of changes to be sent in one batch of
                    replications. Changing this is an Enterprise Edition only
                    feature.
                  type: integer
                  default: 200
                collections_enabled:
                  description: >-
                    If true, the replicator will run with collections, and will
                    replicate all collections, unless otherwise limited by
                    `collections_local`.


                    If false, the replicator will only replicate the default
                    collection.
                  type: boolean
                  default: false
                collections_local:
                  description: >-
                    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.
                  type: array
                  items:
                    type: string
                  example:
                    - scope1.collection1
                    - scope1.collection3
                    - scope1.collection6
                  default: []
                collections_remote:
                  description: >-
                    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.
                  type: array
                  items:
                    type: string
                    nullable: true
                  example:
                    - scope1.collectionA
                    - null
                    - scope1.collectionF
                  default: []
                conflict_resolution_type:
                  description: >-
                    This defines what conflict resolution policy Sync Gateway
                    should use to apply when resolving conflicting revisions.


                    Changing this is an Enterprise Edition only feature.
                  type: string
                  default: default
                  enum:
                    - default
                    - remoteWins
                    - localWins
                    - custom
                  x-enumDescriptions:
                    default: |-
                      This will use:
                        - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                        - The revision with the most recent timestamp wins.
                        - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                    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.
                continuous:
                  description: >-
                    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.
                  type: boolean
                  default: false
                custom_conflict_resolver:
                  description: >-
                    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 document's body. This can
                    be the winning revision (for example, `return
                    conflict.LocalDocument`), a new body, or `nil` to resolve as
                    a delete.


                    Example:


                    ```javascript

                    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.


                    If a document merge is being done, the `_rev` and `_cv`
                    properties should not be included in the returned document
                    body as Sync Gateway will generate new values for these.


                    This is an Enterprise Edition only feature.
                  type: string
                  default: ''
                direction:
                  description: >-
                    This specifies which direction the replication will be
                    replicating with the `remote` replicator.
                  type: string
                  enum:
                    - push
                    - pull
                    - pushAndPull
                  x-enumDescriptions:
                    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
                enable_delta_sync:
                  description: >-
                    This will turn on delta-sync for the replication. In order
                    to enable delta-sync for a replication, the database level
                    setting `delta_sync.enabled` must also be set to true.


                    Using delta-sync is an Enterprise Edition only feature.
                  type: boolean
                  default: false
                filter:
                  description: This defines whether to filter documents.
                  type: string
                  enum:
                    - sync_gateway/bychannel
                    - ''
                  x-enumDescriptions:
                    '': Do not filter any documents.
                    sync_gateway/bychannel: >-
                      If set, a pull replication will be limited to a specific
                      set of channels specified by the `query_param.channels`
                      property.
                initial_state:
                  description: >-
                    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`.
                  type: string
                  default: running
                  enum:
                    - running
                    - stopped
                  x-enumDescriptions:
                    running: The replication will immediately start running.
                    stopped: >-
                      The replication configuration will be created but the
                      replication will not start running until the user
                      explicitly starts it.
                max_backoff_time:
                  description: >-
                    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.
                  type: integer
                  default: 5
                purge_on_removal:
                  description: >-
                    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.
                  type: boolean
                  default: false
                query_params:
                  description: >-
                    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:

                    ```json

                    "filter":"sync_gateway/bychannel",

                    "query_params": {
                      "channels":["chanUser1"]
                    },

                    ```
                  type: array
                  items:
                    type: string
                remote:
                  description: >-
                    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, `https://localhost:4985/db`.
                  type: string
                remote_password:
                  description: >-
                    The password to use to authenticate with the remote. This
                    password will be redacted in the replication config.
                  type: string
                remote_username:
                  description: The username to use to authenticate with the remote.
                  type: string
                replication_id:
                  description: >-
                    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.
                  type: string
                  maximum: 160
                run_as:
                  description: >-
                    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.
                  type: string
                password:
                  description: >-
                    **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.
                  type: string
                  deprecated: true
                username:
                  description: |-
                    **This has been deprecated in favour of `remote_username`.**

                    This is the username to use to authenticate with the remote.
                  type: string
                  deprecated: true
              required:
                - direction
              title: User configurable replication properties
        revs_limit:
          description: The maximum depth a document's revision tree can grow to.
          type: number
          default: 50
          minimum: 0
        roles:
          additionalProperties:
            x-additionalPropertiesName: rolename
            description: Properties associated with a role
            type: object
            properties:
              name:
                description: >-
                  The name of the role.


                  Role names can only have alphanumeric ASCII characters and
                  underscores.
                type: string
              admin_channels:
                description: >-
                  A list of channels to explicitly grant to the role for the
                  default collection.

                  See `collection_access` for channels in named collections.
                type: array
                items:
                  type: string
              all_channels:
                description: >-
                  All the channels that the role has been granted access to for
                  the default collection.


                  These channels could have been assigned by the Sync function
                  or using the `admin_channels` property.
                type: array
                items:
                  type: string
                readOnly: true
              collection_access:
                description: >-
                  A set of access grants by scope and collection for a specific
                  collection.
                type: object
                additionalProperties:
                  maxProperties: 1
                  description: 'An object keyed by scope, containing a set of collections.'
                  type: object
                  x-additionalPropertiesName: scopename
                  additionalProperties:
                    description: >-
                      An object keyed by collection name, defines access
                      collections in this scope.
                    type: object
                    x-additionalPropertiesName: collectionname
                    properties:
                      admin_channels:
                        description: >-
                          A list of channels to explicitly grant to the user in
                          this collection.
                        type: array
                        items:
                          type: string
                      all_channels:
                        description: >-
                          All the channels that the user has been granted access
                          to in this collection.


                          Access could have been granted through the sync
                          function, roles, or explicitly on the user under the
                          `admin_channels` property.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_channels:
                        description: >-
                          The channels that the user has been granted access to
                          through channels_claim for this collection.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_last_updated:
                        description: >-
                          The last time that the user's JWT channels were
                          updated for this collection.
                        type: string
                        format: date-time
                        readOnly: true
            title: Role
        scopes:
          description: >-
            An object keyed by scope name containing config for the specific
            collection.
          type: object
          additionalProperties:
            x-additionalPropertiesName: scopename
            description: Scope-specific configuration.
            type: object
            properties:
              collections:
                description: >-
                  An object keyed by collection name containing config for the
                  specific collection.
                type: object
                additionalProperties:
                  x-additionalPropertiesName: collectionname
                  description: Collection-specific configuration.
                  type: object
                  properties:
                    sync:
                      description: >-
                        The Javascript function that newly created documents in
                        this collection are ran through.
                      type: string
                      example: 'function(doc){channel("collection name");}'
                    import_filter:
                      description: >-
                        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.
                      type: string
                      example: >-
                        function(doc) { if (doc.type != 'mobile') { return
                        false; } return true; }
                  title: Collection config
            title: Scopes
          maxProperties: 1
          example:
            scopename:
              collections:
                collectionname1:
                  sync: 'function(doc){channel("collection name");}'
                  import_filter: >-
                    function(doc) { if (doc.type != 'mobile') { return false; }
                    return true; }
                collectionname2:
                  sync: 'function(doc){channel("collection name");}'
                  import_filter: >-
                    function(doc) { if (doc.type != 'mobile') { return false; }
                    return true; }
        send_www_authenticate_header:
          description: >-
            Controls whether to send a `WWW-Authenticate` header in `401
            Unauthorized` HTTP responses.
          type: boolean
          default: true
        serve_insecure_attachment_types:
          description: >
            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.
          type: boolean
          default: false
        server:
          description: >-
            This is the Couchbase Server address or addresses that the database
            connect to. 
          type: string
        session_cookie_http_only:
          description: >-
            Make all session cookies for the database set the `HttpOnly` flag so
            they are inaccessible to JavaScript.
          type: boolean
          default: false
        session_cookie_name:
          description: >-
            This can be used to define a custom per-database session cookie
            name.
          type: string
        session_cookie_secure:
          description: >-
            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`.
          type: boolean
        sgreplicate_enabled:
          description: >-
            Whether the node should accept assign replications (`true`) or not
            (`false`).
          type: boolean
          default: true
        sgreplicate_websocket_heartbeat_secs:
          description: >-
            Use a custom heartbeat interval (in seconds) for websocket ping
            frames.
          type: integer
          default: 300
        slow_query_warning_threshold:
          description: >-
            The amount of milliseconds a N1QL query should run before logging a
            warning. 
          type: number
          default: 500
        store_legacy_revtree_data:
          description: >-
            Controls whether Sync Gateway stores additional legacy revision tree
            pointer data to support 3.x/early 4.x clients that still use RevTree
            IDs (for example when used as delta sources).


            Disable this when you are confident all clients use newer CV-based
            revisions and no longer require legacy RevTree ID lookups.
          type: boolean
          default: true
        suspendable:
          description: >-
            Set to true to allow the database to be suspended.


            Defaults to true when running in serverless mode otherwise defaults
            to false.
          type: boolean
          default: false
        sync:
          description: >-
            The Javascript function that newly created documents are ran through
            for the default scope and collection.


            If `scopes` parameter is set, this is ignored.
          type: string
          default: 'function(doc){channel(doc.channels);}'
        unsupported:
          description: >-
            These are unsupported options and therefore it is not recommended to
            use them.
          type: object
          properties:
            api_endpoints:
              type: object
              properties:
                enable_couchbase_bucket_flush:
                  description: |-
                    **Setting for test purposes only**

                    Whether Couchbase buckets can be flushed via Admin REST API.
                  type: boolean
            dcp_read_buffer:
              description: Set the dcp feed to use a different read buffer size.
              type: number
            force_api_forbidden_errors:
              description: Force REST API errors to return forbidden
              type: boolean
            guest_read_only:
              description: Restrict GUEST document access to read-only.
              type: boolean
            kv_buffer:
              description: Set the kv pool to use a different buffer size.
              type: number
            oidc_test_provider:
              type: object
              properties:
                enabled:
                  description: >-
                    Whether the `oidc_test_provider` endpoints should be exposed
                    on the public API.
                  type: boolean
            oidc_tls_skip_verify:
              description: Enable self-signed certificates for OIDC testing.
              type: boolean
            remote_config_tls_skip_verify:
              description: Enable self-signed certificates for external JavaScript load.
              type: boolean
            same_site_cookie:
              description: >-
                Override the session cookie SameSite behavior. By default, a
                session cookie will have SameSite:None if CORS is enabled, and
                will have no SameSite attribute if CORS is not enabled.  Setting
                this property to`Default` will omit the SameSite attribute from
                the cookie.
              type: string
              enum:
                - Default
                - Lax
                - None
                - Strict
            sgr_tls_skip_verify:
              description: Enable self-signed certificates for SG-replicate testing.
              type: boolean
            user_views:
              type: object
              properties:
                enabled:
                  description: >-
                    Whether pass-through view query is supported through public
                    API.
                  type: boolean
            warning_thresholds:
              type: object
              properties:
                access_and_role_grants_per_doc:
                  description: >-
                    The number of access and role grants per document to be used
                    as a threshold for grant count warnings.
                  type: number
                channel_name_size:
                  description: >-
                    The number of channel name characters to be used as a
                    threshold for channel name warnings.
                  type: number
                channels_per_doc:
                  description: >-
                    The number of channels per document to be used as a
                    threshold for the channel count warnings.
                  type: number
                channels_per_user:
                  description: >-
                    The number of channels per user to be used as a threshold
                    for channel count warnings.
                  type: number
                xattr_size_bytes:
                  description: >-
                    The number of bytes to be used as a threshold for xattr size
                    limit warnings.
                  type: number
        use_views:
          description: Force the use of views instead of GSI.
          type: boolean
          default: false
        user_xattr_key:
          description: >-
            The key to use for the user xattr that will be accessible from the
            sync function. If empty, the feature will be disabled.


            This is an Enterprise Edition feature only.
          type: string
          maximum: 15
        username:
          description: The username for authenticating to the server.
          type: string
        users:
          additionalProperties:
            x-additionalPropertiesName: username
            description: Properties associated with a user
            type: object
            properties:
              name:
                description: >-
                  The name of the user.


                  User names can only have alphanumeric ASCII characters and
                  underscores.
                type: string
              password:
                description: >-
                  The password of the user.


                  Mandatory. unless `allow_empty_password` is `true` in the
                  database configs.
                type: string
              admin_channels:
                description: >-
                  A list of channels to explicitly grant to the user for the
                  default collection.

                  See `collection_access` for channels in named collections.
                type: array
                items:
                  type: string
              all_channels:
                description: >-
                  All the channels that the user has been granted access to for
                  the default collection.

                  See `collection_access` for channels in named collections.


                  Access could have been granted through the sync function,
                  roles, or explicitly on the user under the `admin_channels`
                  property.
                type: array
                items:
                  type: string
                readOnly: true
              email:
                description: The email address of the user.
                type: string
              disabled:
                description: >-
                  If true, the user will not be able to login to the account as
                  it is disabled.
                type: boolean
                default: false
              admin_roles:
                description: A list of roles to explicitly grant to the user.
                type: array
                items:
                  type: string
              roles:
                description: >-
                  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.
                type: array
                items:
                  type: string
                readOnly: true
              jwt_roles:
                description: The roles that the user has been added to through roles_claim.
                type: array
                items:
                  type: string
                readOnly: true
              jwt_channels:
                description: >-
                  The channels that the user has been granted access to through
                  channels_claim for the default collection.
                type: array
                items:
                  type: string
                readOnly: true
              jwt_issuer:
                description: >-
                  The issuer of the last JSON Web Token that the user last used
                  to sign in.
                type: string
                readOnly: true
              jwt_last_updated:
                description: The last time that the user's JWT roles/channels were updated.
                type: string
                format: date-time
                readOnly: true
              collection_access:
                description: >-
                  A set of access grants by scope and collection for a specific
                  collection.
                type: object
                additionalProperties:
                  maxProperties: 1
                  description: 'An object keyed by scope, containing a set of collections.'
                  type: object
                  x-additionalPropertiesName: scopename
                  additionalProperties:
                    description: >-
                      An object keyed by collection name, defines access
                      collections in this scope.
                    type: object
                    x-additionalPropertiesName: collectionname
                    properties:
                      admin_channels:
                        description: >-
                          A list of channels to explicitly grant to the user in
                          this collection.
                        type: array
                        items:
                          type: string
                      all_channels:
                        description: >-
                          All the channels that the user has been granted access
                          to in this collection.


                          Access could have been granted through the sync
                          function, roles, or explicitly on the user under the
                          `admin_channels` property.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_channels:
                        description: >-
                          The channels that the user has been granted access to
                          through channels_claim for this collection.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_last_updated:
                        description: >-
                          The last time that the user's JWT channels were
                          updated for this collection.
                        type: string
                        format: date-time
                        readOnly: true
            title: User
        view_query_timeout_secs:
          description: The number of seconds before a view query should timeout.
          type: integer
          default: 75
        allow_conflicts:
          description: >-
            Since Sync Gateway 4.0, this option has no effect.

            If this option is set to true on an existing database, the database
            must be modified to remove this parameter in order allow the
            database to come online. Otherwise, the database will be in the
            offline state.
          type: boolean
          default: false
          deprecated: true
        enable_shared_bucket_access:
          description: >-
            Since Sync Gateway 4.0, this option has no effect.

            If this option is set to true on an existing database, the database
            must be modified to remove this parameter in order allow the
            database to come online. Otherwise, the database will be in the
            offline state.
          type: boolean
          default: true
          deprecated: true
        feed_type:
          description: >-
            The type of feed to use to communicate with Couchbase Server. This
            will use DCP regardless of specification.
          type: string
          default: DCP
          enum:
            - DCP
          deprecated: true
        num_index_replicas:
          description: >-
            **Deprecated, please use the database setting `index.num_replicas`
            instead**
          deprecated: true
          type: number
          default: 1
        pool:
          description: This field is unsupported and ignored.
          type: string
          default: default
          deprecated: true
        rev_cache_size:
          description: >-
            **Deprecated, please use the database setting `cache.rev_cache.size`
            instead**


            The maximum number of revisions to store in the revision cache.
          type: number
          deprecated: true
      title: Database-config
    All DBs:
      title: Simple
      description: The names of all databases.
      type: array
      items:
        type: string
      example:
        - db1
        - db2
    All DBs Verbose:
      title: Verbose
      description: Description of all databases.
      type: array
      example:
        - db_name: db1
          bucket: bucket1
          state: Online
          require_resync: false
          init_in_progress: false
        - db_name: db2
          bucket: bucket2
          state: Starting
          require_resync: true
          init_in_progress: true
      items:
        type: object
        properties:
          db_name:
            type: string
            description: The name of the database.
          bucket:
            type: string
            description: The Couchbase Server backing bucket for the database.
          state:
            allOf:
              - description: The state of the database.
                type: string
                enum:
                  - Online
                  - Offline
                  - Starting
                  - Stopping
                  - Resyncing
                x-enumDescriptions:
                  Online: The database is online and available for use.
                  Offline: >-
                    The database is offline, resync and other offline only
                    endpoints are allowed.
                  Starting: The database is in the process of going online.
                  Stopping: >-
                    The database is no longer accepting connections and is being
                    taken offline or deleted.
                  Resyncing: The database is offline and performing a resync operation.
          require_resync:
            description: >-
              Indicates whether the database requires resync before it can be
              brought online.
            type: boolean
            example: true
          init_in_progress:
            description: Indicates whether database initialization is in progress.
            type: boolean
            example: true
    ISGRReplicationState:
      description: >-
        This is the state that the replicator is in or that trying to transition
        in to.
      type: string
      enum:
        - running
        - stopped
        - resetting
        - error
        - starting
        - reconnecting
      x-enumDescriptions:
        running: Currently running replication.
        stopped: Not running replication.
        resetting: The replication is resetting its state.
        error: The replication is stopped due to an error.
        starting: The replication is starting up.
        reconnecting: The replication is reconnecting to the remote database.
      title: Replication Status
    Retrieved-replication:
      description: Properties of a replication
      allOf:
        - type: object
          properties:
            replication_id:
              description: This is the ID of the replication.
              type: string
        - description: Properties of a replication
          type: object
          x-requirePropertiesSorted: true
          properties:
            adhoc:
              description: >-
                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.
              type: boolean
              default: false
            batch_size:
              description: >-
                The amount of changes to be sent in one batch of replications.
                Changing this is an Enterprise Edition only feature.
              type: integer
              default: 200
            collections_enabled:
              description: >-
                If true, the replicator will run with collections, and will
                replicate all collections, unless otherwise limited by
                `collections_local`.


                If false, the replicator will only replicate the default
                collection.
              type: boolean
              default: false
            collections_local:
              description: >-
                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.
              type: array
              items:
                type: string
              example:
                - scope1.collection1
                - scope1.collection3
                - scope1.collection6
              default: []
            collections_remote:
              description: >-
                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.
              type: array
              items:
                type: string
                nullable: true
              example:
                - scope1.collectionA
                - null
                - scope1.collectionF
              default: []
            conflict_resolution_type:
              description: >-
                This defines what conflict resolution policy Sync Gateway should
                use to apply when resolving conflicting revisions.


                Changing this is an Enterprise Edition only feature.
              type: string
              default: default
              enum:
                - default
                - remoteWins
                - localWins
                - custom
              x-enumDescriptions:
                default: |-
                  This will use:
                    - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                    - The revision with the most recent timestamp wins.
                    - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                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.
            continuous:
              description: >-
                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.
              type: boolean
              default: false
            custom_conflict_resolver:
              description: >-
                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 document's body. This can be
                the winning revision (for example, `return
                conflict.LocalDocument`), a new body, or `nil` to resolve as a
                delete.


                Example:


                ```javascript

                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.


                If a document merge is being done, the `_rev` and `_cv`
                properties should not be included in the returned document body
                as Sync Gateway will generate new values for these.


                This is an Enterprise Edition only feature.
              type: string
              default: ''
            direction:
              description: >-
                This specifies which direction the replication will be
                replicating with the `remote` replicator.
              type: string
              enum:
                - push
                - pull
                - pushAndPull
              x-enumDescriptions:
                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
            enable_delta_sync:
              description: >-
                This will turn on delta-sync for the replication. In order to
                enable delta-sync for a replication, the database level setting
                `delta_sync.enabled` must also be set to true.


                Using delta-sync is an Enterprise Edition only feature.
              type: boolean
              default: false
            filter:
              description: This defines whether to filter documents.
              type: string
              enum:
                - sync_gateway/bychannel
                - ''
              x-enumDescriptions:
                '': Do not filter any documents.
                sync_gateway/bychannel: >-
                  If set, a pull replication will be limited to a specific set
                  of channels specified by the `query_param.channels` property.
            initial_state:
              description: >-
                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`.
              type: string
              default: running
              enum:
                - running
                - stopped
              x-enumDescriptions:
                running: The replication will immediately start running.
                stopped: >-
                  The replication configuration will be created but the
                  replication will not start running until the user explicitly
                  starts it.
            max_backoff_time:
              description: >-
                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.
              type: integer
              default: 5
            purge_on_removal:
              description: >-
                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.
              type: boolean
              default: false
            query_params:
              description: >-
                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:

                ```json

                "filter":"sync_gateway/bychannel",

                "query_params": {
                  "channels":["chanUser1"]
                },

                ```
              type: array
              items:
                type: string
            remote:
              description: >-
                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, `https://localhost:4985/db`.
              type: string
            remote_password:
              description: >-
                The password to use to authenticate with the remote. This
                password will be redacted in the replication config.
              type: string
            remote_username:
              description: The username to use to authenticate with the remote.
              type: string
            replication_id:
              description: >-
                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.
              type: string
              maximum: 160
            run_as:
              description: >-
                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.
              type: string
            password:
              description: >-
                **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.
              type: string
              deprecated: true
            username:
              description: |-
                **This has been deprecated in favour of `remote_username`.**

                This is the username to use to authenticate with the remote.
              type: string
              deprecated: true
          required:
            - direction
          title: User configurable replication properties
        - type: object
          properties:
            assigned_node:
              description: The unique ID of the node assigned to the replication.
              type: string
            target_state:
              description: >-
                This is the state that the replicator is in or that trying to
                transition in to.
              type: string
              enum:
                - running
                - stopped
                - resetting
                - error
                - starting
                - reconnecting
              x-enumDescriptions:
                running: Currently running replication.
                stopped: Not running replication.
                resetting: The replication is resetting its state.
                error: The replication is stopped due to an error.
                starting: The replication is starting up.
                reconnecting: The replication is reconnecting to the remote database.
              title: Replication Status
            cluster_uuid:
              description: The cluster unique identifier.
              type: string
      title: Replication
    All-replications:
      description: >-
        Contains all the replication IDs with their corresponding replication
        configurations
      type: object
      properties:
        replication_id:
          description: Properties of a replication
          allOf:
            - type: object
              properties:
                replication_id:
                  description: This is the ID of the replication.
                  type: string
            - description: Properties of a replication
              type: object
              x-requirePropertiesSorted: true
              properties:
                adhoc:
                  description: >-
                    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.
                  type: boolean
                  default: false
                batch_size:
                  description: >-
                    The amount of changes to be sent in one batch of
                    replications. Changing this is an Enterprise Edition only
                    feature.
                  type: integer
                  default: 200
                collections_enabled:
                  description: >-
                    If true, the replicator will run with collections, and will
                    replicate all collections, unless otherwise limited by
                    `collections_local`.


                    If false, the replicator will only replicate the default
                    collection.
                  type: boolean
                  default: false
                collections_local:
                  description: >-
                    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.
                  type: array
                  items:
                    type: string
                  example:
                    - scope1.collection1
                    - scope1.collection3
                    - scope1.collection6
                  default: []
                collections_remote:
                  description: >-
                    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.
                  type: array
                  items:
                    type: string
                    nullable: true
                  example:
                    - scope1.collectionA
                    - null
                    - scope1.collectionF
                  default: []
                conflict_resolution_type:
                  description: >-
                    This defines what conflict resolution policy Sync Gateway
                    should use to apply when resolving conflicting revisions.


                    Changing this is an Enterprise Edition only feature.
                  type: string
                  default: default
                  enum:
                    - default
                    - remoteWins
                    - localWins
                    - custom
                  x-enumDescriptions:
                    default: |-
                      This will use:
                        - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                        - The revision with the most recent timestamp wins.
                        - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                    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.
                continuous:
                  description: >-
                    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.
                  type: boolean
                  default: false
                custom_conflict_resolver:
                  description: >-
                    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 document's body. This can
                    be the winning revision (for example, `return
                    conflict.LocalDocument`), a new body, or `nil` to resolve as
                    a delete.


                    Example:


                    ```javascript

                    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.


                    If a document merge is being done, the `_rev` and `_cv`
                    properties should not be included in the returned document
                    body as Sync Gateway will generate new values for these.


                    This is an Enterprise Edition only feature.
                  type: string
                  default: ''
                direction:
                  description: >-
                    This specifies which direction the replication will be
                    replicating with the `remote` replicator.
                  type: string
                  enum:
                    - push
                    - pull
                    - pushAndPull
                  x-enumDescriptions:
                    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
                enable_delta_sync:
                  description: >-
                    This will turn on delta-sync for the replication. In order
                    to enable delta-sync for a replication, the database level
                    setting `delta_sync.enabled` must also be set to true.


                    Using delta-sync is an Enterprise Edition only feature.
                  type: boolean
                  default: false
                filter:
                  description: This defines whether to filter documents.
                  type: string
                  enum:
                    - sync_gateway/bychannel
                    - ''
                  x-enumDescriptions:
                    '': Do not filter any documents.
                    sync_gateway/bychannel: >-
                      If set, a pull replication will be limited to a specific
                      set of channels specified by the `query_param.channels`
                      property.
                initial_state:
                  description: >-
                    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`.
                  type: string
                  default: running
                  enum:
                    - running
                    - stopped
                  x-enumDescriptions:
                    running: The replication will immediately start running.
                    stopped: >-
                      The replication configuration will be created but the
                      replication will not start running until the user
                      explicitly starts it.
                max_backoff_time:
                  description: >-
                    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.
                  type: integer
                  default: 5
                purge_on_removal:
                  description: >-
                    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.
                  type: boolean
                  default: false
                query_params:
                  description: >-
                    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:

                    ```json

                    "filter":"sync_gateway/bychannel",

                    "query_params": {
                      "channels":["chanUser1"]
                    },

                    ```
                  type: array
                  items:
                    type: string
                remote:
                  description: >-
                    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, `https://localhost:4985/db`.
                  type: string
                remote_password:
                  description: >-
                    The password to use to authenticate with the remote. This
                    password will be redacted in the replication config.
                  type: string
                remote_username:
                  description: The username to use to authenticate with the remote.
                  type: string
                replication_id:
                  description: >-
                    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.
                  type: string
                  maximum: 160
                run_as:
                  description: >-
                    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.
                  type: string
                password:
                  description: >-
                    **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.
                  type: string
                  deprecated: true
                username:
                  description: |-
                    **This has been deprecated in favour of `remote_username`.**

                    This is the username to use to authenticate with the remote.
                  type: string
                  deprecated: true
              required:
                - direction
              title: User configurable replication properties
            - type: object
              properties:
                assigned_node:
                  description: The unique ID of the node assigned to the replication.
                  type: string
                target_state:
                  description: >-
                    This is the state that the replicator is in or that trying
                    to transition in to.
                  type: string
                  enum:
                    - running
                    - stopped
                    - resetting
                    - error
                    - starting
                    - reconnecting
                  x-enumDescriptions:
                    running: Currently running replication.
                    stopped: Not running replication.
                    resetting: The replication is resetting its state.
                    error: The replication is stopped due to an error.
                    starting: The replication is starting up.
                    reconnecting: The replication is reconnecting to the remote database.
                  title: Replication Status
                cluster_uuid:
                  description: The cluster unique identifier.
                  type: string
          title: Replication
      title: All replications
    Replication-status:
      type: object
      properties:
        replication_id:
          description: The ID of the replication.
          type: string
        config:
          description: Properties of a replication
          type: object
          x-requirePropertiesSorted: true
          properties:
            adhoc:
              description: >-
                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.
              type: boolean
              default: false
            batch_size:
              description: >-
                The amount of changes to be sent in one batch of replications.
                Changing this is an Enterprise Edition only feature.
              type: integer
              default: 200
            collections_enabled:
              description: >-
                If true, the replicator will run with collections, and will
                replicate all collections, unless otherwise limited by
                `collections_local`.


                If false, the replicator will only replicate the default
                collection.
              type: boolean
              default: false
            collections_local:
              description: >-
                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.
              type: array
              items:
                type: string
              example:
                - scope1.collection1
                - scope1.collection3
                - scope1.collection6
              default: []
            collections_remote:
              description: >-
                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.
              type: array
              items:
                type: string
                nullable: true
              example:
                - scope1.collectionA
                - null
                - scope1.collectionF
              default: []
            conflict_resolution_type:
              description: >-
                This defines what conflict resolution policy Sync Gateway should
                use to apply when resolving conflicting revisions.


                Changing this is an Enterprise Edition only feature.
              type: string
              default: default
              enum:
                - default
                - remoteWins
                - localWins
                - custom
              x-enumDescriptions:
                default: |-
                  This will use:
                    - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                    - The revision with the most recent timestamp wins.
                    - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                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.
            continuous:
              description: >-
                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.
              type: boolean
              default: false
            custom_conflict_resolver:
              description: >-
                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 document's body. This can be
                the winning revision (for example, `return
                conflict.LocalDocument`), a new body, or `nil` to resolve as a
                delete.


                Example:


                ```javascript

                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.


                If a document merge is being done, the `_rev` and `_cv`
                properties should not be included in the returned document body
                as Sync Gateway will generate new values for these.


                This is an Enterprise Edition only feature.
              type: string
              default: ''
            direction:
              description: >-
                This specifies which direction the replication will be
                replicating with the `remote` replicator.
              type: string
              enum:
                - push
                - pull
                - pushAndPull
              x-enumDescriptions:
                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
            enable_delta_sync:
              description: >-
                This will turn on delta-sync for the replication. In order to
                enable delta-sync for a replication, the database level setting
                `delta_sync.enabled` must also be set to true.


                Using delta-sync is an Enterprise Edition only feature.
              type: boolean
              default: false
            filter:
              description: This defines whether to filter documents.
              type: string
              enum:
                - sync_gateway/bychannel
                - ''
              x-enumDescriptions:
                '': Do not filter any documents.
                sync_gateway/bychannel: >-
                  If set, a pull replication will be limited to a specific set
                  of channels specified by the `query_param.channels` property.
            initial_state:
              description: >-
                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`.
              type: string
              default: running
              enum:
                - running
                - stopped
              x-enumDescriptions:
                running: The replication will immediately start running.
                stopped: >-
                  The replication configuration will be created but the
                  replication will not start running until the user explicitly
                  starts it.
            max_backoff_time:
              description: >-
                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.
              type: integer
              default: 5
            purge_on_removal:
              description: >-
                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.
              type: boolean
              default: false
            query_params:
              description: >-
                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:

                ```json

                "filter":"sync_gateway/bychannel",

                "query_params": {
                  "channels":["chanUser1"]
                },

                ```
              type: array
              items:
                type: string
            remote:
              description: >-
                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, `https://localhost:4985/db`.
              type: string
            remote_password:
              description: >-
                The password to use to authenticate with the remote. This
                password will be redacted in the replication config.
              type: string
            remote_username:
              description: The username to use to authenticate with the remote.
              type: string
            replication_id:
              description: >-
                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.
              type: string
              maximum: 160
            run_as:
              description: >-
                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.
              type: string
            password:
              description: >-
                **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.
              type: string
              deprecated: true
            username:
              description: |-
                **This has been deprecated in favour of `remote_username`.**

                This is the username to use to authenticate with the remote.
              type: string
              deprecated: true
          required:
            - direction
          title: User configurable replication properties
        status:
          description: >-
            This is the state that the replicator is in or that trying to
            transition in to.
          type: string
          enum:
            - running
            - stopped
            - resetting
            - error
            - starting
            - reconnecting
          x-enumDescriptions:
            running: Currently running replication.
            stopped: Not running replication.
            resetting: The replication is resetting its state.
            error: The replication is stopped due to an error.
            starting: The replication is starting up.
            reconnecting: The replication is reconnecting to the remote database.
          title: Replication Status
        error_message:
          description: The error message of the replication if an error has occurred.
          type: string
        docs_read:
          description: >-
            The number of documents that have been read (fetched) from the
            source database.
          type: integer
        docs_checked_pull:
          type: integer
        docs_purged:
          description: The number of documents that have been purged.
          type: integer
        rejected_by_local:
          description: >-
            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.
          type: integer
        last_seq_pull:
          description: The last changes sequence number that was pulled from the remote.
          type: string
        deltas_recv:
          description: The number of deltas that have been received from the remote.
          type: integer
        deltas_requested:
          type: integer
        docs_written:
          description: >-
            The number of documents that have been wrote (pushed) to the target
            database.
          type: integer
        docs_checked_push:
          type: integer
        doc_write_failures:
          description: >-
            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.
          type: integer
        doc_write_conflicts:
          description: The number of documents that had a conflict.
          type: integer
        rejected_by_remote:
          description: >-
            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.
          type: integer
        last_seq_push:
          description: The last changes sequence number that was pushed to the remote.
          type: string
        deltas_sent:
          description: 'The number of deltas that have been sent to the remote. '
          type: integer
      required:
        - replication_id
      title: Replication-status
    CredentialsConfig:
      description: The configuration for the credentials set.
      type: object
      properties:
        username:
          description: Username for authenticating to the bucket
          type: string
        password:
          description: >-
            Password for authenticating to the bucket. This value is always
            redacted.
          type: string
        x509_cert_path:
          description: Cert path (public key) for X.509 bucket auth
          type: string
        x509_key_path:
          description: Key path (private key) for X.509 bucket auth
          type: string
      title: Credentials config
    Console-logging-keys-level:
      type: object
      properties:
        log_level:
          description: Log Level for the console output
          type: string
          default: info
          enum:
            - none
            - error
            - warn
            - info
            - debug
            - trace
        log_keys:
          description: Log Keys for the console output
          type: array
          items:
            type: string
            enum:
              - '*'
              - Admin
              - Access
              - Auth
              - Bucket
              - Cache
              - Changes
              - SGCluster
              - Config
              - CRUD
              - DCP
              - Diagnostic
              - Events
              - gocb
              - HTTP
              - HTTP+
              - Import
              - Javascript
              - Migrate
              - Query
              - Replicate
              - Sync
              - SyncMsg
              - WS
              - WSFrame
            x-enumDescriptions:
              '*': 'This wildcard log key, enables all log keys.'
              Access: Anytime an access() call is made in the sync function.
              Admin: Admin processes in Sync Gateway.
              Auth: Authentication.
              Bucket: Sync Gateway interactions with the bucket.
              CRUD: CRUD operations.
              Cache: Interactions with Sync Gateway’s in-memory channel cache.
              Changes: >-
                Processing of /{keyspace}/_changes requests and pull
                replications
              Config: Server or database configuration.
              DCP: Updates made by Sync Gateway to documents.
              Diagnostic: Operations used by dry run endpoints.
              Events: Event processing (webhooks).
              HTTP: All requests made to the Sync Gateway REST APIs.
              HTTP+: >-
                Additional information about HTTP requests (response times,
                status codes).
              Import: >-
                This log key can be useful to troubleshoot why a given document
                was not successfully imported.
              Javascript: >-
                All logging from Javascript. This includes: sync function,
                import filters, webhook filter function, and custom inter-Sync
                Gateway replication conflict resolvers.
              Migrate: >-
                Logs messages that show when old inline document metadata is
                upgraded to xattrs.
              Query: Query is used for Sync Gateway code related to N1QL queries
              Replicate: >-
                Log messages related to Inter-Sync Gateway replications. This is
                not used for replications initiated by Couchbase Lite.
              SGCluster: >-
                Log messages related to coordination of Sync Gateways for
                sharded import and Inter-Sync Gateway Replication.
              Sync: >-
                Activity which relates to synchronization between Couchbase Lite
                and Sync Gateway
              SyncMsg: Additional logging on top of `Sync` key.
              WS: Websocket replication log messages.
              WSFrame: Additional logging on top of `WS` key.
              gocb: All logging emitted by the gocb SDK
            example:
              - CRUD
              - HTTP
              - Query
    Console-logging-config:
      title: Configuration for console logging.
      allOf:
        - type: object
          properties:
            log_level:
              description: Log Level for the console output
              type: string
              default: info
              enum:
                - none
                - error
                - warn
                - info
                - debug
                - trace
            log_keys:
              description: Log Keys for the console output
              type: array
              items:
                type: string
                enum:
                  - '*'
                  - Admin
                  - Access
                  - Auth
                  - Bucket
                  - Cache
                  - Changes
                  - SGCluster
                  - Config
                  - CRUD
                  - DCP
                  - Diagnostic
                  - Events
                  - gocb
                  - HTTP
                  - HTTP+
                  - Import
                  - Javascript
                  - Migrate
                  - Query
                  - Replicate
                  - Sync
                  - SyncMsg
                  - WS
                  - WSFrame
                x-enumDescriptions:
                  '*': 'This wildcard log key, enables all log keys.'
                  Access: Anytime an access() call is made in the sync function.
                  Admin: Admin processes in Sync Gateway.
                  Auth: Authentication.
                  Bucket: Sync Gateway interactions with the bucket.
                  CRUD: CRUD operations.
                  Cache: Interactions with Sync Gateway’s in-memory channel cache.
                  Changes: >-
                    Processing of /{keyspace}/_changes requests and pull
                    replications
                  Config: Server or database configuration.
                  DCP: Updates made by Sync Gateway to documents.
                  Diagnostic: Operations used by dry run endpoints.
                  Events: Event processing (webhooks).
                  HTTP: All requests made to the Sync Gateway REST APIs.
                  HTTP+: >-
                    Additional information about HTTP requests (response times,
                    status codes).
                  Import: >-
                    This log key can be useful to troubleshoot why a given
                    document was not successfully imported.
                  Javascript: >-
                    All logging from Javascript. This includes: sync function,
                    import filters, webhook filter function, and custom
                    inter-Sync Gateway replication conflict resolvers.
                  Migrate: >-
                    Logs messages that show when old inline document metadata is
                    upgraded to xattrs.
                  Query: Query is used for Sync Gateway code related to N1QL queries
                  Replicate: >-
                    Log messages related to Inter-Sync Gateway replications.
                    This is not used for replications initiated by Couchbase
                    Lite.
                  SGCluster: >-
                    Log messages related to coordination of Sync Gateways for
                    sharded import and Inter-Sync Gateway Replication.
                  Sync: >-
                    Activity which relates to synchronization between Couchbase
                    Lite and Sync Gateway
                  SyncMsg: Additional logging on top of `Sync` key.
                  WS: Websocket replication log messages.
                  WSFrame: Additional logging on top of `WS` key.
                  gocb: All logging emitted by the gocb SDK
                example:
                  - CRUD
                  - HTTP
                  - Query
        - type: object
          properties:
            color_enabled:
              description: Log with color for the console output
              type: boolean
              default: false
              readOnly: true
            file_output:
              description: >-
                Override the default stderr output, and write to the file
                specified instead
              type: string
              readOnly: true
            enabled:
              description: Toggle for this log output
              type: boolean
              default: false
              readOnly: true
            rotation:
              type: object
              readOnly: true
              title: Log-rotation-config
              properties:
                max_size:
                  description: >-
                    The maximum size in MB of the log file before it gets
                    rotated.
                  type: integer
                  default: 100
                localtime:
                  description: >-
                    If true, it uses the computer's local time to format the
                    backup timestamp.
                  type: boolean
                  default: false
                rotated_logs_size_limit:
                  description: Max Size (in mb) of log files before deletion
                  type: integer
                  default: 1024
                rotation_interval:
                  description: >-
                    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`.
                  type: string
                  default: ''
                max_age:
                  description: >-
                    The maximum number of days to retain old log files. By
                    default, there is no rotation, max_age=0.
                  default: 0
                  type: integer
            collation_buffer_size:
              description: >-
                The size of the log collation buffer. The default is 10 if the
                output is stderr, or 1000 if to a file.
              type: integer
              default: 10
              readOnly: true
    Audit-logging-config:
      type: object
      title: Audit logging config
      properties:
        enabled:
          description: Toggle for this log output
          type: boolean
          default: false
        rotation:
          type: object
          readOnly: true
          properties:
            max_size:
              description: The maximum size in MB of the log file before it gets rotated.
              type: integer
              default: 100
            localtime:
              description: >-
                If true, it uses the computer's local time to format the backup
                timestamp.
              type: boolean
              default: false
            rotated_logs_size_limit:
              description: Max Size (in mb) of log files before deletion
              type: integer
              default: 1024
            rotation_interval:
              description: >-
                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`.
              type: string
              default: ''
            max_age:
              description: The maximum number of days to retain old log files.
              default: 6
              type: integer
        audit_log_file_path:
          description: The path to write audit log files to
          type: string
          readOnly: true
        enabled_events:
          description: List of enabled global audit events.
          type: array
          items:
            type: number
          example:
            - 1234
            - 5678
          readOnly: true
    Logging-config:
      type: object
      properties:
        log_file_path:
          description: >-
            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.
          type: string
          readOnly: true
        redaction_level:
          description: Redaction level to apply to log output.
          type: string
          default: partial
          enum:
            - none
            - partial
            - full
            - unset
          readOnly: true
        console:
          allOf:
            - title: Configuration for console logging.
              allOf:
                - type: object
                  properties:
                    log_level:
                      description: Log Level for the console output
                      type: string
                      default: info
                      enum:
                        - none
                        - error
                        - warn
                        - info
                        - debug
                        - trace
                    log_keys:
                      description: Log Keys for the console output
                      type: array
                      items:
                        type: string
                        enum:
                          - '*'
                          - Admin
                          - Access
                          - Auth
                          - Bucket
                          - Cache
                          - Changes
                          - SGCluster
                          - Config
                          - CRUD
                          - DCP
                          - Diagnostic
                          - Events
                          - gocb
                          - HTTP
                          - HTTP+
                          - Import
                          - Javascript
                          - Migrate
                          - Query
                          - Replicate
                          - Sync
                          - SyncMsg
                          - WS
                          - WSFrame
                        x-enumDescriptions:
                          '*': 'This wildcard log key, enables all log keys.'
                          Access: >-
                            Anytime an access() call is made in the sync
                            function.
                          Admin: Admin processes in Sync Gateway.
                          Auth: Authentication.
                          Bucket: Sync Gateway interactions with the bucket.
                          CRUD: CRUD operations.
                          Cache: >-
                            Interactions with Sync Gateway’s in-memory channel
                            cache.
                          Changes: >-
                            Processing of /{keyspace}/_changes requests and pull
                            replications
                          Config: Server or database configuration.
                          DCP: Updates made by Sync Gateway to documents.
                          Diagnostic: Operations used by dry run endpoints.
                          Events: Event processing (webhooks).
                          HTTP: All requests made to the Sync Gateway REST APIs.
                          HTTP+: >-
                            Additional information about HTTP requests (response
                            times, status codes).
                          Import: >-
                            This log key can be useful to troubleshoot why a
                            given document was not successfully imported.
                          Javascript: >-
                            All logging from Javascript. This includes: sync
                            function, import filters, webhook filter function,
                            and custom inter-Sync Gateway replication conflict
                            resolvers.
                          Migrate: >-
                            Logs messages that show when old inline document
                            metadata is upgraded to xattrs.
                          Query: >-
                            Query is used for Sync Gateway code related to N1QL
                            queries
                          Replicate: >-
                            Log messages related to Inter-Sync Gateway
                            replications. This is not used for replications
                            initiated by Couchbase Lite.
                          SGCluster: >-
                            Log messages related to coordination of Sync
                            Gateways for sharded import and Inter-Sync Gateway
                            Replication.
                          Sync: >-
                            Activity which relates to synchronization between
                            Couchbase Lite and Sync Gateway
                          SyncMsg: Additional logging on top of `Sync` key.
                          WS: Websocket replication log messages.
                          WSFrame: Additional logging on top of `WS` key.
                          gocb: All logging emitted by the gocb SDK
                        example:
                          - CRUD
                          - HTTP
                          - Query
                - type: object
                  properties:
                    color_enabled:
                      description: Log with color for the console output
                      type: boolean
                      default: false
                      readOnly: true
                    file_output:
                      description: >-
                        Override the default stderr output, and write to the
                        file specified instead
                      type: string
                      readOnly: true
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: false
                      readOnly: true
                    rotation:
                      type: object
                      readOnly: true
                      title: Log-rotation-config
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: >-
                            The maximum number of days to retain old log files.
                            By default, there is no rotation, max_age=0.
                          default: 0
                          type: integer
                    collation_buffer_size:
                      description: >-
                        The size of the log collation buffer. The default is 10
                        if the output is stderr, or 1000 if to a file.
                      type: integer
                      default: 10
                      readOnly: true
        error:
          type: object
          description: Error logging configuration.
          properties:
            enabled:
              description: Toggle for this log output
              type: boolean
              default: true
            rotation:
              type: object
              readOnly: true
              properties:
                max_size:
                  description: >-
                    The maximum size in MB of the log file before it gets
                    rotated.
                  type: integer
                  default: 100
                localtime:
                  description: >-
                    If true, it uses the computer's local time to format the
                    backup timestamp.
                  type: boolean
                  default: false
                rotated_logs_size_limit:
                  description: Max Size (in mb) of log files before deletion
                  type: integer
                  default: 1024
                rotation_interval:
                  description: >-
                    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`.
                  type: string
                  default: ''
                max_age:
                  description: The maximum number of days to retain old log files.
                  default: 360
                  type: integer
            collation_buffer_size:
              description: The size of the log collation buffer.
              default: 0
              type: integer
              readOnly: true
        warn:
          type: object
          description: Warning logging configuration.
          properties:
            enabled:
              description: Toggle for this log output
              type: boolean
              default: true
            rotation:
              type: object
              readOnly: true
              properties:
                max_size:
                  description: >-
                    The maximum size in MB of the log file before it gets
                    rotated.
                  type: integer
                  default: 100
                localtime:
                  description: >-
                    If true, it uses the computer's local time to format the
                    backup timestamp.
                  type: boolean
                  default: false
                rotated_logs_size_limit:
                  description: Max Size (in mb) of log files before deletion
                  type: integer
                  default: 1024
                rotation_interval:
                  description: >-
                    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`.
                  type: string
                  default: ''
                max_age:
                  description: The maximum number of days to retain old log files.
                  default: 180
                  type: integer
            collation_buffer_size:
              description: The size of the log collation buffer
              default: 0
              type: integer
              readOnly: true
        info:
          type: object
          description: Info logging configuration.
          properties:
            enabled:
              description: Toggle for this log output
              type: boolean
              default: true
            rotation:
              type: object
              readOnly: true
              properties:
                max_size:
                  description: >-
                    The maximum size in MB of the log file before it gets
                    rotated.
                  type: integer
                  default: 100
                localtime:
                  description: >-
                    If true, it uses the computer's local time to format the
                    backup timestamp.
                  type: boolean
                  default: false
                rotated_logs_size_limit:
                  description: Max Size (in mb) of log files before deletion
                  type: integer
                  default: 1024
                rotation_interval:
                  description: >-
                    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`.
                  type: string
                  default: ''
                max_age:
                  description: The maximum number of days to retain old log files.
                  default: 6
                  type: integer
            collation_buffer_size:
              description: The size of the log collation buffer
              default: 0
              type: integer
              readOnly: true
        debug:
          type: object
          description: Debug logging configuration.
          properties:
            enabled:
              description: Toggle for this log output
              type: boolean
              default: false
            rotation:
              type: object
              readOnly: true
              properties:
                max_size:
                  description: >-
                    The maximum size in MB of the log file before it gets
                    rotated.
                  type: integer
                  default: 100
                localtime:
                  description: >-
                    If true, it uses the computer's local time to format the
                    backup timestamp.
                  type: boolean
                  default: false
                rotated_logs_size_limit:
                  description: Max Size (in mb) of log files before deletion
                  type: integer
                  default: 1024
                rotation_interval:
                  description: >-
                    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`.
                  type: string
                  default: ''
                max_age:
                  description: The maximum number of days to retain old log files.
                  default: 2
                  type: integer
            collation_buffer_size:
              description: The size of the log collation buffer
              default: 1000
              type: integer
              readOnly: true
        trace:
          type: object
          description: Trace logging configuration.
          properties:
            enabled:
              description: Toggle for this log output
              type: boolean
              default: false
            rotation:
              type: object
              readOnly: true
              properties:
                max_size:
                  description: >-
                    The maximum size in MB of the log file before it gets
                    rotated.
                  type: integer
                  default: 100
                localtime:
                  description: >-
                    If true, it uses the computer's local time to format the
                    backup timestamp.
                  type: boolean
                  default: false
                rotated_logs_size_limit:
                  description: Max Size (in mb) of log files before deletion
                  type: integer
                  default: 1024
                rotation_interval:
                  description: >-
                    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`.
                  type: string
                  default: ''
                max_age:
                  description: The maximum number of days to retain old log files.
                  default: 2
                  type: integer
            collation_buffer_size:
              description: The size of the log collation buffer
              default: 1000
              type: integer
              readOnly: true
        stats:
          type: object
          description: Trace logging configuration.
          properties:
            enabled:
              description: Toggle for this log output
              type: boolean
              default: true
            rotation:
              type: object
              readOnly: true
              properties:
                max_size:
                  description: >-
                    The maximum size in MB of the log file before it gets
                    rotated.
                  type: integer
                  default: 100
                localtime:
                  description: >-
                    If true, it uses the computer's local time to format the
                    backup timestamp.
                  type: boolean
                  default: false
                rotated_logs_size_limit:
                  description: Max Size (in mb) of log files before deletion
                  type: integer
                  default: 1024
                rotation_interval:
                  description: >-
                    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`.
                  type: string
                  default: ''
                max_age:
                  description: The maximum number of days to retain old log files.
                  default: 6
                  type: integer
            collation_buffer_size:
              description: The size of the log collation buffer
              default: 0
              type: integer
              readOnly: true
        audit:
          type: object
          title: Audit logging config
          properties:
            enabled:
              description: Toggle for this log output
              type: boolean
              default: false
            rotation:
              type: object
              readOnly: true
              properties:
                max_size:
                  description: >-
                    The maximum size in MB of the log file before it gets
                    rotated.
                  type: integer
                  default: 100
                localtime:
                  description: >-
                    If true, it uses the computer's local time to format the
                    backup timestamp.
                  type: boolean
                  default: false
                rotated_logs_size_limit:
                  description: Max Size (in mb) of log files before deletion
                  type: integer
                  default: 1024
                rotation_interval:
                  description: >-
                    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`.
                  type: string
                  default: ''
                max_age:
                  description: The maximum number of days to retain old log files.
                  default: 6
                  type: integer
            audit_log_file_path:
              description: The path to write audit log files to
              type: string
              readOnly: true
            enabled_events:
              description: List of enabled global audit events.
              type: array
              items:
                type: number
              example:
                - 1234
                - 5678
              readOnly: true
    Serverless:
      description: Configuration for when SG is running in serverless mode
      type: object
      properties:
        enabled:
          description: Run SG in to serverless mode
          type: boolean
          readOnly: true
        min_config_fetch_interval:
          description: >-
            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`.
          type: string
          default: 1s
    Startup-config:
      type: object
      x-requirePropertiesSorted: true
      properties:
        api:
          description: >-
            Configuration settings for modifying how the REST API is interacted
            with.
          type: object
          properties:
            admin_interface:
              description: |-
                Network interface to bind admin API to.

                By default, this will only be accessible to the localhost.
              type: string
              default: '127.0.0.1:4985'
            admin_interface_authentication:
              description: Whether the admin API requires authentication
              type: boolean
              default: true
            compress_responses:
              description: 'If false, disables compression of HTTP responses'
              type: boolean
              default: true
            cors:
              allOf:
                - type: object
                  description: CORS configuration for all databases
                - type: object
                  properties:
                    headers:
                      description: >-
                        List of allowed headers. These headers will be added the
                        `Access-Control-Allow-Headers` response to a valid CORS
                        request.


                        A recommended minimum set of values should be
                        `["Accept-Encoding", "Authorization", "Content-Type",
                        "If-Match"]`.
                      type: array
                      items:
                        type: string
                      example:
                        - Accept-Encoding
                        - Authorization
                        - Content-Type
                        - If-Match
                    login_origin:
                      description: >-
                        List of allowed origins to apply to public
                        `/{db}/_session` API.


                        To use cors on `/{db}/_session`, the domain must be
                        present in both `login_origin` and `origin`.


                        If configured, `Authorization` must be included in
                        headers.
                      type: array
                      items:
                        type: string
                      example:
                        - 'https://example.com'
                    max_age:
                      description: >-
                        Value for `Access-Control-Maximum-Age`. Uses 0 by
                        default.
                      type: integer
                      default: 0
                    origin:
                      description: >-
                        List of allowed origins for the public API. The request
                        `Origin` header is checked against these values. If
                        successful the `Origin` header is returned in the HTTP
                        response header as `Access-Control-Allow-Origin`.
                      type: array
                      items:
                        type: string
                      example:
                        - 'https://example.com'
                  title: Cors Configuration
            enable_advanced_auth_dp:
              description: >-
                Whether to enable the DP permissions check feature of admin
                auth.


                Defaults to `true` if using Enterprise Edition or `false` if
                using Community Edition.
              type: boolean
            hide_product_version:
              description: >-
                Whether product versions removed from Server headers and REST
                API responses
              type: boolean
            https:
              type: object
              properties:
                tls_cert_path:
                  description: The TLS cert file to use for the REST APIs
                  type: string
                tls_key_path:
                  description: The TLS key file to use for the REST APIs
                  type: string
                tls_minimum_version:
                  description: The minimum allowable TLS version for the REST APIs
                  type: string
                  default: tlsv1.2
            idle_timeout:
              description: >-
                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`.
              type: string
              default: 90s
            max_connections:
              description: Max of incoming HTTP connections to accept
              type: number
              default: 0
            metrics_interface:
              description: |-
                Network interface to bind metrics API to.

                By default, this will only be accessible to the localhost.
              type: string
              default: '127.0.0.1:4986'
            metrics_interface_authentication:
              description: Whether the metrics API requires authentication
              type: boolean
              default: true
            profile_interface:
              description: Network interface to bind profiling API to
              type: string
            public_interface:
              description: Network interface to bind public API to
              type: string
              default: ':4984'
            read_header_timeout:
              description: >-
                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`.
              type: string
              default: 5s
            server_read_timeout:
              description: >-
                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`.
              type: string
            server_write_timeout:
              description: >-
                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`.
              type: string
            pretty:
              description: Pretty-print JSON responses. This property is deprecated.
              type: boolean
              deprecated: true
          readOnly: true
        auth:
          type: object
          properties:
            bcrypt_cost:
              description: Cost to use for bcrypt password hashes
              type: integer
              default: 10
              maximum: 31
              minimum: 10
          readOnly: true
        bootstrap:
          description: Configuration settings for interacting with Couchbase Server.
          type: object
          properties:
            ca_cert_path:
              description: Root CA cert path for TLS connection
              type: string
            config_update_frequency:
              description: >-
                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`.
              type: string
              default: 10s
            group_id:
              description: >-
                The config group ID to use when discovering databases. Allows
                for non-homogenous configuration.
              type: string
              default: default
            password:
              description: Password for authenticating to server
              type: string
            server:
              description: >
                Couchbase Server connection string/URL for bootstrap
                configuration.

                The connection string should only reference Couchbase Server
                Data (KV) nodes.

                Using other node types (Query, Index, Analytics, or Search
                nodes) is not supported.

                **Connection String Format**

                Sync Gateway supports the ability to resolve DNS SRV records for
                alternate hostnames, or specifying multiple hostnames
                explicitly. See the [Couchbase Go SDK documentation on DNS SRV
                records](https://docs.couchbase.com/go-sdk/current/howtos/managing-connections.html#using-dns-srv-records)
                for more details.

                Sync Gateway supports both the couchbases:// for TLS and
                couchbase:// schemes for insecure connection.

                The supported schemes match that of the Couchbase Server SDKs.

                **Examples of valid server values:**

                - `couchbases://nodeA.example.com`

                - `couchbase://nodeA.example.com`

                - `couchbases://nodeA.example.com,nodeB.example.com`

                - `couchbase://nodeA.example.com,nodeB.example.com`

                - `couchbases://nodeA.example.com:1234,nodeB.example.com:1234`

                - `couchbase://nodeA.example.com:1234,nodeB.example.com:1234`

                - `couchbases://127.0.0.1`

                - `couchbase://127.0.0.1`

                On startup, Sync Gateway will try all hostnames until it is able

                to connect successfully.

                **Port Information**

                When using the couchbase:// or couchbases:// schemes, the port
                is not required as Sync Gateway will use the default Couchbase
                Server client-to-node ports (11210 for couchbase:// and 11207
                for couchbases://). See the [Couchbase Server ports
                documentation](https://docs.couchbase.com/server/current/install/install-ports.html#ports-listed-by-communication-path)
                for more details.

                **Alternate Addresses**

                If your Couchbase Server cluster is running in a containerized,
                port mapped, or otherwise NATd environment like Docker or
                Kubernetes, Sync Gateway might need more information to connect
                to the cluster. In many cases the client is able to
                automatically select the correct set of addresses.

                If the detection heuristic fails in your environment, it is
                possible to override this behavior by adding a network parameter
                to the connection string.

                The network parameter can be:

                - `external`: Force the use alternate addresses of Couchbase
                Server. Used when Sync Gateway should not share network used by
                Couchbase Server internally.

                - `default`: Do not allow use of alternate addresses of
                Couchbase Server. Used when Sync Gateway and Couchbase Server
                are on the same network.

                Example: `"server":
                "couchbases://my-cbs-server?network=default"`

                Will force the connection to ignore any alternative external
                addresses configured

                on the Couchbase Server node.

                **Lost Connections**

                If the connection to Couchbase Server is lost during normal
                operations, Sync Gateway

                will automatically re-connect to another node in the cluster.
              type: string
            server_tls_skip_verify:
              description: >-
                Allow empty server CA Cert Path without attempting to use system
                root pool
              type: boolean
              default: false
            use_tls_server:
              description: Enforces a secure or non-secure server scheme
              type: boolean
              default: true
            username:
              description: Username for authenticating to server.
              type: string
            x509_cert_path:
              description: Cert path (public key) for X.509 bucket auth
              type: string
            x509_key_path:
              description: Key path (private key) for X.509 bucket auth
              type: string
          readOnly: true
          required:
            - server
            - username
            - password
        bucket_credentials:
          description: >-
            A map of bucket names to credentials, that can be used instead of
            the bootstrap ones.
          type: object
          additionalProperties:
            x-additionalPropertiesName: bucketname
            description: The configuration for the credentials set.
            type: object
            properties:
              username:
                description: Username for authenticating to the bucket
                type: string
              password:
                description: >-
                  Password for authenticating to the bucket. This value is
                  always redacted.
                type: string
              x509_cert_path:
                description: Cert path (public key) for X.509 bucket auth
                type: string
              x509_key_path:
                description: Key path (private key) for X.509 bucket auth
                type: string
            title: Credentials config
          readOnly: true
        database_credentials:
          description: >-
            A map of database name to credentials, that can be used instead of
            the bootstrap ones.
          type: object
          additionalProperties:
            x-additionalPropertiesName: databasename
            description: The configuration for the credentials set.
            type: object
            properties:
              username:
                description: Username for authenticating to the bucket
                type: string
              password:
                description: >-
                  Password for authenticating to the bucket. This value is
                  always redacted.
                type: string
              x509_cert_path:
                description: Cert path (public key) for X.509 bucket auth
                type: string
              x509_key_path:
                description: Key path (private key) for X.509 bucket auth
                type: string
            title: Credentials config
          readOnly: true
        heap_profile_collection_threshold:
          description: >-
            Threshold in bytes for automatic collection of heap profiles. If not
            specified, defaults to 85% of the lesser of cgroup or system memory.
          readOnly: true
          type: integer
        heap_profile_disable_collection:
          description: Disables automatic heap profile collection.
          default: false
          type: boolean
          readOnly: true
        logging:
          description: The configuration settings for modifying Sync Gateway logging.
          type: object
          allOf:
            - type: object
              properties:
                log_file_path:
                  description: >-
                    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.
                  type: string
                  readOnly: true
                redaction_level:
                  description: Redaction level to apply to log output.
                  type: string
                  default: partial
                  enum:
                    - none
                    - partial
                    - full
                    - unset
                  readOnly: true
                console:
                  allOf:
                    - title: Configuration for console logging.
                      allOf:
                        - type: object
                          properties:
                            log_level:
                              description: Log Level for the console output
                              type: string
                              default: info
                              enum:
                                - none
                                - error
                                - warn
                                - info
                                - debug
                                - trace
                            log_keys:
                              description: Log Keys for the console output
                              type: array
                              items:
                                type: string
                                enum:
                                  - '*'
                                  - Admin
                                  - Access
                                  - Auth
                                  - Bucket
                                  - Cache
                                  - Changes
                                  - SGCluster
                                  - Config
                                  - CRUD
                                  - DCP
                                  - Diagnostic
                                  - Events
                                  - gocb
                                  - HTTP
                                  - HTTP+
                                  - Import
                                  - Javascript
                                  - Migrate
                                  - Query
                                  - Replicate
                                  - Sync
                                  - SyncMsg
                                  - WS
                                  - WSFrame
                                x-enumDescriptions:
                                  '*': 'This wildcard log key, enables all log keys.'
                                  Access: >-
                                    Anytime an access() call is made in the sync
                                    function.
                                  Admin: Admin processes in Sync Gateway.
                                  Auth: Authentication.
                                  Bucket: Sync Gateway interactions with the bucket.
                                  CRUD: CRUD operations.
                                  Cache: >-
                                    Interactions with Sync Gateway’s in-memory
                                    channel cache.
                                  Changes: >-
                                    Processing of /{keyspace}/_changes requests
                                    and pull replications
                                  Config: Server or database configuration.
                                  DCP: Updates made by Sync Gateway to documents.
                                  Diagnostic: Operations used by dry run endpoints.
                                  Events: Event processing (webhooks).
                                  HTTP: >-
                                    All requests made to the Sync Gateway REST
                                    APIs.
                                  HTTP+: >-
                                    Additional information about HTTP requests
                                    (response times, status codes).
                                  Import: >-
                                    This log key can be useful to troubleshoot
                                    why a given document was not successfully
                                    imported.
                                  Javascript: >-
                                    All logging from Javascript. This includes:
                                    sync function, import filters, webhook
                                    filter function, and custom inter-Sync
                                    Gateway replication conflict resolvers.
                                  Migrate: >-
                                    Logs messages that show when old inline
                                    document metadata is upgraded to xattrs.
                                  Query: >-
                                    Query is used for Sync Gateway code related
                                    to N1QL queries
                                  Replicate: >-
                                    Log messages related to Inter-Sync Gateway
                                    replications. This is not used for
                                    replications initiated by Couchbase Lite.
                                  SGCluster: >-
                                    Log messages related to coordination of Sync
                                    Gateways for sharded import and Inter-Sync
                                    Gateway Replication.
                                  Sync: >-
                                    Activity which relates to synchronization
                                    between Couchbase Lite and Sync Gateway
                                  SyncMsg: Additional logging on top of `Sync` key.
                                  WS: Websocket replication log messages.
                                  WSFrame: Additional logging on top of `WS` key.
                                  gocb: All logging emitted by the gocb SDK
                                example:
                                  - CRUD
                                  - HTTP
                                  - Query
                        - type: object
                          properties:
                            color_enabled:
                              description: Log with color for the console output
                              type: boolean
                              default: false
                              readOnly: true
                            file_output:
                              description: >-
                                Override the default stderr output, and write to
                                the file specified instead
                              type: string
                              readOnly: true
                            enabled:
                              description: Toggle for this log output
                              type: boolean
                              default: false
                              readOnly: true
                            rotation:
                              type: object
                              readOnly: true
                              title: Log-rotation-config
                              properties:
                                max_size:
                                  description: >-
                                    The maximum size in MB of the log file
                                    before it gets rotated.
                                  type: integer
                                  default: 100
                                localtime:
                                  description: >-
                                    If true, it uses the computer's local time
                                    to format the backup timestamp.
                                  type: boolean
                                  default: false
                                rotated_logs_size_limit:
                                  description: >-
                                    Max Size (in mb) of log files before
                                    deletion
                                  type: integer
                                  default: 1024
                                rotation_interval:
                                  description: >-
                                    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`.
                                  type: string
                                  default: ''
                                max_age:
                                  description: >-
                                    The maximum number of days to retain old log
                                    files. By default, there is no rotation,
                                    max_age=0.
                                  default: 0
                                  type: integer
                            collation_buffer_size:
                              description: >-
                                The size of the log collation buffer. The
                                default is 10 if the output is stderr, or 1000
                                if to a file.
                              type: integer
                              default: 10
                              readOnly: true
                error:
                  type: object
                  description: Error logging configuration.
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: true
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 360
                          type: integer
                    collation_buffer_size:
                      description: The size of the log collation buffer.
                      default: 0
                      type: integer
                      readOnly: true
                warn:
                  type: object
                  description: Warning logging configuration.
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: true
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 180
                          type: integer
                    collation_buffer_size:
                      description: The size of the log collation buffer
                      default: 0
                      type: integer
                      readOnly: true
                info:
                  type: object
                  description: Info logging configuration.
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: true
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 6
                          type: integer
                    collation_buffer_size:
                      description: The size of the log collation buffer
                      default: 0
                      type: integer
                      readOnly: true
                debug:
                  type: object
                  description: Debug logging configuration.
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: false
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 2
                          type: integer
                    collation_buffer_size:
                      description: The size of the log collation buffer
                      default: 1000
                      type: integer
                      readOnly: true
                trace:
                  type: object
                  description: Trace logging configuration.
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: false
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 2
                          type: integer
                    collation_buffer_size:
                      description: The size of the log collation buffer
                      default: 1000
                      type: integer
                      readOnly: true
                stats:
                  type: object
                  description: Trace logging configuration.
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: true
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 6
                          type: integer
                    collation_buffer_size:
                      description: The size of the log collation buffer
                      default: 0
                      type: integer
                      readOnly: true
                audit:
                  type: object
                  title: Audit logging config
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: false
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 6
                          type: integer
                    audit_log_file_path:
                      description: The path to write audit log files to
                      type: string
                      readOnly: true
                    enabled_events:
                      description: List of enabled global audit events.
                      type: array
                      items:
                        type: number
                      example:
                        - 1234
                        - 5678
                      readOnly: true
        max_file_descriptors:
          description: Max of open file descriptors (RLIMIT_NOFILE)
          type: number
          default: 5000
          minimum: 0
          readOnly: true
        replicator:
          type: object
          properties:
            blip_compression:
              description: BLIP data compression level (0-9)
              type: integer
              maximum: 9
              minimum: 0
            max_concurrent_changes_batches:
              description: >-
                Maximum number of changes batches to process concurrently per
                replication (1-5)"
              type: integer
              default: 2
              minimum: 1
              maximum: 5
            max_concurrent_replications:
              description: >-
                Maximum number of concurrent replication connections allowed. If
                set to 0 this limit will be ignored.
              type: integer
            max_concurrent_revs:
              description: >-
                Maximum number of revs to process concurrently per replication
                (5-200)
              type: integer
              default: 5
              minimum: 5
              maximum: 200
            max_heartbeat:
              description: >-
                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`.
              type: string
          readOnly: true
        unsupported:
          description: >-
            Settings that are not officially supported. It is highly recommended
            these are **not** used.
          type: object
          properties:
            allow_dbconfig_env_vars:
              description: >-
                Can be set to false to skip environment variable expansion in
                database configs
              type: boolean
              default: true
            diagnostic_interface:
              description: >-
                Network interface to bind diagnotic API to.


                By default, this API will not be run unless this string is
                specified.
              type: string
              default: ''
            http2:
              type: object
              properties:
                enabled:
                  description: Whether HTTP2 support is enabled
                  type: boolean
                  default: false
            serverless:
              description: Configuration for when SG is running in serverless mode
              type: object
              properties:
                enabled:
                  description: Run SG in to serverless mode
                  type: boolean
                  readOnly: true
                min_config_fetch_interval:
                  description: >-
                    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`.
                  type: string
                  default: 1s
            stats_log_frequency:
              description: >-
                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`.
              type: string
              default: 1m
            use_stdlib_json:
              description: Bypass the jsoniter package and use Go's stdlib instead
              type: boolean
              default: false
            use_xattr_config:
              description: Store database configurations in system xattrs
              type: boolean
              default: false
          readOnly: true
        couchbase_keepalive_interval:
          description: >-
            TCP keep-alive interval between SG and Couchbase server. This is
            unused.
          type: integer
          deprecated: true
          readOnly: true
      title: Startup-config
    Runtime-config:
      type: object
      properties:
        logging:
          allOf:
            - type: object
              properties:
                log_file_path:
                  description: >-
                    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.
                  type: string
                  readOnly: true
                redaction_level:
                  description: Redaction level to apply to log output.
                  type: string
                  default: partial
                  enum:
                    - none
                    - partial
                    - full
                    - unset
                  readOnly: true
                console:
                  allOf:
                    - title: Configuration for console logging.
                      allOf:
                        - type: object
                          properties:
                            log_level:
                              description: Log Level for the console output
                              type: string
                              default: info
                              enum:
                                - none
                                - error
                                - warn
                                - info
                                - debug
                                - trace
                            log_keys:
                              description: Log Keys for the console output
                              type: array
                              items:
                                type: string
                                enum:
                                  - '*'
                                  - Admin
                                  - Access
                                  - Auth
                                  - Bucket
                                  - Cache
                                  - Changes
                                  - SGCluster
                                  - Config
                                  - CRUD
                                  - DCP
                                  - Diagnostic
                                  - Events
                                  - gocb
                                  - HTTP
                                  - HTTP+
                                  - Import
                                  - Javascript
                                  - Migrate
                                  - Query
                                  - Replicate
                                  - Sync
                                  - SyncMsg
                                  - WS
                                  - WSFrame
                                x-enumDescriptions:
                                  '*': 'This wildcard log key, enables all log keys.'
                                  Access: >-
                                    Anytime an access() call is made in the sync
                                    function.
                                  Admin: Admin processes in Sync Gateway.
                                  Auth: Authentication.
                                  Bucket: Sync Gateway interactions with the bucket.
                                  CRUD: CRUD operations.
                                  Cache: >-
                                    Interactions with Sync Gateway’s in-memory
                                    channel cache.
                                  Changes: >-
                                    Processing of /{keyspace}/_changes requests
                                    and pull replications
                                  Config: Server or database configuration.
                                  DCP: Updates made by Sync Gateway to documents.
                                  Diagnostic: Operations used by dry run endpoints.
                                  Events: Event processing (webhooks).
                                  HTTP: >-
                                    All requests made to the Sync Gateway REST
                                    APIs.
                                  HTTP+: >-
                                    Additional information about HTTP requests
                                    (response times, status codes).
                                  Import: >-
                                    This log key can be useful to troubleshoot
                                    why a given document was not successfully
                                    imported.
                                  Javascript: >-
                                    All logging from Javascript. This includes:
                                    sync function, import filters, webhook
                                    filter function, and custom inter-Sync
                                    Gateway replication conflict resolvers.
                                  Migrate: >-
                                    Logs messages that show when old inline
                                    document metadata is upgraded to xattrs.
                                  Query: >-
                                    Query is used for Sync Gateway code related
                                    to N1QL queries
                                  Replicate: >-
                                    Log messages related to Inter-Sync Gateway
                                    replications. This is not used for
                                    replications initiated by Couchbase Lite.
                                  SGCluster: >-
                                    Log messages related to coordination of Sync
                                    Gateways for sharded import and Inter-Sync
                                    Gateway Replication.
                                  Sync: >-
                                    Activity which relates to synchronization
                                    between Couchbase Lite and Sync Gateway
                                  SyncMsg: Additional logging on top of `Sync` key.
                                  WS: Websocket replication log messages.
                                  WSFrame: Additional logging on top of `WS` key.
                                  gocb: All logging emitted by the gocb SDK
                                example:
                                  - CRUD
                                  - HTTP
                                  - Query
                        - type: object
                          properties:
                            color_enabled:
                              description: Log with color for the console output
                              type: boolean
                              default: false
                              readOnly: true
                            file_output:
                              description: >-
                                Override the default stderr output, and write to
                                the file specified instead
                              type: string
                              readOnly: true
                            enabled:
                              description: Toggle for this log output
                              type: boolean
                              default: false
                              readOnly: true
                            rotation:
                              type: object
                              readOnly: true
                              title: Log-rotation-config
                              properties:
                                max_size:
                                  description: >-
                                    The maximum size in MB of the log file
                                    before it gets rotated.
                                  type: integer
                                  default: 100
                                localtime:
                                  description: >-
                                    If true, it uses the computer's local time
                                    to format the backup timestamp.
                                  type: boolean
                                  default: false
                                rotated_logs_size_limit:
                                  description: >-
                                    Max Size (in mb) of log files before
                                    deletion
                                  type: integer
                                  default: 1024
                                rotation_interval:
                                  description: >-
                                    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`.
                                  type: string
                                  default: ''
                                max_age:
                                  description: >-
                                    The maximum number of days to retain old log
                                    files. By default, there is no rotation,
                                    max_age=0.
                                  default: 0
                                  type: integer
                            collation_buffer_size:
                              description: >-
                                The size of the log collation buffer. The
                                default is 10 if the output is stderr, or 1000
                                if to a file.
                              type: integer
                              default: 10
                              readOnly: true
                error:
                  type: object
                  description: Error logging configuration.
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: true
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 360
                          type: integer
                    collation_buffer_size:
                      description: The size of the log collation buffer.
                      default: 0
                      type: integer
                      readOnly: true
                warn:
                  type: object
                  description: Warning logging configuration.
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: true
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 180
                          type: integer
                    collation_buffer_size:
                      description: The size of the log collation buffer
                      default: 0
                      type: integer
                      readOnly: true
                info:
                  type: object
                  description: Info logging configuration.
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: true
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 6
                          type: integer
                    collation_buffer_size:
                      description: The size of the log collation buffer
                      default: 0
                      type: integer
                      readOnly: true
                debug:
                  type: object
                  description: Debug logging configuration.
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: false
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 2
                          type: integer
                    collation_buffer_size:
                      description: The size of the log collation buffer
                      default: 1000
                      type: integer
                      readOnly: true
                trace:
                  type: object
                  description: Trace logging configuration.
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: false
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 2
                          type: integer
                    collation_buffer_size:
                      description: The size of the log collation buffer
                      default: 1000
                      type: integer
                      readOnly: true
                stats:
                  type: object
                  description: Trace logging configuration.
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: true
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 6
                          type: integer
                    collation_buffer_size:
                      description: The size of the log collation buffer
                      default: 0
                      type: integer
                      readOnly: true
                audit:
                  type: object
                  title: Audit logging config
                  properties:
                    enabled:
                      description: Toggle for this log output
                      type: boolean
                      default: false
                    rotation:
                      type: object
                      readOnly: true
                      properties:
                        max_size:
                          description: >-
                            The maximum size in MB of the log file before it
                            gets rotated.
                          type: integer
                          default: 100
                        localtime:
                          description: >-
                            If true, it uses the computer's local time to format
                            the backup timestamp.
                          type: boolean
                          default: false
                        rotated_logs_size_limit:
                          description: Max Size (in mb) of log files before deletion
                          type: integer
                          default: 1024
                        rotation_interval:
                          description: >-
                            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`.
                          type: string
                          default: ''
                        max_age:
                          description: The maximum number of days to retain old log files.
                          default: 6
                          type: integer
                    audit_log_file_path:
                      description: The path to write audit log files to
                      type: string
                      readOnly: true
                    enabled_events:
                      description: List of enabled global audit events.
                      type: array
                      items:
                        type: number
                      example:
                        - 1234
                        - 5678
                      readOnly: true
        max_concurrent_replications:
          description: >-
            Maximum number of concurrent replication connections allowed. If set
            to 0 this limit will be ignored.
          type: integer
          default: 0
      title: Runtime-config
    Vendor:
      description: Product vendor
      type: object
      properties:
        name:
          description: Product name
          type: string
          example: Couchbase Sync Gateway
        version:
          description: |-
            API version.
            Omitted if `api.hide_product_version=true`
          type: string
          example: 3.1
      required:
        - name
      title: Vendor
    Status:
      type: object
      properties:
        databases:
          description: >-
            Contains a map of all the databases in the node along with their
            status.
          type: object
          additionalProperties:
            x-additionalPropertiesName: dbname
            description: The name of the database.
            type: object
            properties:
              seq:
                description: The latest sequence number in the database.
                type: number
                minimum: 0
              server_uuid:
                description: The server unique identifier.
                type: string
              require_resync:
                description: >-
                  Indicates whether the database requires resync before it can
                  be brought online.
                type: boolean
              state:
                allOf:
                  - description: The state of the database.
                    type: string
                    enum:
                      - Online
                      - Offline
                      - Starting
                      - Stopping
                      - Resyncing
                    x-enumDescriptions:
                      Online: The database is online and available for use.
                      Offline: >-
                        The database is offline, resync and other offline only
                        endpoints are allowed.
                      Starting: The database is in the process of going online.
                      Stopping: >-
                        The database is no longer accepting connections and is
                        being taken offline or deleted.
                      Resyncing: >-
                        The database is offline and performing a resync
                        operation.
              replication_status:
                type: array
                items:
                  type: object
                  properties:
                    replication_id:
                      description: The ID of the replication.
                      type: string
                    config:
                      description: Properties of a replication
                      type: object
                      x-requirePropertiesSorted: true
                      properties:
                        adhoc:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        batch_size:
                          description: >-
                            The amount of changes to be sent in one batch of
                            replications. Changing this is an Enterprise Edition
                            only feature.
                          type: integer
                          default: 200
                        collections_enabled:
                          description: >-
                            If true, the replicator will run with collections,
                            and will replicate all collections, unless otherwise
                            limited by `collections_local`.


                            If false, the replicator will only replicate the
                            default collection.
                          type: boolean
                          default: false
                        collections_local:
                          description: >-
                            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.
                          type: array
                          items:
                            type: string
                          example:
                            - scope1.collection1
                            - scope1.collection3
                            - scope1.collection6
                          default: []
                        collections_remote:
                          description: >-
                            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.
                          type: array
                          items:
                            type: string
                            nullable: true
                          example:
                            - scope1.collectionA
                            - null
                            - scope1.collectionF
                          default: []
                        conflict_resolution_type:
                          description: >-
                            This defines what conflict resolution policy Sync
                            Gateway should use to apply when resolving
                            conflicting revisions.


                            Changing this is an Enterprise Edition only feature.
                          type: string
                          default: default
                          enum:
                            - default
                            - remoteWins
                            - localWins
                            - custom
                          x-enumDescriptions:
                            default: |-
                              This will use:
                                - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                                - The revision with the most recent timestamp wins.
                                - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                            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.
                        continuous:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        custom_conflict_resolver:
                          description: >-
                            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 document's body.
                            This can be the winning revision (for example,
                            `return conflict.LocalDocument`), a new body, or
                            `nil` to resolve as a delete.


                            Example:


                            ```javascript

                            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.


                            If a document merge is being done, the `_rev` and
                            `_cv` properties should not be included in the
                            returned document body as Sync Gateway will generate
                            new values for these.


                            This is an Enterprise Edition only feature.
                          type: string
                          default: ''
                        direction:
                          description: >-
                            This specifies which direction the replication will
                            be replicating with the `remote` replicator.
                          type: string
                          enum:
                            - push
                            - pull
                            - pushAndPull
                          x-enumDescriptions:
                            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
                        enable_delta_sync:
                          description: >-
                            This will turn on delta-sync for the replication. In
                            order to enable delta-sync for a replication, the
                            database level setting `delta_sync.enabled` must
                            also be set to true.


                            Using delta-sync is an Enterprise Edition only
                            feature.
                          type: boolean
                          default: false
                        filter:
                          description: This defines whether to filter documents.
                          type: string
                          enum:
                            - sync_gateway/bychannel
                            - ''
                          x-enumDescriptions:
                            '': Do not filter any documents.
                            sync_gateway/bychannel: >-
                              If set, a pull replication will be limited to a
                              specific set of channels specified by the
                              `query_param.channels` property.
                        initial_state:
                          description: >-
                            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`.
                          type: string
                          default: running
                          enum:
                            - running
                            - stopped
                          x-enumDescriptions:
                            running: The replication will immediately start running.
                            stopped: >-
                              The replication configuration will be created but
                              the replication will not start running until the
                              user explicitly starts it.
                        max_backoff_time:
                          description: >-
                            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.
                          type: integer
                          default: 5
                        purge_on_removal:
                          description: >-
                            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.
                          type: boolean
                          default: false
                        query_params:
                          description: >-
                            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:

                            ```json

                            "filter":"sync_gateway/bychannel",

                            "query_params": {
                              "channels":["chanUser1"]
                            },

                            ```
                          type: array
                          items:
                            type: string
                        remote:
                          description: >-
                            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,
                            `https://localhost:4985/db`.
                          type: string
                        remote_password:
                          description: >-
                            The password to use to authenticate with the remote.
                            This password will be redacted in the replication
                            config.
                          type: string
                        remote_username:
                          description: The username to use to authenticate with the remote.
                          type: string
                        replication_id:
                          description: >-
                            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.
                          type: string
                          maximum: 160
                        run_as:
                          description: >-
                            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.
                          type: string
                        password:
                          description: >-
                            **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.
                          type: string
                          deprecated: true
                        username:
                          description: >-
                            **This has been deprecated in favour of
                            `remote_username`.**


                            This is the username to use to authenticate with the
                            remote.
                          type: string
                          deprecated: true
                      required:
                        - direction
                      title: User configurable replication properties
                    status:
                      description: >-
                        This is the state that the replicator is in or that
                        trying to transition in to.
                      type: string
                      enum:
                        - running
                        - stopped
                        - resetting
                        - error
                        - starting
                        - reconnecting
                      x-enumDescriptions:
                        running: Currently running replication.
                        stopped: Not running replication.
                        resetting: The replication is resetting its state.
                        error: The replication is stopped due to an error.
                        starting: The replication is starting up.
                        reconnecting: >-
                          The replication is reconnecting to the remote
                          database.
                      title: Replication Status
                    error_message:
                      description: >-
                        The error message of the replication if an error has
                        occurred.
                      type: string
                    docs_read:
                      description: >-
                        The number of documents that have been read (fetched)
                        from the source database.
                      type: integer
                    docs_checked_pull:
                      type: integer
                    docs_purged:
                      description: The number of documents that have been purged.
                      type: integer
                    rejected_by_local:
                      description: >-
                        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.
                      type: integer
                    last_seq_pull:
                      description: >-
                        The last changes sequence number that was pulled from
                        the remote.
                      type: string
                    deltas_recv:
                      description: >-
                        The number of deltas that have been received from the
                        remote.
                      type: integer
                    deltas_requested:
                      type: integer
                    docs_written:
                      description: >-
                        The number of documents that have been wrote (pushed) to
                        the target database.
                      type: integer
                    docs_checked_push:
                      type: integer
                    doc_write_failures:
                      description: >-
                        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.
                      type: integer
                    doc_write_conflicts:
                      description: The number of documents that had a conflict.
                      type: integer
                    rejected_by_remote:
                      description: >-
                        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.
                      type: integer
                    last_seq_push:
                      description: >-
                        The last changes sequence number that was pushed to the
                        remote.
                      type: string
                    deltas_sent:
                      description: 'The number of deltas that have been sent to the remote. '
                      type: integer
                  required:
                    - replication_id
                  title: Replication-status
              cluster:
                type: object
                properties:
                  cluster_uuid:
                    description: The cluster unique identifier.
                    type: string
                  replication:
                    description: Map of replication configs defined for the cluster.
                    type: object
                    properties:
                      replication_id:
                        description: Properties of a replication
                        allOf:
                          - type: object
                            properties:
                              replication_id:
                                description: This is the ID of the replication.
                                type: string
                          - description: Properties of a replication
                            type: object
                            x-requirePropertiesSorted: true
                            properties:
                              adhoc:
                                description: >-
                                  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.
                                type: boolean
                                default: false
                              batch_size:
                                description: >-
                                  The amount of changes to be sent in one batch
                                  of replications. Changing this is an
                                  Enterprise Edition only feature.
                                type: integer
                                default: 200
                              collections_enabled:
                                description: >-
                                  If true, the replicator will run with
                                  collections, and will replicate all
                                  collections, unless otherwise limited by
                                  `collections_local`.


                                  If false, the replicator will only replicate
                                  the default collection.
                                type: boolean
                                default: false
                              collections_local:
                                description: >-
                                  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.
                                type: array
                                items:
                                  type: string
                                example:
                                  - scope1.collection1
                                  - scope1.collection3
                                  - scope1.collection6
                                default: []
                              collections_remote:
                                description: >-
                                  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.
                                type: array
                                items:
                                  type: string
                                  nullable: true
                                example:
                                  - scope1.collectionA
                                  - null
                                  - scope1.collectionF
                                default: []
                              conflict_resolution_type:
                                description: >-
                                  This defines what conflict resolution policy
                                  Sync Gateway should use to apply when
                                  resolving conflicting revisions.


                                  Changing this is an Enterprise Edition only
                                  feature.
                                type: string
                                default: default
                                enum:
                                  - default
                                  - remoteWins
                                  - localWins
                                  - custom
                                x-enumDescriptions:
                                  default: |-
                                    This will use:
                                      - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                                      - The revision with the most recent timestamp wins.
                                      - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                                  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.
                              continuous:
                                description: >-
                                  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.
                                type: boolean
                                default: false
                              custom_conflict_resolver:
                                description: >-
                                  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 document's
                                  body. This can be the winning revision (for
                                  example, `return conflict.LocalDocument`), a
                                  new body, or `nil` to resolve as a delete.


                                  Example:


                                  ```javascript

                                  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.


                                  If a document merge is being done, the `_rev`
                                  and `_cv` properties should not be included in
                                  the returned document body as Sync Gateway
                                  will generate new values for these.


                                  This is an Enterprise Edition only feature.
                                type: string
                                default: ''
                              direction:
                                description: >-
                                  This specifies which direction the replication
                                  will be replicating with the `remote`
                                  replicator.
                                type: string
                                enum:
                                  - push
                                  - pull
                                  - pushAndPull
                                x-enumDescriptions:
                                  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
                              enable_delta_sync:
                                description: >-
                                  This will turn on delta-sync for the
                                  replication. In order to enable delta-sync for
                                  a replication, the database level setting
                                  `delta_sync.enabled` must also be set to true.


                                  Using delta-sync is an Enterprise Edition only
                                  feature.
                                type: boolean
                                default: false
                              filter:
                                description: This defines whether to filter documents.
                                type: string
                                enum:
                                  - sync_gateway/bychannel
                                  - ''
                                x-enumDescriptions:
                                  '': Do not filter any documents.
                                  sync_gateway/bychannel: >-
                                    If set, a pull replication will be limited
                                    to a specific set of channels specified by
                                    the `query_param.channels` property.
                              initial_state:
                                description: >-
                                  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`.
                                type: string
                                default: running
                                enum:
                                  - running
                                  - stopped
                                x-enumDescriptions:
                                  running: >-
                                    The replication will immediately start
                                    running.
                                  stopped: >-
                                    The replication configuration will be
                                    created but the replication will not start
                                    running until the user explicitly starts it.
                              max_backoff_time:
                                description: >-
                                  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.
                                type: integer
                                default: 5
                              purge_on_removal:
                                description: >-
                                  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.
                                type: boolean
                                default: false
                              query_params:
                                description: >-
                                  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:

                                  ```json

                                  "filter":"sync_gateway/bychannel",

                                  "query_params": {
                                    "channels":["chanUser1"]
                                  },

                                  ```
                                type: array
                                items:
                                  type: string
                              remote:
                                description: >-
                                  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,
                                  `https://localhost:4985/db`.
                                type: string
                              remote_password:
                                description: >-
                                  The password to use to authenticate with the
                                  remote. This password will be redacted in the
                                  replication config.
                                type: string
                              remote_username:
                                description: >-
                                  The username to use to authenticate with the
                                  remote.
                                type: string
                              replication_id:
                                description: >-
                                  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.
                                type: string
                                maximum: 160
                              run_as:
                                description: >-
                                  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.
                                type: string
                              password:
                                description: >-
                                  **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.
                                type: string
                                deprecated: true
                              username:
                                description: >-
                                  **This has been deprecated in favour of
                                  `remote_username`.**


                                  This is the username to use to authenticate
                                  with the remote.
                                type: string
                                deprecated: true
                            required:
                              - direction
                            title: User configurable replication properties
                          - type: object
                            properties:
                              assigned_node:
                                description: >-
                                  The unique ID of the node assigned to the
                                  replication.
                                type: string
                              target_state:
                                description: >-
                                  This is the state that the replicator is in or
                                  that trying to transition in to.
                                type: string
                                enum:
                                  - running
                                  - stopped
                                  - resetting
                                  - error
                                  - starting
                                  - reconnecting
                                x-enumDescriptions:
                                  running: Currently running replication.
                                  stopped: Not running replication.
                                  resetting: The replication is resetting its state.
                                  error: The replication is stopped due to an error.
                                  starting: The replication is starting up.
                                  reconnecting: >-
                                    The replication is reconnecting to the
                                    remote database.
                                title: Replication Status
                              cluster_uuid:
                                description: The cluster unique identifier.
                                type: string
                        title: Replication
                  nodes:
                    description: Map of all Sync Gateway nodes in the cluster.
                    type: object
                    properties:
                      node_uuid:
                        description: The nodes unique identifier.
                        type: object
                        properties:
                          uuid:
                            description: The nodes unique identifier.
                            type: string
                          host:
                            description: The nodes host name.
                            type: string
        version:
          description: >-
            The product version including the build number and edition (ie. `EE`
            or `CE`).


            Blank if `api.hide_product_version=true` in the startup
            configuration.
          type: string
        vendor:
          allOf:
            - description: Product vendor
              type: object
              properties:
                name:
                  description: Product name
                  type: string
                  example: Couchbase Sync Gateway
                version:
                  description: |-
                    API version.
                    Omitted if `api.hide_product_version=true`
                  type: string
                  example: 3.1
              required:
                - name
              title: Vendor
      title: Status
    Database-audit:
      title: Simple
      description: A map of audit events and whether they are enabled or not.
      properties:
        enabled:
          type: boolean
        events:
          type: object
          additionalProperties:
            x-additionalPropertiesName: audit_id
            description: The audit event ID and whether it is enabled or not.
            type: boolean
        disabled_users:
          description: List of users for which audit logging is disabled.
          type: array
          items:
            type: object
            properties:
              domain:
                description: |
                  The domain of the role for which audit logging is disabled.
                enum:
                  - cbs
                  - sgw
                x-enumDescription:
                  cbs: Couchbase Server User
                  sgw: Sync Gateway User
                type: string
              name:
                description: The name of the user for which audit logging is disabled.
                type: string
        disabled_roles:
          description: >-
            List of roles for which audit logging is disabled. Either cbs or
            sgw.
          type: array
          items:
            type: object
            properties:
              domain:
                description: |
                  The domain of the role for which audit logging is disabled.
                enum:
                  - cbs
                  - sgw
                x-enumDescription:
                  cbs: Couchbase Server RBAC
                  sgw: Sync Gateway Role
                type: string
              name:
                description: The name of the role for which audit logging is disabled.
                type: string
    AuditEventVerbose:
      title: audit-event-verbose
      description: Detailed information about an audit event.
      type: object
      properties:
        name:
          type: string
          description: The name of the audit event.
          readOnly: true
        description:
          type: string
          description: The description of the audit event.
          readOnly: true
        enabled:
          type: boolean
          description: Whether this audit event is currently enabled or not.
        filterable:
          type: boolean
          description: >-
            Whether this audit event can be disabled. Some audit events are
            always on.
          readOnly: true
    Database-audit-verbose:
      title: Verbose
      description: A map of detailed audit events.
      properties:
        enabled:
          type: boolean
        events:
          type: object
          additionalProperties:
            x-additionalPropertiesName: audit_id
            description: The audit event ID and whether it is enabled or not.
            title: audit-event-verbose
            type: object
            properties:
              name:
                type: string
                description: The name of the audit event.
                readOnly: true
              description:
                type: string
                description: The description of the audit event.
                readOnly: true
              enabled:
                type: boolean
                description: Whether this audit event is currently enabled or not.
              filterable:
                type: boolean
                description: >-
                  Whether this audit event can be disabled. Some audit events
                  are always on.
                readOnly: true
        disabled_users:
          description: List of users for which audit logging is disabled.
          type: array
          items:
            type: object
            properties:
              domain:
                description: |
                  The domain of the role for which audit logging is disabled.
                enum:
                  - cbs
                  - sgw
                x-enumDescription:
                  cbs: Couchbase Server User
                  sgw: Sync Gateway User
                type: string
              name:
                description: The name of the user for which audit logging is disabled.
                type: string
        disabled_roles:
          description: >-
            List of roles for which audit logging is disabled. Either cbs or
            sgw.
          type: array
          items:
            type: object
            properties:
              domain:
                description: |
                  The domain of the role for which audit logging is disabled.
                enum:
                  - cbs
                  - sgw
                x-enumDescription:
                  cbs: Couchbase Server RBAC
                  sgw: Sync Gateway Role
                type: string
              name:
                description: The name of the role for which audit logging is disabled.
                type: string
    CollectionNames:
      description: List of collection names
      type: array
      items:
        type: string
        example:
          - collection1
          - collection2
    ResyncScopesMap:
      description: >-
        scope name with one or more collection names for which resync will be
        triggered
      type: object
      additionalProperties:
        allOf:
          - description: List of collection names
            type: array
            items:
              type: string
              example:
                - collection1
                - collection2
      example:
        scopeName:
          - collection1
          - collection2
    Resync-status:
      description: The status of a resync operation
      type: object
      properties:
        status:
          description: The status of the current operation.
          type: string
          enum:
            - running
            - completed
            - stopping
            - stopped
            - error
        start_time:
          description: The ISO-8601 date and time the resync operation was started.
          type: string
        last_error:
          description: The last error that occurred in the resync operation (if any).
          type: string
        docs_changed:
          description: >-
            The amount of documents that have been changed as a result of the
            resync operation.
          type: integer
        docs_processed:
          description: >-
            The amount of docs that have been processed so far in the resync
            operation.
          type: integer
        collections_processing:
          description: The collections that the resync operation is running on.
          allOf:
            - description: >-
                scope name with one or more collection names for which resync
                will be triggered
              type: object
              additionalProperties:
                allOf:
                  - description: List of collection names
                    type: array
                    items:
                      type: string
                      example:
                        - collection1
                        - collection2
              example:
                scopeName:
                  - collection1
                  - collection2
      required:
        - status
        - start_time
        - last_error
        - docs_changed
        - docs_processed
      title: Resync-status
    IndexSettings:
      type: object
      description: Settings for Global Secondary Indexes (GSI).
      properties:
        create_separate_principal_indexes:
          description: >-
            Whether to create separate indexes for users and roles instead of a
            single larger syncDocs index.


            The separate principal indexes are smaller and used automatically
            for new database deployments. To remove the syncDocs index, wait for
            this to complete, restart all Sync Gateway instances and run  [POST
            /_post_upgrade](#operation/post__post_upgrade).
          type: boolean
          default: false
        num_partitions:
          description: >-
            The number of partitions to use for the large indexes created by
            Sync Gateway. It is not recommended to set this unless you require
            additional horizontal scalability for individual indexes and have
            appropriately scaled your Query nodes to handle the increased query
            parallelism. If set, the recommended number is 8 and does not need
            to be directly related to the number of your Query nodes. Ensure
            documentation is read to understand the performance tradeoffs and
            instructions for migration if you have previously run with only one
            partition. See [/{db}/_index_init](#operation/post_db-_index_init)
            for more information.


            If not specified or 1, all indexes will be non partitioned.
          type: number
          default: 1
          title: Number of Index Partitions
    IndexInitStatus:
      description: The status of an asynchronous indexes initialization operation.
      type: object
      properties:
        status:
          description: The status of the current operation.
          type: string
          enum:
            - completed
            - error
            - running
            - stopped
            - stopping
          x-enumDescriptions:
            running: Indexes are being created.
            completed: All indexes were created.
            error: The index initialization operation has failed.
            stopped: >-
              The index initialization operation has been stopped. These indexes
              may still exist on Couchbase Server.
            stopping: >-
              The index initialization operation is in the process of being
              stopped.
        start_time:
          description: >-
            The ISO-8601 date and time the index initialization operation was
            started.
          type: string
        last_error:
          description: >-
            The last error that occurred in the index initialization operation
            (if any).
          type: string
        index_status:
          description: >-
            scope name with one or more collection names and the status of their
            index creation
          type: object
          additionalProperties:
            x-additionalPropertiesName: scopename
            description: >-
              An object keyed by scope, containing a set of collections and the
              status of their index creation.
            type: object
            additionalProperties:
              x-additionalPropertiesName: collectionname
              type: string
              enum:
                - queued
                - in progress
                - ready
                - error
              x-enumDescriptions:
                queued: Indexes are queued for creation.
                in progress: Indexes are being created.
                ready: All indexes were created.
                error: The index creation operation has failed.
        settings:
          allOf:
            - type: object
              description: Settings for Global Secondary Indexes (GSI).
              properties:
                create_separate_principal_indexes:
                  description: >-
                    Whether to create separate indexes for users and roles
                    instead of a single larger syncDocs index.


                    The separate principal indexes are smaller and used
                    automatically for new database deployments. To remove the
                    syncDocs index, wait for this to complete, restart all Sync
                    Gateway instances and run  [POST
                    /_post_upgrade](#operation/post__post_upgrade).
                  type: boolean
                  default: false
                num_partitions:
                  description: >-
                    The number of partitions to use for the large indexes
                    created by Sync Gateway. It is not recommended to set this
                    unless you require additional horizontal scalability for
                    individual indexes and have appropriately scaled your Query
                    nodes to handle the increased query parallelism. If set, the
                    recommended number is 8 and does not need to be directly
                    related to the number of your Query nodes. Ensure
                    documentation is read to understand the performance
                    tradeoffs and instructions for migration if you have
                    previously run with only one partition. See
                    [/{db}/_index_init](#operation/post_db-_index_init) for more
                    information.


                    If not specified or 1, all indexes will be non partitioned.
                  type: number
                  default: 1
                  title: Number of Index Partitions
      required:
        - status
        - start_time
        - last_error
        - index_status
      title: IndexInitStatus
    Compact-status:
      description: The status returned from a compaction.
      type: object
      properties:
        status:
          description: The status of the current operation.
          type: string
        start_time:
          description: The ISO-8601 date and time the compact operation was started.
          type: string
        last_error:
          description: The last error that occurred in the compact operation (if any).
          type: string
        docs_purged:
          description: |-
            **Applicable to tombstone compaction only**

            This is the amount of documents that have been purged so far.
          type: string
        marked_attachments:
          description: |-
            **Applicable to attachment compaction only**

            This is the number of references there are to legacy attachments.
          type: string
        purged_attachments:
          description: |-
            **Applicable to attachment compaction only**

            This is the amount of attachments that have been purged so far.
          type: string
        compact_id:
          description: |-
            **Applicable to attachment compaction only**

            This is the ID of the compaction.
          type: string
        phase:
          description: >-
            **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).
          type: string
        dry_run:
          description: |
            **Applicable to attachment compaction only**
          type: string
          enum:
            - mark
            - sweep
            - cleanup
      required:
        - status
        - start_time
        - last_error
      title: Compact-status
    Attachment-Migration-status:
      description: The status of a attachment migration operation
      type: object
      properties:
        status:
          description: The status of the current attachment migration operation.
          type: string
          enum:
            - running
            - completed
            - stopping
            - stopped
            - error
        start_time:
          description: >-
            The ISO-8601 date and time the attachment migration operation was
            started.
          type: string
        last_error:
          description: >-
            The last error that occurred in the attachment migration operation
            (if any).
          type: string
        migration_id:
          description: The UUID given to the attachment migration operation.
          type: string
        docs_changed:
          description: >-
            The amount of documents that have had attachment metadata migrated
            as a result of attachment migration operation.
          type: integer
        docs_processed:
          description: >-
            The amount of docs that have been processed through the attachment
            migration operation.
          type: integer
        docs_failed:
          description: >-
            The amount of docs that have failed to be processed through the
            attachment migration operation.
          type: integer
      required:
        - status
        - start_time
        - last_error
        - docs_changed
        - docs_processed
      title: Attachment-Migration-status
    Document:
      description: The configurable Sync Gateway properties of a document.
      type: object
      additionalProperties: true
      properties:
        _id:
          description: The ID of the document.
          type: string
        _rev:
          description: The revision of the document.
          type: string
        _exp:
          description: >-
            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.
          type: string
        _deleted:
          description: >-
            Whether the document is a tombstone or not. If true, it is a
            tombstone.
          type: boolean
        _revisions:
          type: object
          properties:
            start:
              description: Prefix number for the latest revision.
              type: number
            ids:
              description: >-
                Array of valid Revision Tree IDs, in reverse order (latest
                first).
              type: array
              items:
                type: string
        _attachments:
          type: object
          additionalProperties:
            x-additionalPropertiesName: attachmentname
            description: The name of the attachment.
            type: object
            properties:
              content_type:
                description: Content type of the attachment.
                type: string
              data:
                description: The data in the attachment in base64.
                type: string
    New-revision:
      description: Properties returned when a new document revision is created
      type: object
      properties:
        id:
          description: The ID of the document.
          type: string
        ok:
          description: Whether the request completed successfully.
          type: boolean
        rev:
          description: The Revision Tree ID of the document.
          type: string
        cv:
          description: The CV of the document.
          type: string
      required:
        - id
        - ok
        - rev
      title: New-revision
    ExpVars:
      type: object
      properties:
        cmdline:
          description: >-
            Built-in variables from the Go runtime, lists the command-line
            arguments
          type: object
        memstats:
          description: >-
            Dumps a large amount of information about the memory heap and
            garbage collector
          type: object
        cb:
          description: Variables reported by the Couchbase SDK (go_couchbase package)
          type: object
        mc:
          description: >-
            Variables reported by the low-level memcached API (gomemcached
            package)
          type: object
        syncGateway_changeCache:
          type: object
          properties:
            maxPending:
              description: >-
                Max number of sequences waiting on a missing earlier sequence
                number
              type: object
            lag-tap-0000ms:
              description: Histogram of delay from doc save till it shows up in Tap feed
              type: object
            lag-queue-0000ms:
              description: >-
                Histogram of delay from Tap feed till doc is posted to changes
                feed
              type: object
            lag-total-0000ms:
              description: >-
                Histogram of total delay from doc save till posted to changes
                feed
              type: object
            outOfOrder:
              description: Number of out-of-order sequences posted
              type: object
            view_queries:
              description: Number of queries to channels view
              type: object
        syncGateway_db:
          type: object
          properties:
            channelChangesFeeds:
              description: >-
                Number of calls to db.changesFeed, i.e. generating a changes
                feed for a single channel.
              type: object
            channelLogAdds:
              description: Number of entries added to channel logs
              type: object
            channelLogAppends:
              description: >-
                Number of times entries were written to channel logs using an
                APPEND operation
              type: object
            channelLogCacheHits:
              description: >-
                Number of requests for channel-logs that were fulfilled from the
                in-memory cache
              type: object
            channelLogRewrites:
              description: >-
                Number of times entries were written to channel logs using a SET
                operation (rewriting the entire log)
              type: object
            channelLogRewriteCollisions:
              description: >-
                Number of collisions while attempting to rewrite channel logs
                using SET
              type: object
            document_gets:
              description: Number of times a document was read from the database
              type: object
            revisionCache_adds:
              description: Number of revisions added to the revision cache
              type: object
            revisionCache_hits:
              description: Number of times a revision-cache lookup succeeded
              type: object
            revisionCache_misses:
              description: Number of times a revision-cache lookup failed
              type: object
            revs_added:
              description: Number of revisions added to the database (including deletions)
              type: object
            sequence_gets:
              description: Number of times the database's lastSequence was read
              type: object
            sequence_reserves:
              description: Number of times the database's lastSequence was incremented
              type: object
        syncgateway:
          description: Monitoring stats
          type: object
          properties:
            global:
              description: Global Sync Gateway stats
              type: object
              properties:
                resource_utilization:
                  description: Resource utilization stats
                  type: object
                  properties:
                    admin_net_bytes_recv:
                      type: integer
                      description: >-
                        The total number of bytes received (since node start-up)
                        on the network interface to which the Sync Gateway
                        api.admin_interface is bound.
                    admin_net_bytes_sent:
                      type: integer
                      description: >-
                        The total number of bytes sent (since node start-up) on
                        the network interface to which the Sync Gateway
                        api.admin_interface is bound.
                    error_count:
                      type: integer
                      description: The total number of errors logged.
                    go_memstats_heapalloc:
                      type: integer
                      description: >-
                        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).
                    go_memstats_heapidle:
                      type: integer
                      description: >-
                        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.
                    go_memstats_heapinuse:
                      type: integer
                      description: >-
                        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.
                    go_memstats_heapreleased:
                      type: integer
                      description: >-
                        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.
                    go_memstats_pausetotalns:
                      type: integer
                      description: >-
                        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.
                    go_memstats_stackinuse:
                      type: integer
                      description: >-
                        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).
                    go_memstats_stacksys:
                      type: integer
                      description: >-
                        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).
                    go_memstats_sys:
                      type: integer
                      description: >-
                        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.
                    goroutines_high_watermark:
                      type: integer
                      description: Peak number of go routines since process start.
                    num_goroutines:
                      type: integer
                      description: The total number of goroutines.
                    num_idle_kv_ops:
                      type: integer
                      description: The total number of idle kv operations.
                    num_idle_query_ops:
                      type: integer
                      description: The total number of idle query operations.
                    process_cpu_percent_utilization:
                      type: number
                      format: float
                      description: >-
                        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.
                    node_cpu_percent_utilization:
                      type: number
                      format: float
                      description: >-
                        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.
                    process_memory_resident:
                      type: integer
                      description: >-
                        The memory utilization (Resident Set Size) for the
                        process, in bytes.
                    pub_net_bytes_recv:
                      type: integer
                      description: >-
                        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
                    pub_net_bytes_sent:
                      type: integer
                      description: >-
                        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.
                    system_memory_total:
                      type: integer
                      description: The total memory available on the system in bytes.
                    warn_count:
                      type: integer
                      description: The total number of warnings logged.
                    uptime:
                      type: integer
                      description: The total uptime.
            per_db:
              description: >-
                This array contains stats for all databases declared in the
                config file &mdash; see [View Statistics and
                Metrics](stats-monitoring.html) for more details on the metrics
                collected and reported by Sync Gateway.


                The statistics for each 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`
              type: array
              items:
                type: object
                properties:
                  cache:
                    type: object
                  database:
                    type: object
                  per_replication:
                    type: object
                  collections:
                    type: object
                  security:
                    type: object
            per_replication:
              description: >-
                An array of stats for each replication declared in the config
                file

                **Deprecated @ 2.8**: used only by inter-sync-gateway
                replications version 1.
              type: array
              items:
                type: object
                description: Stats for a given replication_id
                properties:
                  $replication_id:
                    type: object
                    properties:
                      sgr_active:
                        description: >-
                          Whether the replication is active at this time.

                          **Deprecated @ 2.8**: used only by inter-sync-gateway
                          replications version 1.
                        type: boolean
                      sgr_docs_checked_sent:
                        description: >-
                          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.
                        type: integer
                      sgr_num_attachments_transferred:
                        description: >-
                          The total number of attachments transferred since
                          replication started.

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

                          **Deprecated @ 2.8**: used only by inter-sync-gateway
                          replications version 1.
                        type: integer
                      sgr_num_docs_failed_to_push:
                        description: >-
                          The total number of documents that failed to be pushed
                          since replication started.

                          Used by versions 1 and 2.
                        type: integer
                      sgr_num_docs_pushed:
                        description: >-
                          The total number of documents that were pushed since
                          replication started.

                          Used by versions 1 and 2.
                        type: integer
              deprecated: true
    NodeInfo:
      type: object
      properties:
        ADMIN:
          description: '`true` if the request is from the Admin API - otherwise omitted.'
          type: boolean
          example: true
        couchdb:
          description: CouchDB welcome
          type: string
          example: Welcome
        vendor:
          allOf:
            - description: Product vendor
              type: object
              properties:
                name:
                  description: Product name
                  type: string
                  example: Couchbase Sync Gateway
                version:
                  description: |-
                    API version.
                    Omitted if `api.hide_product_version=true`
                  type: string
                  example: 3.1
              required:
                - name
              title: Vendor
        version:
          description: >-
            Product version, including the build number and edition (i.e. `EE`
            or `CE`)

            Omitted if `api.hide_product_version=true`
          type: string
          example: Couchbase Sync Gateway/3.1.0(1;a765231) EE
        persistent_config:
          description: >-
            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.
          type: boolean
          example: true
      required:
        - couchdb
        - vendor
    Changes-feed:
      description: Properties of a changes feed
      type: object
      properties:
        results:
          type: array
          items:
            type: object
            properties:
              seq:
                description: The change sequence number.
                type: number
              id:
                description: The document ID the change happened on.
                type: string
              changes:
                description: >-
                  List of document leafs with each leaf containing only a `rev`
                  or `cv` field.
                type: array
                items:
                  oneOf:
                    - type: object
                      properties:
                        rev:
                          description: >-
                            The Revision Tree ID associated with the change.
                            This may be returned even when the `version_type`
                            preference is set to `cv` if this document was an
                            old revision written prior to upgrading to SG 4.0+
                          type: string
                      title: Revision Tree ID
                    - type: object
                      properties:
                        cv:
                          description: >-
                            The Current Version associated with the change. This
                            value requires the `version_type` preference set to
                            `cv` and this document revision being written
                            through SG 4.0+
                          type: string
                      title: Current Version
                uniqueItems: true
          uniqueItems: true
        last_seq:
          description: The last change sequence number.
          type: string
    Design-doc:
      description: Properties of a design document
      type: object
      properties:
        language:
          type: string
        views:
          type: object
          additionalProperties:
            x-additionalPropertiesName: viewname
            description: The name of the view.
            type: object
            properties:
              map:
                type: string
              reduce:
                type: string
        options:
          type: object
          properties:
            local_seq:
              type: string
            include_design:
              type: string
            raw:
              type: string
            index_xattr_on_deleted_docs:
              type: string
    OIDC-callback:
      type: object
      properties:
        id_token:
          description: The OpenID Connect ID token
          type: string
        refresh_token:
          description: The OpenID Connect ID refresh token
          type: string
        session_id:
          description: The Sync Gateway session token
          type: string
        name:
          description: The Sync Gateway user
          type: string
        access_token:
          description: The OpenID Connect access token
          type: string
        token_type:
          description: The OpenID Connect ID token type
          type: string
        expires_in:
          description: The time until the id_token expires (TTL).
          type: number
      title: OpenID Connect callback properties
    OIDC-token:
      description: >-
        Properties expected back from an OpenID Connect provider after
        successful authentication
      type: object
      properties:
        access_token:
          type: string
        token_type:
          type: string
        refresh_token:
          type: string
        expires_in:
          type: string
        id_token:
          type: string
      title: OIDC-token
    OIDC-login-page-handler:
      description: Properties passed from the OpenID Connect mock login page to the handler
      type: object
      properties:
        username:
          type: string
        tokenttl:
          type: string
        identity-token-formats:
          type: string
        authenticated:
          type: string
      required:
        - username
        - tokenttl
        - identity-token-formats
        - authenticated
    DeprecatedLogKeyMap:
      description: A map of log keys and whether they are enabled or not.
      type: object
      example:
        HTTP: true
        CRUD: false
        Changes: true
      additionalProperties:
        description: The log key and whether it is enabled or not.
        type: boolean
  responses:
    User-session-information:
      description: Properties associated with a user session
      content:
        application/json:
          schema:
            type: object
            properties:
              authentication_handlers:
                description: >-
                  The ways authentication can be established to authenticate as
                  a user. Used for CouchDB compatibility. Always contains
                  "default" and "cookie".
                type: array
                enum:
                  - - default
                    - cookie
                default:
                  - default
                  - cookie
              ok:
                description: Used for CouchDB compatibility. Always true.
                type: boolean
                enum:
                  - true
              userCtx:
                type: object
                properties:
                  channels:
                    description: >-
                      A map of the channels in the default collection that the
                      user is in along with the sequence number the user was
                      granted access. This does not include inherited channels
                      through roles.
                    type: object
                    additionalProperties:
                      x-additionalPropertiesName: channelName
                      type: number
                      minimum: 1
                      description: The sequence number the user was granted access.
                      title: sequence number
                    example:
                      '!': 1
                      channelA: 2
                  name:
                    description: The name of the user.
                    type: string
                    minLength: 1
                required:
                  - channels
                  - name
            required:
              - authentication_handlers
              - ok
              - userCtx
            title: User Session Information
    Not-found:
      description: Resource could not be found
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                description: The error name.
                type: string
              reason:
                description: The error description.
                type: string
            required:
              - error
              - reason
            title: HTTP-Error
          example:
            error: not_found
            reason: no such database "invalid-db"
    Unauthorized:
      description: 'User does not have access to resource, or resource does not exist'
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                description: The error name.
                type: string
              reason:
                description: The error description.
                type: string
            required:
              - error
              - reason
            title: HTTP-Error
    request-problem:
      description: There was a problem with your request
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                description: The error name.
                type: string
              reason:
                description: The error description.
                type: string
            required:
              - error
              - reason
            title: HTTP-Error
    Conflict:
      description: Resource already exists under that name
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                description: The error name.
                type: string
              reason:
                description: The error description.
                type: string
            required:
              - error
              - reason
            title: HTTP-Error
    User:
      description: Properties associated with a user
      content:
        application/json:
          schema:
            description: Properties associated with a user
            type: object
            properties:
              name:
                description: >-
                  The name of the user.


                  User names can only have alphanumeric ASCII characters and
                  underscores.
                type: string
              password:
                description: >-
                  The password of the user.


                  Mandatory. unless `allow_empty_password` is `true` in the
                  database configs.
                type: string
              admin_channels:
                description: >-
                  A list of channels to explicitly grant to the user for the
                  default collection.

                  See `collection_access` for channels in named collections.
                type: array
                items:
                  type: string
              all_channels:
                description: >-
                  All the channels that the user has been granted access to for
                  the default collection.

                  See `collection_access` for channels in named collections.


                  Access could have been granted through the sync function,
                  roles, or explicitly on the user under the `admin_channels`
                  property.
                type: array
                items:
                  type: string
                readOnly: true
              email:
                description: The email address of the user.
                type: string
              disabled:
                description: >-
                  If true, the user will not be able to login to the account as
                  it is disabled.
                type: boolean
                default: false
              admin_roles:
                description: A list of roles to explicitly grant to the user.
                type: array
                items:
                  type: string
              roles:
                description: >-
                  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.
                type: array
                items:
                  type: string
                readOnly: true
              jwt_roles:
                description: The roles that the user has been added to through roles_claim.
                type: array
                items:
                  type: string
                readOnly: true
              jwt_channels:
                description: >-
                  The channels that the user has been granted access to through
                  channels_claim for the default collection.
                type: array
                items:
                  type: string
                readOnly: true
              jwt_issuer:
                description: >-
                  The issuer of the last JSON Web Token that the user last used
                  to sign in.
                type: string
                readOnly: true
              jwt_last_updated:
                description: The last time that the user's JWT roles/channels were updated.
                type: string
                format: date-time
                readOnly: true
              collection_access:
                description: >-
                  A set of access grants by scope and collection for a specific
                  collection.
                type: object
                additionalProperties:
                  maxProperties: 1
                  description: 'An object keyed by scope, containing a set of collections.'
                  type: object
                  x-additionalPropertiesName: scopename
                  additionalProperties:
                    description: >-
                      An object keyed by collection name, defines access
                      collections in this scope.
                    type: object
                    x-additionalPropertiesName: collectionname
                    properties:
                      admin_channels:
                        description: >-
                          A list of channels to explicitly grant to the user in
                          this collection.
                        type: array
                        items:
                          type: string
                      all_channels:
                        description: >-
                          All the channels that the user has been granted access
                          to in this collection.


                          Access could have been granted through the sync
                          function, roles, or explicitly on the user under the
                          `admin_channels` property.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_channels:
                        description: >-
                          The channels that the user has been granted access to
                          through channels_claim for this collection.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_last_updated:
                        description: >-
                          The last time that the user's JWT channels were
                          updated for this collection.
                        type: string
                        format: date-time
                        readOnly: true
            title: User
    Role:
      description: Properties associated with a role
      content:
        application/json:
          schema:
            description: Properties associated with a role
            type: object
            properties:
              name:
                description: >-
                  The name of the role.


                  Role names can only have alphanumeric ASCII characters and
                  underscores.
                type: string
              admin_channels:
                description: >-
                  A list of channels to explicitly grant to the role for the
                  default collection.

                  See `collection_access` for channels in named collections.
                type: array
                items:
                  type: string
              all_channels:
                description: >-
                  All the channels that the role has been granted access to for
                  the default collection.


                  These channels could have been assigned by the Sync function
                  or using the `admin_channels` property.
                type: array
                items:
                  type: string
                readOnly: true
              collection_access:
                description: >-
                  A set of access grants by scope and collection for a specific
                  collection.
                type: object
                additionalProperties:
                  maxProperties: 1
                  description: 'An object keyed by scope, containing a set of collections.'
                  type: object
                  x-additionalPropertiesName: scopename
                  additionalProperties:
                    description: >-
                      An object keyed by collection name, defines access
                      collections in this scope.
                    type: object
                    x-additionalPropertiesName: collectionname
                    properties:
                      admin_channels:
                        description: >-
                          A list of channels to explicitly grant to the user in
                          this collection.
                        type: array
                        items:
                          type: string
                      all_channels:
                        description: >-
                          All the channels that the user has been granted access
                          to in this collection.


                          Access could have been granted through the sync
                          function, roles, or explicitly on the user under the
                          `admin_channels` property.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_channels:
                        description: >-
                          The channels that the user has been granted access to
                          through channels_claim for this collection.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_last_updated:
                        description: >-
                          The last time that the user's JWT channels were
                          updated for this collection.
                        type: string
                        format: date-time
                        readOnly: true
            title: Role
    Replicator-updated:
      description: Updated existing configuration successfully
    Replicator-created:
      description: Created new replication successfully
    pprof-binary:
      description: OK
      content:
        application/octet-stream:
          schema:
            description: pprof binary data
            type: string
            example: pprof binary data
    DB-config-updated:
      description: Database configuration successfully updated
      headers:
        Etag:
          schema:
            type: string
          description: The new database configuration revision.
    DB-config-precondition-failed:
      description: >-
        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.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                description: The error name.
                type: string
              reason:
                description: The error description.
                type: string
            required:
              - error
              - reason
            title: HTTP-Error
          example:
            error: Precondition Failed
            reason: Provided If-Match header does not match current config version
    Invalid-content-type:
      description: Invalid content type
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                description: The error name.
                type: string
              reason:
                description: The error description.
                type: string
            required:
              - error
              - reason
            title: HTTP-Error
    changes-feed:
      description: Successfully returned the changes feed
      content:
        application/json:
          schema:
            description: Properties of a changes feed
            type: object
            properties:
              results:
                type: array
                items:
                  type: object
                  properties:
                    seq:
                      description: The change sequence number.
                      type: number
                    id:
                      description: The document ID the change happened on.
                      type: string
                    changes:
                      description: >-
                        List of document leafs with each leaf containing only a
                        `rev` or `cv` field.
                      type: array
                      items:
                        oneOf:
                          - type: object
                            properties:
                              rev:
                                description: >-
                                  The Revision Tree ID associated with the
                                  change. This may be returned even when the
                                  `version_type` preference is set to `cv` if
                                  this document was an old revision written
                                  prior to upgrading to SG 4.0+
                                type: string
                            title: Revision Tree ID
                          - type: object
                            properties:
                              cv:
                                description: >-
                                  The Current Version associated with the
                                  change. This value requires the `version_type`
                                  preference set to `cv` and this document
                                  revision being written through SG 4.0+
                                type: string
                            title: Current Version
                      uniqueItems: true
                uniqueItems: true
              last_seq:
                description: The last change sequence number.
                type: string
    ddoc-forbidden:
      description: >-
        Forbidden access possibly due to not using the Admin API or the design
        document is a built-in Sync Gateway one.
    invalid-doc-id:
      description: >-
        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 ("_").
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                description: The error name.
                type: string
              reason:
                description: The error description.
                type: string
            required:
              - error
              - reason
            title: HTTP-Error
    New-revision:
      description: New revision created successfully
      content:
        application/json:
          schema:
            description: Properties returned when a new document revision is created
            type: object
            properties:
              id:
                description: The ID of the document.
                type: string
              ok:
                description: Whether the request completed successfully.
                type: boolean
              rev:
                description: The Revision Tree ID of the document.
                type: string
              cv:
                description: The CV of the document.
                type: string
            required:
              - id
              - ok
              - rev
            title: New-revision
    all-docs:
      description: Operation ran successfully
      content:
        application/json:
          schema:
            type: object
            properties:
              rows:
                type: array
                items:
                  type: object
                  properties:
                    key:
                      type: string
                    id:
                      type: string
                    value:
                      type: object
                      properties:
                        rev:
                          type: string
                        cv:
                          type: string
                uniqueItems: true
              total_rows:
                type: number
              update_seq:
                type: number
            required:
              - rows
              - total_rows
              - update_seq
    OIDC-invalid-provider:
      description: >-
        The provider provided is not defined in the Sync Gateway config. If no
        provided was specified then there is no default provider set. 
    OIDC-connection:
      description: >-
        Unable to connect and validate with the OpenID Connect provider
        requested
    OIDC-callback:
      description: Successfully authenticated with OpenID Connect.
      content:
        application/json:
          schema:
            type: object
            properties:
              id_token:
                description: The OpenID Connect ID token
                type: string
              refresh_token:
                description: The OpenID Connect ID refresh token
                type: string
              session_id:
                description: The Sync Gateway session token
                type: string
              name:
                description: The Sync Gateway user
                type: string
              access_token:
                description: The OpenID Connect access token
                type: string
              token_type:
                description: The OpenID Connect ID token type
                type: string
              expires_in:
                description: The time until the id_token expires (TTL).
                type: number
            title: OpenID Connect callback properties
    OIDC-test-provider-disabled:
      description: >-
        The OpenID Connect unsupported config option `oidc_test_provider` is not
        enabled. To use this endpoint, this option must be enabled.
    OIDC-invalid-scope:
      description: A validation error occurred with the scope.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                description: The error name.
                type: string
              reason:
                description: The error description.
                type: string
            required:
              - error
              - reason
            title: HTTP-Error
    OIDC-testing-internal-error:
      description: An error occurred.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                description: The error name.
                type: string
              reason:
                description: The error description.
                type: string
            required:
              - error
              - reason
            title: HTTP-Error
    OIDC-token:
      description: >-
        Properties expected back from an OpenID Connect provider after
        successful authentication
      content:
        application/json:
          schema:
            description: >-
              Properties expected back from an OpenID Connect provider after
              successful authentication
            type: object
            properties:
              access_token:
                type: string
              token_type:
                type: string
              refresh_token:
                type: string
              expires_in:
                type: string
              id_token:
                type: string
            title: OIDC-token
    OIDC-testing-redirect:
      description: Redirecting to Sync Gateway OpenID Connect callback URL
      headers:
        Location:
          schema:
            type: string
          description: The location to the Sync Gateway OpenID Connect callback URL.
    Invalid-CORS-LoginOrigin:
      description: >-
        Value of `Origin` is not in the approved list of allowed origins in
        `LoginOrigin` of Sync Gateway bootstrap or database configuration.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                description: The error name.
                type: string
              reason:
                description: The error description.
                type: string
            required:
              - error
              - reason
            title: HTTP-Error
          example:
            error: Bad Request
            reason: No CORS
  requestBodies:
    User:
      content:
        application/json:
          schema:
            description: Properties associated with a user
            type: object
            properties:
              name:
                description: >-
                  The name of the user.


                  User names can only have alphanumeric ASCII characters and
                  underscores.
                type: string
              password:
                description: >-
                  The password of the user.


                  Mandatory. unless `allow_empty_password` is `true` in the
                  database configs.
                type: string
              admin_channels:
                description: >-
                  A list of channels to explicitly grant to the user for the
                  default collection.

                  See `collection_access` for channels in named collections.
                type: array
                items:
                  type: string
              all_channels:
                description: >-
                  All the channels that the user has been granted access to for
                  the default collection.

                  See `collection_access` for channels in named collections.


                  Access could have been granted through the sync function,
                  roles, or explicitly on the user under the `admin_channels`
                  property.
                type: array
                items:
                  type: string
                readOnly: true
              email:
                description: The email address of the user.
                type: string
              disabled:
                description: >-
                  If true, the user will not be able to login to the account as
                  it is disabled.
                type: boolean
                default: false
              admin_roles:
                description: A list of roles to explicitly grant to the user.
                type: array
                items:
                  type: string
              roles:
                description: >-
                  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.
                type: array
                items:
                  type: string
                readOnly: true
              jwt_roles:
                description: The roles that the user has been added to through roles_claim.
                type: array
                items:
                  type: string
                readOnly: true
              jwt_channels:
                description: >-
                  The channels that the user has been granted access to through
                  channels_claim for the default collection.
                type: array
                items:
                  type: string
                readOnly: true
              jwt_issuer:
                description: >-
                  The issuer of the last JSON Web Token that the user last used
                  to sign in.
                type: string
                readOnly: true
              jwt_last_updated:
                description: The last time that the user's JWT roles/channels were updated.
                type: string
                format: date-time
                readOnly: true
              collection_access:
                description: >-
                  A set of access grants by scope and collection for a specific
                  collection.
                type: object
                additionalProperties:
                  maxProperties: 1
                  description: 'An object keyed by scope, containing a set of collections.'
                  type: object
                  x-additionalPropertiesName: scopename
                  additionalProperties:
                    description: >-
                      An object keyed by collection name, defines access
                      collections in this scope.
                    type: object
                    x-additionalPropertiesName: collectionname
                    properties:
                      admin_channels:
                        description: >-
                          A list of channels to explicitly grant to the user in
                          this collection.
                        type: array
                        items:
                          type: string
                      all_channels:
                        description: >-
                          All the channels that the user has been granted access
                          to in this collection.


                          Access could have been granted through the sync
                          function, roles, or explicitly on the user under the
                          `admin_channels` property.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_channels:
                        description: >-
                          The channels that the user has been granted access to
                          through channels_claim for this collection.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_last_updated:
                        description: >-
                          The last time that the user's JWT channels were
                          updated for this collection.
                        type: string
                        format: date-time
                        readOnly: true
            title: User
      description: Properties associated with a user
    Role:
      content:
        application/json:
          schema:
            description: Properties associated with a role
            type: object
            properties:
              name:
                description: >-
                  The name of the role.


                  Role names can only have alphanumeric ASCII characters and
                  underscores.
                type: string
              admin_channels:
                description: >-
                  A list of channels to explicitly grant to the role for the
                  default collection.

                  See `collection_access` for channels in named collections.
                type: array
                items:
                  type: string
              all_channels:
                description: >-
                  All the channels that the role has been granted access to for
                  the default collection.


                  These channels could have been assigned by the Sync function
                  or using the `admin_channels` property.
                type: array
                items:
                  type: string
                readOnly: true
              collection_access:
                description: >-
                  A set of access grants by scope and collection for a specific
                  collection.
                type: object
                additionalProperties:
                  maxProperties: 1
                  description: 'An object keyed by scope, containing a set of collections.'
                  type: object
                  x-additionalPropertiesName: scopename
                  additionalProperties:
                    description: >-
                      An object keyed by collection name, defines access
                      collections in this scope.
                    type: object
                    x-additionalPropertiesName: collectionname
                    properties:
                      admin_channels:
                        description: >-
                          A list of channels to explicitly grant to the user in
                          this collection.
                        type: array
                        items:
                          type: string
                      all_channels:
                        description: >-
                          All the channels that the user has been granted access
                          to in this collection.


                          Access could have been granted through the sync
                          function, roles, or explicitly on the user under the
                          `admin_channels` property.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_channels:
                        description: >-
                          The channels that the user has been granted access to
                          through channels_claim for this collection.
                        type: array
                        items:
                          type: string
                        readOnly: true
                      jwt_last_updated:
                        description: >-
                          The last time that the user's JWT channels were
                          updated for this collection.
                        type: string
                        format: date-time
                        readOnly: true
            title: Role
      description: Properties associated with a role
    Replication-upsert:
      content:
        application/json:
          schema:
            description: Properties of a replication
            type: object
            x-requirePropertiesSorted: true
            properties:
              adhoc:
                description: >-
                  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.
                type: boolean
                default: false
              batch_size:
                description: >-
                  The amount of changes to be sent in one batch of replications.
                  Changing this is an Enterprise Edition only feature.
                type: integer
                default: 200
              collections_enabled:
                description: >-
                  If true, the replicator will run with collections, and will
                  replicate all collections, unless otherwise limited by
                  `collections_local`.


                  If false, the replicator will only replicate the default
                  collection.
                type: boolean
                default: false
              collections_local:
                description: >-
                  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.
                type: array
                items:
                  type: string
                example:
                  - scope1.collection1
                  - scope1.collection3
                  - scope1.collection6
                default: []
              collections_remote:
                description: >-
                  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.
                type: array
                items:
                  type: string
                  nullable: true
                example:
                  - scope1.collectionA
                  - null
                  - scope1.collectionF
                default: []
              conflict_resolution_type:
                description: >-
                  This defines what conflict resolution policy Sync Gateway
                  should use to apply when resolving conflicting revisions.


                  Changing this is an Enterprise Edition only feature.
                type: string
                default: default
                enum:
                  - default
                  - remoteWins
                  - localWins
                  - custom
                x-enumDescriptions:
                  default: |-
                    This will use:
                      - Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
                      - The revision with the most recent timestamp wins.
                      - If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
                  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.
              continuous:
                description: >-
                  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.
                type: boolean
                default: false
              custom_conflict_resolver:
                description: >-
                  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 document's body. This can
                  be the winning revision (for example, `return
                  conflict.LocalDocument`), a new body, or `nil` to resolve as a
                  delete.


                  Example:


                  ```javascript

                  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.


                  If a document merge is being done, the `_rev` and `_cv`
                  properties should not be included in the returned document
                  body as Sync Gateway will generate new values for these.


                  This is an Enterprise Edition only feature.
                type: string
                default: ''
              direction:
                description: >-
                  This specifies which direction the replication will be
                  replicating with the `remote` replicator.
                type: string
                enum:
                  - push
                  - pull
                  - pushAndPull
                x-enumDescriptions:
                  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
              enable_delta_sync:
                description: >-
                  This will turn on delta-sync for the replication. In order to
                  enable delta-sync for a replication, the database level
                  setting `delta_sync.enabled` must also be set to true.


                  Using delta-sync is an Enterprise Edition only feature.
                type: boolean
                default: false
              filter:
                description: This defines whether to filter documents.
                type: string
                enum:
                  - sync_gateway/bychannel
                  - ''
                x-enumDescriptions:
                  '': Do not filter any documents.
                  sync_gateway/bychannel: >-
                    If set, a pull replication will be limited to a specific set
                    of channels specified by the `query_param.channels`
                    property.
              initial_state:
                description: >-
                  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`.
                type: string
                default: running
                enum:
                  - running
                  - stopped
                x-enumDescriptions:
                  running: The replication will immediately start running.
                  stopped: >-
                    The replication configuration will be created but the
                    replication will not start running until the user explicitly
                    starts it.
              max_backoff_time:
                description: >-
                  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.
                type: integer
                default: 5
              purge_on_removal:
                description: >-
                  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.
                type: boolean
                default: false
              query_params:
                description: >-
                  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:

                  ```json

                  "filter":"sync_gateway/bychannel",

                  "query_params": {
                    "channels":["chanUser1"]
                  },

                  ```
                type: array
                items:
                  type: string
              remote:
                description: >-
                  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, `https://localhost:4985/db`.
                type: string
              remote_password:
                description: >-
                  The password to use to authenticate with the remote. This
                  password will be redacted in the replication config.
                type: string
              remote_username:
                description: The username to use to authenticate with the remote.
                type: string
              replication_id:
                description: >-
                  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.
                type: string
                maximum: 160
              run_as:
                description: >-
                  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.
                type: string
              password:
                description: >-
                  **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.
                type: string
                deprecated: true
              username:
                description: |-
                  **This has been deprecated in favour of `remote_username`.**

                  This is the username to use to authenticate with the remote.
                type: string
                deprecated: true
            required:
              - direction
            title: User configurable replication properties
      description: >-
        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.
    Profile:
      content:
        application/json:
          schema:
            type: object
            properties:
              file:
                description: This is the file to output the pprof profile at.
                type: string
    OIDC-login-page-handler:
      content:
        application/json:
          schema:
            description: >-
              Properties passed from the OpenID Connect mock login page to the
              handler
            type: object
            properties:
              username:
                type: string
              tokenttl:
                type: string
              identity-token-formats:
                type: string
              authenticated:
                type: string
            required:
              - username
              - tokenttl
              - identity-token-formats
              - authenticated
      description: Properties passed from the OpenID Connect mock login page to the handler

