diff --git a/modules/ROOT/assets/attachments/bundled-admin.yaml b/modules/ROOT/assets/attachments/bundled-admin.yaml index 2beae56c..1230a8de 100644 --- a/modules/ROOT/assets/attachments/bundled-admin.yaml +++ b/modules/ROOT/assets/attachments/bundled-admin.yaml @@ -54,7 +54,7 @@ paths: - name: db in: path required: true - schema: &ref_3 + schema: &ref_2 type: string example: db1 description: The name of the database to run the operation against. @@ -64,35 +64,55 @@ paths: responses: '200': description: Properties associated with a user session - content: &ref_4 + content: &ref_3 application/json: schema: type: object - properties: &ref_119 + properties: &ref_120 authentication_handlers: - description: The ways authentication can be established to authenticate as the user. + description: The ways authentication can be established to authenticate as a user. Used for CouchDB compatibility. Always contains "default" and "cookie". type: array - items: - type: string + 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 the user has access to and the sequence number each channel was created at. - - The key is the channel name and the value is the sequence number. + 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 - nullable: true + minLength: 1 + required: + - channels + - name + required: &ref_121 + - authentication_handlers + - ok + - userCtx title: User Session Information '404': description: Resource could not be found - content: &ref_2 + content: &ref_4 application/json: schema: type: object @@ -160,9 +180,9 @@ paths: session_id: c5af80a039db4ed9d2b6865576b6999935282689 expires: '2022-01-21T15:24:44Z' cookie_name: SyncGatewaySession - '400': - description: Origin is not in the approved list of allowed origins - content: &ref_106 + '401': + description: User does not have access to resource, or resource does not exist + content: &ref_150 application/json: schema: type: object @@ -170,8 +190,17 @@ paths: required: *ref_1 title: HTTP-Error '404': - description: Resource could not be found - content: *ref_2 + description: Return if database does not exist + content: + application/json: + schema: + type: object + properties: *ref_0 + required: *ref_1 + title: HTTP-Error + example: + error: not_found + reason: no such database "invalid-db" tags: - Session operationId: post_db-_session @@ -180,7 +209,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. - name: sessionid @@ -202,10 +231,10 @@ paths: responses: '200': description: Properties associated with a user session - content: *ref_4 + content: *ref_3 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Session operationId: get_db-_session-sessionid @@ -223,7 +252,7 @@ paths: description: Successfully removed the user session '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Session operationId: delete_db-_session-sessionid @@ -273,7 +302,7 @@ paths: - name: include_doc in: query required: false - schema: &ref_111 + schema: &ref_112 type: string description: Include the body associated with the document. - name: redact @@ -388,7 +417,7 @@ paths: title: HTTP-Error '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document operationId: get_keyspace-_raw-docid @@ -435,7 +464,7 @@ paths: example: digraph graphname{"1-d4d949b7feafc8c31215684baa45b6cd" -> "2-4f3f24143ea43d85a9a340ac016fdfc4"; } '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Unsupported operationId: get_keyspace-_revtree-docid @@ -444,7 +473,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -524,7 +553,7 @@ paths: type: boolean '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Management operationId: get_db- @@ -548,7 +577,7 @@ paths: properties: {} '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '500': description: Cannot remove database from bucket content: @@ -574,7 +603,7 @@ paths: description: Database exists '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Management operationId: head_db- @@ -597,7 +626,7 @@ paths: in: query required: false description: If set, will not attempt to validate the configured OpenID Connect providers are reachable. - schema: &ref_41 + schema: &ref_42 type: boolean default: false requestBody: @@ -608,7 +637,7 @@ paths: description: The properties of a database configuration. type: object x-requirePropertiesSorted: true - properties: &ref_40 + properties: &ref_41 allow_empty_password: description: This controls whether users that are created can have an empty password or not. type: boolean @@ -790,24 +819,48 @@ paths: type: number default: 1 cors: - description: CORS configuration for this database; if present, overrides server's config. - type: object - properties: - headers: - description: List of allowed headers - type: array - items: - type: string - login_origin: - description: List of allowed login origins - type: array - items: - type: string - origin: - description: List of allowed origins, use ['*'] to allow access from everywhere - type: array - items: - type: string + allOf: + - type: object + properties: &ref_34 + 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. @@ -1620,7 +1673,7 @@ paths: x-additionalPropertiesName: scopename description: Scope-specific configuration. type: object - properties: &ref_121 + properties: &ref_123 collections: description: An object keyed by collection name containing config for the specific collection. type: object @@ -1628,7 +1681,7 @@ paths: x-additionalPropertiesName: collectionname description: Collection-specific configuration. type: object - properties: &ref_120 + properties: &ref_122 sync: description: The Javascript function that newly created documents in this collection are ran through. type: string @@ -1749,6 +1802,14 @@ paths: 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 @@ -1909,15 +1970,15 @@ paths: - title: Simple description: The names of all databases. type: array - items: &ref_122 + items: &ref_124 type: string - example: &ref_123 + example: &ref_125 - db1 - db2 - title: Verbose description: Description of all databases. type: array - example: &ref_124 + example: &ref_126 - db_name: db1 bucket: bucket1 state: Online @@ -1928,7 +1989,7 @@ paths: state: Starting require_resync: true init_in_progress: true - items: &ref_125 + items: &ref_127 type: object properties: db_name: @@ -1959,7 +2020,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -1976,14 +2037,14 @@ paths: - name: name_only in: query required: false - schema: &ref_112 + schema: &ref_113 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: &ref_113 + schema: &ref_114 type: integer description: How many results to return. Using a value of `0` results in no limit. responses: @@ -2001,7 +2062,7 @@ paths: - Bob '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Security operationId: get_db-_user- @@ -2028,7 +2089,7 @@ paths: description: New user created successfully '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '409': description: Resource already exists under that name content: &ref_18 @@ -2046,7 +2107,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. - name: name @@ -2068,7 +2129,7 @@ paths: responses: '200': description: Properties associated with a user - content: &ref_148 + content: &ref_151 application/json: schema: description: Properties associated with a user @@ -2077,7 +2138,7 @@ paths: title: User '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Security operationId: get_db-_user-name @@ -2100,7 +2161,7 @@ paths: description: New user created '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Security operationId: put_db-_user-name @@ -2118,7 +2179,7 @@ paths: description: User deleted successfully '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Security operationId: delete_db-_user-name @@ -2145,7 +2206,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. - name: name @@ -2169,7 +2230,7 @@ paths: description: User now has no sessions '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Session operationId: delete_db-_user-name-_session @@ -2178,7 +2239,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. - name: name @@ -2205,7 +2266,7 @@ paths: description: Session has been successfully removed as the user was associated with the session '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Session operationId: delete_db-_user-name-_session-sessionid @@ -2214,7 +2275,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -2254,7 +2315,7 @@ paths: - Moderator '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Security operationId: get_db-_role- @@ -2281,7 +2342,7 @@ paths: description: New role created successfully '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '409': description: Resource already exists under that name content: *ref_18 @@ -2293,13 +2354,13 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. - name: name in: path required: true - schema: &ref_114 + schema: &ref_115 type: string description: The name of the role. get: @@ -2315,7 +2376,7 @@ paths: responses: '200': description: Properties associated with a role - content: &ref_149 + content: &ref_152 application/json: schema: description: Properties associated with a role @@ -2324,7 +2385,7 @@ paths: title: Role '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Security operationId: get_db-_role-name @@ -2347,7 +2408,7 @@ paths: description: Created '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Security operationId: put_db-_role-name @@ -2365,7 +2426,7 @@ paths: description: OK '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Security operationId: delete_db-_role-name @@ -2375,7 +2436,7 @@ paths: description: Role exists '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Security description: |- @@ -2393,7 +2454,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -2414,7 +2475,7 @@ paths: schema: description: Contains all the replication IDs with their corresponding replication configurations type: object - properties: &ref_126 + properties: &ref_128 replication_id: description: Properties of a replication allOf: &ref_22 @@ -2459,7 +2520,7 @@ paths: title: All replications '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Replication operationId: get_db-_replication- @@ -2494,7 +2555,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Replication operationId: post_db-_replication- @@ -2503,7 +2564,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. - name: replicationid @@ -2533,7 +2594,7 @@ paths: title: Replication '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Replication operationId: get_db-_replication-replicationid @@ -2562,7 +2623,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Replication operationId: put_db-_replication-replicationid @@ -2582,7 +2643,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Replication operationId: delete_db-_replication-replicationid @@ -2607,7 +2668,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -2729,7 +2790,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. - name: replicationid @@ -2830,7 +2891,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Replication operationId: put_db-_replicationStatus-replicationid @@ -2843,7 +2904,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Replication summary: Check if replication exists @@ -2914,7 +2975,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Profiling operationId: post__profile-profilename @@ -3001,7 +3062,7 @@ paths: in: query deprecated: true required: false - schema: &ref_39 + schema: &ref_40 type: boolean default: true description: No longer supported field. @@ -3019,7 +3080,7 @@ paths: schema: type: object x-requirePropertiesSorted: true - properties: &ref_131 + properties: &ref_133 api: description: Configuration settings for modifying how the REST API is interacted with. type: object @@ -3040,26 +3101,12 @@ paths: type: boolean default: true cors: - type: object - properties: - headers: - description: List of allowed headers - type: array - items: - type: string - login_origin: - description: List of allowed login origins - type: array - items: - type: string - max_age: - description: Maximum age of the CORS Options request - type: integer - origin: - description: List of allowed origins, use ['*'] to allow access from everywhere - type: array - items: - type: string + allOf: + - type: object + description: CORS configuration for all databases + - type: object + properties: *ref_34 + title: Cors Configuration enable_advanced_auth_dp: description: |- Whether to enable the DP permissions check feature of admin auth. @@ -3230,7 +3277,7 @@ paths: x-additionalPropertiesName: bucketname description: The configuration for the credentials set. type: object - properties: &ref_34 + properties: &ref_35 username: description: Username for authenticating to the bucket type: string @@ -3252,7 +3299,7 @@ paths: x-additionalPropertiesName: databasename description: The configuration for the credentials set. type: object - properties: *ref_34 + properties: *ref_35 title: Credentials config readOnly: true heap_profile_collection_threshold: @@ -3269,7 +3316,7 @@ paths: type: object allOf: - type: object - properties: &ref_35 + properties: &ref_36 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 @@ -3287,9 +3334,9 @@ paths: console: allOf: - title: Configuration for console logging. - allOf: &ref_128 + allOf: &ref_130 - type: object - properties: &ref_127 + properties: &ref_129 log_level: description: Log Level for the console output type: string @@ -3654,7 +3701,7 @@ paths: audit: type: object title: Audit logging config - properties: &ref_129 + properties: &ref_131 enabled: description: Toggle for this log output type: boolean @@ -3760,7 +3807,7 @@ paths: serverless: description: Configuration for when SG is running in serverless mode type: object - properties: &ref_130 + properties: &ref_132 enabled: description: Run SG in to serverless mode type: boolean @@ -3817,11 +3864,11 @@ paths: application/json: schema: type: object - properties: &ref_132 + properties: &ref_134 logging: allOf: - type: object - properties: *ref_35 + properties: *ref_36 max_concurrent_replications: description: Maximum number of concurrent replication connections allowed. If set to 0 this limit will be ignored. type: integer @@ -3852,7 +3899,7 @@ paths: application/json: schema: type: object - properties: &ref_133 + properties: &ref_135 databases: description: Contains a map of all the databases in the node along with their status. type: object @@ -3922,7 +3969,7 @@ paths: allOf: - description: Product vendor type: object - properties: &ref_56 + properties: &ref_57 name: description: Product name type: string @@ -3933,7 +3980,7 @@ paths: Omitted if `api.hide_product_version=true` type: string example: 3.1 - required: &ref_57 + required: &ref_58 - name title: Vendor title: Status @@ -4090,12 +4137,12 @@ paths: - name: seconds in: query description: If set, collect a delta profile for the given duration, instead of a snapshot. - schema: &ref_36 + schema: &ref_37 type: integer responses: '200': description: OK - content: &ref_37 + content: &ref_38 application/octet-stream: schema: description: pprof binary data @@ -4116,11 +4163,11 @@ paths: - name: seconds in: query description: If set, collect a delta profile for the given duration, instead of a snapshot. - schema: *ref_36 + schema: *ref_37 responses: '200': description: OK - content: *ref_37 + content: *ref_38 tags: - Profiling operationId: post__debug-pprof-goroutine @@ -4205,11 +4252,11 @@ paths: - name: seconds in: query description: If set, collect a delta profile for the given duration, instead of a snapshot. - schema: *ref_36 + schema: *ref_37 responses: '200': description: OK - content: *ref_37 + content: *ref_38 tags: - Profiling operationId: get__debug-pprof-heap @@ -4223,11 +4270,11 @@ paths: - name: seconds in: query description: If set, collect a delta profile for the given duration, instead of a snapshot. - schema: *ref_36 + schema: *ref_37 responses: '200': description: OK - content: *ref_37 + content: *ref_38 tags: - Profiling operationId: post__debug-pprof-heap @@ -4242,11 +4289,11 @@ paths: - name: seconds in: query description: If set, collect a delta profile for the given duration, instead of a snapshot. - schema: *ref_36 + schema: *ref_37 responses: '200': description: OK - content: *ref_37 + content: *ref_38 tags: - Profiling operationId: get__debug-pprof-profile @@ -4260,11 +4307,11 @@ paths: - name: seconds in: query description: If set, collect a delta profile for the given duration, instead of a snapshot. - schema: *ref_36 + schema: *ref_37 responses: '200': description: OK - content: *ref_37 + content: *ref_38 tags: - Profiling operationId: post__debug-pprof-profile @@ -4281,7 +4328,7 @@ paths: - name: seconds in: query required: false - schema: &ref_38 + schema: &ref_39 type: integer default: 30 minimum: 0 @@ -4289,7 +4336,7 @@ paths: responses: '200': description: OK - content: *ref_37 + content: *ref_38 '403': description: Forbidden content: @@ -4317,12 +4364,12 @@ paths: - name: seconds in: query required: false - schema: *ref_38 + schema: *ref_39 description: The amount of seconds to run the profiler for. responses: '200': description: OK - content: *ref_37 + content: *ref_38 '403': description: Forbidden content: @@ -4348,7 +4395,7 @@ paths: responses: '200': description: OK - content: *ref_37 + content: *ref_38 tags: - Profiling operationId: get__debug-pprof-threadcreate @@ -4361,7 +4408,7 @@ paths: responses: '200': description: OK - content: *ref_37 + content: *ref_38 tags: - Profiling operationId: post__debug-pprof-threadcreate @@ -4378,12 +4425,12 @@ paths: - name: seconds in: query required: false - schema: *ref_38 + schema: *ref_39 description: The amount of seconds to run the profiler for. responses: '200': description: OK - content: *ref_37 + content: *ref_38 '403': description: Forbidden content: @@ -4411,12 +4458,12 @@ paths: - name: seconds in: query required: false - schema: *ref_38 + schema: *ref_39 description: The amount of seconds to run the profiler for. responses: '200': description: OK - content: *ref_37 + content: *ref_38 '403': description: Forbidden content: @@ -4450,7 +4497,7 @@ paths: responses: '200': description: OK - content: *ref_37 + content: *ref_38 tags: - Profiling operationId: get__debug-pprof-trace @@ -4471,7 +4518,7 @@ paths: responses: '200': description: OK - content: *ref_37 + content: *ref_38 tags: - Profiling operationId: post__debug-pprof-trace @@ -4488,7 +4535,7 @@ paths: - name: seconds in: query required: false - schema: *ref_38 + schema: *ref_39 description: The amount of seconds to run the profiler for. responses: '200': @@ -4512,7 +4559,7 @@ paths: - name: seconds in: query required: false - schema: *ref_38 + schema: *ref_39 description: The amount of seconds to run the profiler for. responses: '200': @@ -4594,7 +4641,7 @@ paths: in: query deprecated: true required: false - schema: *ref_39 + schema: *ref_40 description: No longer supported field. - name: include_javascript in: query @@ -4605,7 +4652,7 @@ paths: - name: include_runtime in: query required: false - schema: &ref_115 + schema: &ref_116 type: boolean default: false description: Whether to include the values set at runtime, and default values. @@ -4629,11 +4676,11 @@ paths: description: The properties of a database configuration. type: object x-requirePropertiesSorted: true - properties: *ref_40 + properties: *ref_41 title: Database-config '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Configuration operationId: get_db-_config @@ -4652,14 +4699,14 @@ paths: - name: If-Match in: header required: false - schema: &ref_42 + schema: &ref_43 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: *ref_41 + schema: *ref_42 requestBody: description: The new database configuration to use content: @@ -4668,12 +4715,12 @@ paths: description: The properties of a database configuration. type: object x-requirePropertiesSorted: true - properties: *ref_40 + properties: *ref_41 title: Database-config responses: '201': description: Database configuration successfully updated - headers: &ref_43 + headers: &ref_44 Etag: schema: type: string @@ -4683,7 +4730,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '412': description: |- Precondition Failed @@ -4691,7 +4738,7 @@ paths: 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: &ref_44 + content: &ref_45 application/json: schema: type: object @@ -4719,7 +4766,7 @@ paths: - name: If-Match in: header required: false - schema: *ref_42 + schema: *ref_43 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 @@ -4729,12 +4776,12 @@ paths: description: The properties of a database configuration. type: object x-requirePropertiesSorted: true - properties: *ref_40 + properties: *ref_41 title: Database-config responses: '201': description: Database configuration successfully updated - headers: *ref_43 + headers: *ref_44 '400': description: There was a problem with your request content: *ref_11 @@ -4747,7 +4794,7 @@ paths: 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: *ref_44 + content: *ref_45 tags: - Database Configuration operationId: post_db-_config @@ -4755,7 +4802,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. /{db}/_config/audit: @@ -4789,7 +4836,7 @@ paths: oneOf: - title: Simple description: A map of audit events and whether they are enabled or not. - properties: &ref_45 + properties: &ref_46 enabled: type: boolean events: @@ -4838,7 +4885,7 @@ paths: type: string - title: Verbose description: A map of detailed audit events. - properties: &ref_46 + properties: &ref_47 enabled: type: boolean events: @@ -4848,7 +4895,7 @@ paths: description: The audit event ID and whether it is enabled or not. title: audit-event-verbose type: object - properties: &ref_134 + properties: &ref_136 name: type: string description: The name of the audit event. @@ -4904,7 +4951,7 @@ paths: type: string '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Configuration operationId: get_db-_config-audit @@ -4926,10 +4973,10 @@ paths: oneOf: - title: Simple description: A map of audit events and whether they are enabled or not. - properties: *ref_45 + properties: *ref_46 - title: Verbose description: A map of detailed audit events. - properties: *ref_46 + properties: *ref_47 responses: '200': description: Database audit configuration successfully updated @@ -4938,7 +4985,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Configuration operationId: put_db-_config-audit @@ -4967,10 +5014,10 @@ paths: oneOf: - title: Simple description: A map of audit events and whether they are enabled or not. - properties: *ref_45 + properties: *ref_46 - title: Verbose description: A map of detailed audit events. - properties: *ref_46 + properties: *ref_47 responses: '200': description: Database audit configuration successfully updated @@ -4986,7 +5033,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. /{keyspace}/_config/sync: @@ -5028,7 +5075,7 @@ paths: } '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Configuration operationId: get_keyspace-_config-sync @@ -5044,13 +5091,13 @@ paths: - name: If-Match in: header required: false - schema: *ref_42 + schema: *ref_43 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: *ref_41 + schema: *ref_42 requestBody: description: The new sync function to use content: @@ -5069,7 +5116,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '412': description: |- Precondition Failed @@ -5077,7 +5124,7 @@ paths: 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: *ref_44 + content: *ref_45 tags: - Database Configuration operationId: put_keyspace-_config-sync @@ -5100,7 +5147,7 @@ paths: - name: If-Match in: header required: false - schema: &ref_81 + schema: &ref_82 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: @@ -5108,7 +5155,7 @@ paths: description: Successfully reset the sync function '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '412': description: |- Precondition Failed @@ -5116,7 +5163,7 @@ paths: 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: *ref_44 + content: *ref_45 tags: - Database Configuration operationId: delete_keyspace-_config-sync @@ -5155,7 +5202,7 @@ paths: type: string '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Configuration operationId: get_keyspace-_config-import_filter @@ -5171,13 +5218,13 @@ paths: - name: If-Match in: header required: false - schema: *ref_42 + schema: *ref_43 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: *ref_41 + schema: *ref_42 requestBody: description: The import filter to use content: @@ -5192,7 +5239,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '412': description: |- Precondition Failed @@ -5200,7 +5247,7 @@ paths: 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: *ref_44 + content: *ref_45 tags: - Database Configuration operationId: put_keyspace-_config-import_filter @@ -5216,14 +5263,14 @@ paths: - name: If-Match in: header required: false - schema: *ref_42 + schema: *ref_43 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: *ref_2 + content: *ref_4 '412': description: |- Precondition Failed @@ -5231,7 +5278,7 @@ paths: 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: *ref_44 + content: *ref_45 tags: - Database Configuration operationId: delete_keyspace-_config-import_filter @@ -5240,7 +5287,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -5259,7 +5306,7 @@ paths: schema: description: The status of a resync operation type: object - properties: &ref_49 + properties: &ref_50 status: description: The status of the current operation. type: string @@ -5286,20 +5333,20 @@ paths: allOf: - description: scope name with one or more collection names for which resync will be triggered type: object - additionalProperties: &ref_47 + additionalProperties: &ref_48 allOf: - description: List of collection names type: array - items: &ref_135 + items: &ref_137 type: string example: - collection1 - collection2 - example: &ref_48 + example: &ref_49 scopeName: - collection1 - collection2 - required: &ref_50 + required: &ref_51 - status - start_time - last_error @@ -5308,7 +5355,7 @@ paths: title: Resync-status '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Management operationId: get_db-_resync @@ -5362,8 +5409,8 @@ paths: allOf: - description: scope name with one or more collection names for which resync will be triggered type: object - additionalProperties: *ref_47 - example: *ref_48 + additionalProperties: *ref_48 + example: *ref_49 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 @@ -5376,8 +5423,8 @@ paths: schema: description: The status of a resync operation type: object - properties: *ref_49 - required: *ref_50 + properties: *ref_50 + required: *ref_51 title: Resync-status '503': description: Service Unavailable @@ -5396,7 +5443,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. post: @@ -5434,7 +5481,7 @@ paths: allOf: - type: object description: Settings for Global Secondary Indexes (GSI). - properties: &ref_51 + properties: &ref_52 create_separate_principal_indexes: description: |- Whether to create separate indexes for users and roles instead of a single larger syncDocs index. @@ -5458,7 +5505,7 @@ paths: schema: description: The status of an asynchronous indexes initialization operation. type: object - properties: &ref_52 + properties: &ref_53 status: description: The status of the current operation. type: string @@ -5504,8 +5551,8 @@ paths: allOf: - type: object description: Settings for Global Secondary Indexes (GSI). - properties: *ref_51 - required: &ref_53 + properties: *ref_52 + required: &ref_54 - status - start_time - last_error @@ -5539,12 +5586,12 @@ paths: schema: description: The status of an asynchronous indexes initialization operation. type: object - properties: *ref_52 - required: *ref_53 + properties: *ref_53 + required: *ref_54 title: IndexInitStatus '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Management operationId: get_db-_index_init @@ -5645,7 +5692,7 @@ paths: title: HTTP-Error '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document operationId: post_keyspace-_purge @@ -5654,7 +5701,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. post: @@ -5674,7 +5721,7 @@ paths: description: Successfully flushed the bucket '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '503': description: The bucket does not support flush or delete content: @@ -5692,7 +5739,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. post: @@ -5730,7 +5777,7 @@ paths: description: Database will be brought online immediately or with the specified delay '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '503': description: An error occurred content: @@ -5748,7 +5795,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. post: @@ -5776,7 +5823,7 @@ paths: description: Database has been taken offline successfully '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '503': description: An error occurred while trying to take the database offline content: @@ -5794,13 +5841,13 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. - name: view in: path required: true - schema: &ref_54 + schema: &ref_55 type: string description: The view to target. get: @@ -5823,7 +5870,7 @@ paths: type: string '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '500': description: Internal Server Error content: @@ -5841,13 +5888,13 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. - name: view in: path required: true - schema: *ref_54 + schema: *ref_55 description: The view to target. get: summary: Query a view on the default design document | Unsupported @@ -5865,67 +5912,67 @@ paths: in: query required: false description: Indicates whether the specified end key should be included in the result. - schema: &ref_61 + schema: &ref_62 type: boolean - name: descending in: query required: false description: Return documents in descending order. - schema: &ref_62 + schema: &ref_63 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: &ref_63 + schema: &ref_64 type: boolean - name: reduce in: query required: false description: Whether to execute a reduce function on the response or not. - schema: &ref_64 + schema: &ref_65 type: boolean - name: group in: query required: false description: Group the results using the reduce function to a group or single row. - schema: &ref_65 + schema: &ref_66 type: boolean - name: skip in: query required: false description: Skip the specified number of documents before starting to return results. - schema: &ref_66 + schema: &ref_67 type: integer - name: limit in: query required: false description: Return only the specified number of documents - schema: &ref_67 + schema: &ref_68 type: integer - name: group_level in: query required: false description: Specify the group level to be used. - schema: &ref_68 + schema: &ref_69 type: integer - name: startkey_docid in: query required: false description: Return documents starting with the specified document identifier. - schema: &ref_69 + schema: &ref_70 type: string - name: endkey_docid in: query required: false description: Stop returning records when the specified document identifier is reached. - schema: &ref_70 + schema: &ref_71 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: &ref_71 + schema: &ref_72 type: string enum: - ok @@ -5933,25 +5980,25 @@ paths: - name: startkey in: query required: false - schema: &ref_72 + schema: &ref_73 type: string description: Return records starting with the specified key. - name: endkey in: query required: false - schema: &ref_73 + schema: &ref_74 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: &ref_74 + schema: &ref_75 type: string - name: keys in: query required: false - schema: &ref_75 + schema: &ref_76 type: array items: type: string @@ -5995,7 +6042,7 @@ paths: description: Forbidden '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Unsupported operationId: get_db-_view-view @@ -6042,7 +6089,7 @@ paths: type: string '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Unsupported operationId: get_keyspace-_dumpchannel-channel @@ -6051,7 +6098,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. post: @@ -6073,7 +6120,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. post: @@ -6094,7 +6141,7 @@ paths: - name: type in: query required: false - schema: &ref_55 + schema: &ref_56 type: string default: tombstone enum: @@ -6137,7 +6184,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '503': description: Cannot start compaction due to another compaction operation still running. content: @@ -6162,7 +6209,7 @@ paths: - name: type in: query required: false - schema: *ref_55 + schema: *ref_56 description: |- This is the type of compaction to use. The type must be either: * `attachment` for cleaning up legacy (pre-3.0) attachments @@ -6175,7 +6222,7 @@ paths: schema: description: The status returned from a compaction. type: object - properties: &ref_136 + properties: &ref_138 status: description: The status of the current operation. type: string @@ -6225,7 +6272,7 @@ paths: - mark - sweep - cleanup - required: &ref_137 + required: &ref_139 - status - start_time - last_error @@ -6235,7 +6282,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Management operationId: get_db-_compact @@ -6244,7 +6291,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. post: @@ -6280,7 +6327,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '503': description: Cannot start attachment migration due to another migration operation still running. content: @@ -6309,7 +6356,7 @@ paths: schema: description: The status of a attachment migration operation type: object - properties: &ref_138 + properties: &ref_140 status: description: The status of the current attachment migration operation. type: string @@ -6337,7 +6384,7 @@ paths: docs_failed: description: The amount of docs that have failed to be processed through the attachment migration operation. type: integer - required: &ref_139 + required: &ref_141 - status - start_time - last_error @@ -6349,7 +6396,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Database Management operationId: get_db-_attachment_migration @@ -6376,7 +6423,7 @@ paths: - name: roundtrip in: query required: false - schema: &ref_78 + schema: &ref_79 type: boolean description: Block until document has been received by change cache requestBody: @@ -6386,7 +6433,7 @@ paths: description: The configurable Sync Gateway properties of a document. type: object additionalProperties: true - properties: &ref_82 + properties: &ref_83 _id: description: The ID of the document. type: string @@ -6443,7 +6490,7 @@ paths: schema: description: Properties returned when a new document revision is created type: object - properties: &ref_76 + properties: &ref_77 id: description: The ID of the document. type: string @@ -6456,7 +6503,7 @@ paths: cv: description: The CV of the document. type: string - required: &ref_77 + required: &ref_78 - id - ok - rev @@ -6466,13 +6513,13 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '409': description: Resource already exists under that name content: *ref_18 '415': description: Invalid content type - content: &ref_83 + content: &ref_84 application/json: schema: type: object @@ -6506,7 +6553,7 @@ paths: application/json: schema: type: object - properties: &ref_140 + properties: &ref_142 cmdline: description: Built-in variables from the Go runtime, lists the command-line arguments type: object @@ -6752,7 +6799,7 @@ paths: application/json: schema: type: object - properties: &ref_141 + properties: &ref_143 ADMIN: description: '`true` if the request is from the Admin API - otherwise omitted.' type: boolean @@ -6765,8 +6812,8 @@ paths: allOf: - description: Product vendor type: object - properties: *ref_56 - required: *ref_57 + properties: *ref_57 + required: *ref_58 title: Vendor version: description: |- @@ -6780,7 +6827,7 @@ paths: `true` if the sync gateway node is running in persistent config mode. type: boolean example: true - required: &ref_142 + required: &ref_144 - couchdb - vendor tags: @@ -6861,7 +6908,7 @@ paths: - name: include_docs in: query required: false - schema: &ref_91 + schema: &ref_92 type: boolean description: Include the body associated with each document. - name: revocations @@ -6935,12 +6982,12 @@ paths: responses: '200': description: Successfully returned the changes feed - content: &ref_58 + content: &ref_59 application/json: schema: description: Properties of a changes feed type: object - properties: &ref_143 + properties: &ref_145 results: type: array items: @@ -6979,7 +7026,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document operationId: get_keyspace-_changes @@ -7050,13 +7097,13 @@ paths: responses: '200': description: Successfully returned the changes feed - content: *ref_58 + content: *ref_59 '400': description: There was a problem with your request content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document operationId: post_keyspace-_changes @@ -7065,13 +7112,13 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. - name: ddoc in: path required: true - schema: &ref_60 + schema: &ref_61 type: string description: The design document name. get: @@ -7093,7 +7140,7 @@ paths: schema: description: Properties of a design document type: object - properties: &ref_59 + properties: &ref_60 language: type: string views: @@ -7122,7 +7169,7 @@ paths: 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: *ref_2 + content: *ref_4 tags: - Unsupported operationId: get_db-_design-ddoc @@ -7142,7 +7189,7 @@ paths: schema: description: Properties of a design document type: object - properties: *ref_59 + properties: *ref_60 responses: '200': description: Design document changes successfully @@ -7150,7 +7197,7 @@ paths: 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: *ref_2 + content: *ref_4 tags: - Unsupported operationId: put_db-_design-ddoc @@ -7171,7 +7218,7 @@ paths: 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: *ref_2 + content: *ref_4 tags: - Unsupported operationId: delete_db-_design-ddoc @@ -7183,7 +7230,7 @@ paths: 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: *ref_2 + content: *ref_4 tags: - Unsupported description: |- @@ -7202,18 +7249,18 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. - name: ddoc in: path required: true - schema: *ref_60 + schema: *ref_61 description: The design document name. - name: view in: path required: true - schema: *ref_54 + schema: *ref_55 description: The view to target. get: summary: Query a view on a design document | Unsupported @@ -7231,76 +7278,76 @@ paths: in: query required: false description: Indicates whether the specified end key should be included in the result. - schema: *ref_61 + schema: *ref_62 - name: descending in: query required: false description: Return documents in descending order. - schema: *ref_62 + schema: *ref_63 - 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: *ref_63 + schema: *ref_64 - name: reduce in: query required: false description: Whether to execute a reduce function on the response or not. - schema: *ref_64 + schema: *ref_65 - name: group in: query required: false description: Group the results using the reduce function to a group or single row. - schema: *ref_65 + schema: *ref_66 - name: skip in: query required: false description: Skip the specified number of documents before starting to return results. - schema: *ref_66 + schema: *ref_67 - name: limit in: query required: false description: Return only the specified number of documents - schema: *ref_67 + schema: *ref_68 - name: group_level in: query required: false description: Specify the group level to be used. - schema: *ref_68 + schema: *ref_69 - name: startkey_docid in: query required: false description: Return documents starting with the specified document identifier. - schema: *ref_69 + schema: *ref_70 - name: endkey_docid in: query required: false description: Stop returning records when the specified document identifier is reached. - schema: *ref_70 + schema: *ref_71 - 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: *ref_71 + schema: *ref_72 - name: startkey in: query required: false - schema: *ref_72 + schema: *ref_73 description: Return records starting with the specified key. - name: endkey in: query required: false - schema: *ref_73 + schema: *ref_74 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: *ref_74 + schema: *ref_75 - name: keys in: query required: false - schema: *ref_75 + schema: *ref_76 description: An array of document ID strings to filter by. responses: '200': @@ -7341,7 +7388,7 @@ paths: description: Forbidden '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Unsupported operationId: get_db-_design-ddoc-_view-view @@ -7399,7 +7446,7 @@ paths: type: string '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document operationId: post_keyspace-_revs_diff @@ -7439,7 +7486,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document operationId: get_keyspace-_local-docid @@ -7472,15 +7519,15 @@ paths: schema: description: Properties returned when a new document revision is created type: object - properties: *ref_76 - required: *ref_77 + properties: *ref_77 + required: *ref_78 title: New-revision '400': description: There was a problem with your request content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '409': description: A conflict would result from updating this document revision. tags: @@ -7511,7 +7558,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '409': description: A conflict would result from deleting this document revision. tags: @@ -7526,7 +7573,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document summary: Check if local document exists @@ -7570,14 +7617,14 @@ paths: - name: rev in: query required: false - schema: &ref_80 + schema: &ref_81 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: &ref_85 + schema: &ref_86 type: array items: type: string @@ -7585,13 +7632,13 @@ paths: - name: show_exp in: query required: false - schema: &ref_86 + schema: &ref_87 type: boolean description: Whether to show the expiry property (`_exp`) in the response. - name: revs_from in: query required: false - schema: &ref_87 + schema: &ref_88 type: array items: type: string @@ -7599,7 +7646,7 @@ paths: - name: atts_since in: query required: false - schema: &ref_88 + schema: &ref_89 type: array items: type: string @@ -7607,19 +7654,19 @@ paths: - name: revs_limit in: query required: false - schema: &ref_89 + schema: &ref_90 type: integer description: Maximum amount of revisions to return for each document. - name: attachments in: query required: false - schema: &ref_90 + schema: &ref_91 type: boolean description: Include attachment bodies in response. - name: replicator2 in: query required: false - schema: &ref_79 + schema: &ref_80 type: boolean description: Returns the document with the required properties for replication. This is an enterprise-edition only feature. responses: @@ -7654,7 +7701,7 @@ paths: 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: &ref_84 + content: &ref_85 application/json: schema: type: object @@ -7663,7 +7710,7 @@ paths: title: HTTP-Error '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '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: @@ -7694,30 +7741,30 @@ paths: - name: roundtrip in: query required: false - schema: *ref_78 + schema: *ref_79 description: Block until document has been received by change cache - name: replicator2 in: query required: false - schema: *ref_79 + schema: *ref_80 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: &ref_116 + schema: &ref_117 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: *ref_80 + schema: *ref_81 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: *ref_81 + schema: *ref_82 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: @@ -7726,7 +7773,7 @@ paths: description: The configurable Sync Gateway properties of a document. type: object additionalProperties: true - properties: *ref_82 + properties: *ref_83 responses: '201': description: Created @@ -7740,21 +7787,21 @@ paths: schema: description: Properties returned when a new document revision is created type: object - properties: *ref_76 - required: *ref_77 + properties: *ref_77 + required: *ref_78 title: New-revision '400': description: There was a problem with your request content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '409': description: Resource already exists under that name content: *ref_18 '415': description: Invalid content type - content: *ref_83 + content: *ref_84 tags: - Document operationId: put_keyspace-docid @@ -7772,31 +7819,31 @@ paths: - name: rev in: query required: false - schema: *ref_80 + schema: *ref_81 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: *ref_81 + schema: *ref_82 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: &ref_150 + content: &ref_153 application/json: schema: description: Properties returned when a new document revision is created type: object - properties: *ref_76 - required: *ref_77 + properties: *ref_77 + required: *ref_78 title: New-revision '400': description: There was a problem with your request content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document operationId: delete_keyspace-docid @@ -7809,10 +7856,10 @@ paths: 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: *ref_84 + content: *ref_85 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document summary: Check if a document exists @@ -7820,43 +7867,43 @@ paths: - name: rev in: query required: false - schema: *ref_80 + schema: *ref_81 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: *ref_85 + schema: *ref_86 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: *ref_86 + schema: *ref_87 description: Whether to show the expiry property (`_exp`) in the response. - name: revs_from in: query required: false - schema: *ref_87 + schema: *ref_88 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: *ref_88 + schema: *ref_89 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: *ref_89 + schema: *ref_90 description: Maximum amount of revisions to return for each document. - name: attachments in: query required: false - schema: *ref_90 + schema: *ref_91 description: Include attachment bodies in response. - name: replicator2 in: query required: false - schema: *ref_79 + schema: *ref_80 description: Returns the document with the required properties for replication. This is an enterprise-edition only feature. description: |- Return a status code based on if the document exists or not. @@ -7906,7 +7953,7 @@ paths: - name: rev in: query required: false - schema: *ref_80 + schema: *ref_81 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 @@ -7943,7 +7990,7 @@ paths: description: Partial attachment content returned '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '416': description: Requested range exceeds content length tags: @@ -7998,12 +8045,12 @@ paths: schema: description: Properties returned when a new document revision is created type: object - properties: *ref_76 - required: *ref_77 + properties: *ref_77 + required: *ref_78 title: New-revision '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '409': description: Resource already exists under that name content: *ref_18 @@ -8025,7 +8072,7 @@ paths: description: The attachment digest. '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document summary: Check if attachment exists @@ -8040,7 +8087,7 @@ paths: - name: rev in: query required: false - schema: *ref_80 + schema: *ref_81 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.) operationId: head_keyspace-docid-attach @@ -8074,12 +8121,12 @@ paths: schema: description: Properties returned when a new document revision is created type: object - properties: *ref_76 - required: *ref_77 + properties: *ref_77 + required: *ref_78 title: New-revision '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '409': description: Resource already exists under that name content: *ref_18 @@ -8113,57 +8160,57 @@ paths: - name: include_docs in: query required: false - schema: *ref_91 + schema: *ref_92 description: Include the body associated with each document. - name: channels in: query required: false - schema: &ref_92 + schema: &ref_93 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: &ref_93 + schema: &ref_94 type: boolean description: Include what user/roles that each document grants access too. - name: revs in: query required: false - schema: &ref_94 + schema: &ref_95 type: boolean description: Include all the revisions for each document under the `_revisions` property. - name: update_seq in: query required: false - schema: &ref_95 + schema: &ref_96 type: boolean description: Include the document sequence number `update_seq` property for each document. - name: keys in: query required: false - schema: *ref_75 + schema: *ref_76 description: An array of document ID strings to filter by. - name: startkey in: query required: false - schema: *ref_72 + schema: *ref_73 description: Return records starting with the specified key. - name: endkey in: query required: false - schema: *ref_73 + schema: *ref_74 description: Stop returning records when this key is reached. - name: limit in: query required: false - schema: &ref_96 + schema: &ref_97 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: &ref_97 + content: &ref_98 application/json: schema: type: object @@ -8198,7 +8245,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document operationId: get_keyspace-_all_docs @@ -8218,42 +8265,42 @@ paths: - name: include_docs in: query required: false - schema: *ref_91 + schema: *ref_92 description: Include the body associated with each document. - name: channels in: query required: false - schema: *ref_92 + schema: *ref_93 description: Include the channels each document is part of that the calling user also has access too. - name: access in: query required: false - schema: *ref_93 + schema: *ref_94 description: Include what user/roles that each document grants access too. - name: revs in: query required: false - schema: *ref_94 + schema: *ref_95 description: Include all the revisions for each document under the `_revisions` property. - name: update_seq in: query required: false - schema: *ref_95 + schema: *ref_96 description: Include the document sequence number `update_seq` property for each document. - name: startkey in: query required: false - schema: *ref_72 + schema: *ref_73 description: Return records starting with the specified key. - name: endkey in: query required: false - schema: *ref_73 + schema: *ref_74 description: Stop returning records when this key is reached. - name: limit in: query required: false - schema: *ref_96 + schema: *ref_97 description: This limits the number of result rows returned. Using a value of `0` has the same effect as the value `1`. requestBody: content: @@ -8271,13 +8318,13 @@ paths: responses: '200': description: Operation ran successfully - content: *ref_97 + content: *ref_98 '400': description: There was a problem with your request content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document operationId: post_keyspace-_all_docs @@ -8322,7 +8369,7 @@ paths: description: The configurable Sync Gateway properties of a document. type: object additionalProperties: true - properties: *ref_82 + properties: *ref_83 required: - docs example: @@ -8394,7 +8441,7 @@ paths: content: *ref_11 '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document operationId: post_keyspace-_bulk_docs @@ -8434,7 +8481,7 @@ paths: - name: revs in: query required: false - schema: *ref_94 + schema: *ref_95 description: Include all the revisions for each document under the `_revisions` property. - name: revs_limit in: query @@ -8481,7 +8528,7 @@ paths: description: Bad Request '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 tags: - Document operationId: post_keyspace-_bulk_get @@ -8490,7 +8537,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -8500,13 +8547,13 @@ paths: - name: provider in: query required: false - schema: &ref_98 + schema: &ref_99 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: &ref_99 + schema: &ref_100 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: @@ -8521,7 +8568,7 @@ paths: 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: *ref_2 + content: *ref_4 '500': description: Unable to connect and validate with the OpenID Connect provider requested tags: @@ -8532,7 +8579,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -8542,12 +8589,12 @@ paths: - name: provider in: query required: false - schema: *ref_98 + schema: *ref_99 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: *ref_99 + schema: *ref_100 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': @@ -8561,7 +8608,7 @@ paths: description: The OpenID Connect authentication URL. '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '500': description: Unable to connect and validate with the OpenID Connect provider requested tags: @@ -8572,7 +8619,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -8587,28 +8634,28 @@ paths: - name: code in: query required: true - schema: &ref_117 + schema: &ref_118 type: string description: The OpenID Connect authentication code. - name: provider in: query required: false - schema: *ref_98 + schema: *ref_99 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: &ref_118 + schema: &ref_119 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: &ref_100 + content: &ref_101 application/json: schema: type: object - properties: &ref_144 + properties: &ref_146 id_token: description: The OpenID Connect ID token type: string @@ -8637,7 +8684,7 @@ paths: 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: *ref_2 + content: *ref_4 '500': description: A problem occurred in regards to the token content: @@ -8657,7 +8704,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -8673,17 +8720,17 @@ paths: - name: provider in: query required: false - schema: *ref_98 + schema: *ref_99 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: *ref_100 + content: *ref_101 '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: *ref_2 + content: *ref_4 '500': description: Unable to connect and validate with the OpenID Connect provider requested tags: @@ -8694,7 +8741,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -8739,7 +8786,7 @@ paths: 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: *ref_2 + content: *ref_4 tags: - Unsupported operationId: get_db-_oidc_testing-.well-known-openid-configuration @@ -8748,7 +8795,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -8758,7 +8805,7 @@ paths: - name: scope in: query required: true - schema: &ref_101 + schema: &ref_102 type: string description: The OpenID Connect authentication scope. responses: @@ -8766,7 +8813,7 @@ paths: description: OK '400': description: A validation error occurred with the scope. - content: &ref_102 + content: &ref_103 application/json: schema: type: object @@ -8777,10 +8824,10 @@ paths: 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: *ref_2 + content: *ref_4 '500': description: An error occurred. - content: &ref_103 + content: &ref_104 application/json: schema: type: object @@ -8797,22 +8844,22 @@ paths: - name: scope in: query required: true - schema: *ref_101 + schema: *ref_102 description: The OpenID Connect authentication scope. responses: '200': description: OK '400': description: A validation error occurred with the scope. - content: *ref_102 + content: *ref_103 '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: *ref_2 + content: *ref_4 '500': description: An error occurred. - content: *ref_103 + content: *ref_104 tags: - Unsupported operationId: post_db-_oidc_testing-authorize @@ -8821,7 +8868,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. post: @@ -8847,12 +8894,12 @@ paths: responses: '200': description: Properties expected back from an OpenID Connect provider after successful authentication - content: &ref_151 + content: &ref_154 application/json: schema: description: Properties expected back from an OpenID Connect provider after successful authentication type: object - properties: &ref_145 + properties: &ref_147 access_token: type: string token_type: @@ -8870,7 +8917,7 @@ paths: 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: *ref_2 + content: *ref_4 tags: - Unsupported operationId: post_db-_oidc_testing-token @@ -8879,7 +8926,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -8920,7 +8967,7 @@ paths: 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: *ref_2 + content: *ref_4 '500': description: An error occurred while getting the private RSA key content: @@ -8940,7 +8987,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -8950,13 +8997,13 @@ paths: - name: redirect_uri in: query required: false - schema: &ref_104 + schema: &ref_105 type: string description: The Sync Gateway OpenID Connect callback URL. - name: scope in: query required: true - schema: *ref_101 + schema: *ref_102 description: The OpenID Connect authentication scope. - name: username in: query @@ -8981,7 +9028,7 @@ paths: responses: '302': description: Redirecting to Sync Gateway OpenID Connect callback URL - headers: &ref_105 + headers: &ref_106 Location: schema: type: string @@ -8990,7 +9037,7 @@ paths: 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: *ref_2 + content: *ref_4 tags: - Unsupported operationId: get_db-_oidc_testing-authenticate @@ -9001,20 +9048,20 @@ paths: - name: redirect_uri in: query required: false - schema: *ref_104 + schema: *ref_105 description: The Sync Gateway OpenID Connect callback URL. - name: scope in: query required: true - schema: *ref_101 + schema: *ref_102 description: The OpenID Connect authentication scope. requestBody: - content: &ref_152 + content: &ref_155 application/json: schema: description: Properties passed from the OpenID Connect mock login page to the handler type: object - properties: &ref_146 + properties: &ref_148 username: type: string tokenttl: @@ -9023,7 +9070,7 @@ paths: type: string authenticated: type: string - required: &ref_147 + required: &ref_149 - username - tokenttl - identity-token-formats @@ -9032,12 +9079,12 @@ paths: responses: '302': description: Redirecting to Sync Gateway OpenID Connect callback URL - headers: *ref_105 + headers: *ref_106 '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: *ref_2 + content: *ref_4 tags: - Unsupported operationId: post_db-_oidc_testing-authenticate @@ -9046,7 +9093,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. get: @@ -9072,7 +9119,7 @@ paths: description: Upgraded to a web socket connection '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '426': description: Cannot upgrade connection to a web socket connection content: @@ -9093,7 +9140,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. post: @@ -9101,7 +9148,7 @@ paths: description: |- Creates a new session based on a Facebook user. On a successful session creation, a session cookie is stored to keep the user authenticated for future API calls. - If CORS is enabled, the origin must match an allowed login origin otherwise an error will be returned. + 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: @@ -9117,8 +9164,17 @@ paths: '200': description: Session created successfully '400': - description: Origin is not in the approved list of allowed origins - content: *ref_106 + description: Value of `Origin` is not in the approved list of allowed origins in `LoginOrigin` of Sync Gateway bootstrap or database configuration. + content: &ref_107 + application/json: + schema: + type: object + properties: *ref_0 + required: *ref_1 + title: HTTP-Error + example: + error: Bad Request + reason: No CORS '401': description: Received error from Facebook verifier content: @@ -9132,7 +9188,7 @@ paths: type: string '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '502': description: Received invalid response from the Facebook verifier content: @@ -9164,7 +9220,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. post: @@ -9172,7 +9228,7 @@ paths: description: |- Creates a new session based on a Google user. On a successful session creation, a session cookie is stored to keep the user authenticated for future API calls. - If CORS is enabled, the origin must match an allowed login origin otherwise an error will be returned. + 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: @@ -9188,8 +9244,8 @@ paths: '200': description: Session created successfully '400': - description: Origin is not in the approved list of allowed origins - content: *ref_106 + description: Value of `Origin` is not in the approved list of allowed origins in `LoginOrigin` of Sync Gateway bootstrap or database configuration. + content: *ref_107 '401': description: Received error from Google token verifier or invalid application ID in the config content: @@ -9203,7 +9259,7 @@ paths: type: string '404': description: Resource could not be found - content: *ref_2 + content: *ref_4 '502': description: Received invalid response from the Google token verifier content: @@ -9226,7 +9282,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. post: @@ -9276,11 +9332,11 @@ paths: schema: description: A map of log keys and whether they are enabled or not. type: object - example: &ref_107 + example: &ref_108 HTTP: true CRUD: false Changes: true - additionalProperties: &ref_108 + additionalProperties: &ref_109 description: The log key and whether it is enabled or not. type: boolean deprecated: true @@ -9300,7 +9356,7 @@ paths: - name: logLevel in: query required: false - schema: &ref_109 + schema: &ref_110 type: string enum: - none @@ -9313,7 +9369,7 @@ paths: - name: level in: query required: false - schema: &ref_110 + schema: &ref_111 type: integer maximum: 3 minimum: 1 @@ -9329,8 +9385,8 @@ paths: schema: description: A map of log keys and whether they are enabled or not. type: object - example: *ref_107 - additionalProperties: *ref_108 + example: *ref_108 + additionalProperties: *ref_109 responses: '200': description: Log keys successfully replaced. @@ -9354,12 +9410,12 @@ paths: - name: logLevel in: query required: false - schema: *ref_109 + schema: *ref_110 description: The is what to set the console log level too. - name: level in: query required: false - schema: *ref_110 + schema: *ref_111 deprecated: true description: |- **Deprecated: use log level instead.** @@ -9372,8 +9428,8 @@ paths: schema: description: A map of log keys and whether they are enabled or not. type: object - example: *ref_107 - additionalProperties: *ref_108 + example: *ref_108 + additionalProperties: *ref_109 responses: '200': description: Log keys successfully updated. @@ -9390,7 +9446,7 @@ components: name: db in: path required: true - schema: *ref_3 + schema: *ref_2 example: db1 description: The name of the database to run the operation against. sessionid: @@ -9420,25 +9476,25 @@ components: name: include_doc in: query required: false - schema: *ref_111 + schema: *ref_112 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: *ref_41 + schema: *ref_42 usersNameOnly: name: name_only in: query required: false - schema: *ref_112 + schema: *ref_113 description: Whether to return user names only, or more detailed information for each user. usersLimit: name: limit in: query required: false - schema: *ref_113 + schema: *ref_114 description: How many results to return. Using a value of `0` results in no limit. user-name: name: name @@ -9450,7 +9506,7 @@ components: name: name in: path required: true - schema: *ref_114 + schema: *ref_115 description: The name of the role. replicationid: name: replicationid @@ -9487,138 +9543,138 @@ components: in: query deprecated: true required: false - schema: *ref_39 + schema: *ref_40 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: *ref_36 + schema: *ref_37 debug-profile-seconds: name: seconds in: query required: false - schema: *ref_38 + schema: *ref_39 description: The amount of seconds to run the profiler for. include_runtime: name: include_runtime in: query required: false - schema: *ref_115 + schema: *ref_116 description: Whether to include the values set at runtime, and default values. DB-config-If-Match: name: If-Match in: header required: false - schema: *ref_42 + schema: *ref_43 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: *ref_81 + schema: *ref_82 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: *ref_54 + schema: *ref_55 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: *ref_61 + schema: *ref_62 descending: name: descending in: query required: false description: Return documents in descending order. - schema: *ref_62 + schema: *ref_63 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: *ref_63 + schema: *ref_64 reduce: name: reduce in: query required: false description: Whether to execute a reduce function on the response or not. - schema: *ref_64 + schema: *ref_65 group: name: group in: query required: false description: Group the results using the reduce function to a group or single row. - schema: *ref_65 + schema: *ref_66 skip: name: skip in: query required: false description: Skip the specified number of documents before starting to return results. - schema: *ref_66 + schema: *ref_67 limit: name: limit in: query required: false description: Return only the specified number of documents - schema: *ref_67 + schema: *ref_68 group_level: name: group_level in: query required: false description: Specify the group level to be used. - schema: *ref_68 + schema: *ref_69 startkey_docid: name: startkey_docid in: query required: false description: Return documents starting with the specified document identifier. - schema: *ref_69 + schema: *ref_70 endkey_docid: name: endkey_docid in: query required: false description: Stop returning records when the specified document identifier is reached. - schema: *ref_70 + schema: *ref_71 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: *ref_71 + schema: *ref_72 startkey: name: startkey in: query required: false - schema: *ref_72 + schema: *ref_73 description: Return records starting with the specified key. endkey: name: endkey in: query required: false - schema: *ref_73 + schema: *ref_74 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: *ref_74 + schema: *ref_75 keys: name: keys in: query required: false - schema: *ref_75 + schema: *ref_76 description: An array of document ID strings to filter by. compact-type: name: type in: query required: false - schema: *ref_55 + schema: *ref_56 description: |- This is the type of compaction to use. The type must be either: * `attachment` for cleaning up legacy (pre-3.0) attachments @@ -9627,152 +9683,152 @@ components: name: roundtrip in: query required: false - schema: *ref_78 + schema: *ref_79 description: Block until document has been received by change cache include_docs: name: include_docs in: query required: false - schema: *ref_91 + schema: *ref_92 description: Include the body associated with each document. ddoc: name: ddoc in: path required: true - schema: *ref_60 + schema: *ref_61 description: The design document name. rev: name: rev in: query required: false - schema: *ref_80 + schema: *ref_81 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: *ref_85 + schema: *ref_86 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: *ref_86 + schema: *ref_87 description: Whether to show the expiry property (`_exp`) in the response. revs_from: name: revs_from in: query required: false - schema: *ref_87 + schema: *ref_88 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: *ref_88 + schema: *ref_89 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: *ref_89 + schema: *ref_90 description: Maximum amount of revisions to return for each document. includeAttachments: name: attachments in: query required: false - schema: *ref_90 + schema: *ref_91 description: Include attachment bodies in response. replicator2: name: replicator2 in: query required: false - schema: *ref_79 + schema: *ref_80 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: *ref_116 + schema: *ref_117 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: *ref_92 + schema: *ref_93 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: *ref_93 + schema: *ref_94 description: Include what user/roles that each document grants access too. include-revs: name: revs in: query required: false - schema: *ref_94 + schema: *ref_95 description: Include all the revisions for each document under the `_revisions` property. include-seqs: name: update_seq in: query required: false - schema: *ref_95 + schema: *ref_96 description: Include the document sequence number `update_seq` property for each document. limit-result-rows: name: limit in: query required: false - schema: *ref_96 + schema: *ref_97 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: *ref_98 + schema: *ref_99 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: *ref_99 + schema: *ref_100 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: *ref_117 + schema: *ref_118 description: The OpenID Connect authentication code. oidc-state: name: state in: query required: false - schema: *ref_118 + schema: *ref_119 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: *ref_101 + schema: *ref_102 description: The OpenID Connect authentication scope. oidc-redirect_uri: name: redirect_uri in: query required: false - schema: *ref_104 + schema: *ref_105 description: The Sync Gateway OpenID Connect callback URL. log-level: name: logLevel in: query required: false - schema: *ref_109 + schema: *ref_110 description: The is what to set the console log level too. log-level-int: name: level in: query required: false - schema: *ref_110 + schema: *ref_111 deprecated: true description: |- **Deprecated: use log level instead.** @@ -9781,7 +9837,8 @@ components: schemas: User-session-information: type: object - properties: *ref_119 + properties: *ref_120 + required: *ref_121 title: User Session Information HTTP-Error: type: object @@ -9793,6 +9850,10 @@ components: type: string enum: *ref_12 x-enumDescriptions: *ref_13 + CORS: + type: object + properties: *ref_34 + title: Cors Configuration Event-config: type: object properties: *ref_8 @@ -9825,31 +9886,31 @@ components: CollectionConfig: description: Collection-specific configuration. type: object - properties: *ref_120 + properties: *ref_122 title: Collection config Scopes: description: Scope-specific configuration. type: object - properties: *ref_121 + properties: *ref_123 title: Scopes Database: description: The properties of a database configuration. type: object x-requirePropertiesSorted: true - properties: *ref_40 + properties: *ref_41 title: Database-config All DBs: title: Simple description: The names of all databases. type: array - items: *ref_122 - example: *ref_123 + items: *ref_124 + example: *ref_125 All DBs Verbose: title: Verbose description: Description of all databases. type: array - example: *ref_124 - items: *ref_125 + example: *ref_126 + items: *ref_127 ISGRReplicationState: description: This is the state that the replicator is in or that trying to transition in to. type: string @@ -9863,7 +9924,7 @@ components: All-replications: description: Contains all the replication IDs with their corresponding replication configurations type: object - properties: *ref_126 + properties: *ref_128 title: All replications Replication-status: type: object @@ -9873,149 +9934,149 @@ components: CredentialsConfig: description: The configuration for the credentials set. type: object - properties: *ref_34 + properties: *ref_35 title: Credentials config Console-logging-keys-level: type: object - properties: *ref_127 + properties: *ref_129 Console-logging-config: title: Configuration for console logging. - allOf: *ref_128 + allOf: *ref_130 Audit-logging-config: type: object title: Audit logging config - properties: *ref_129 + properties: *ref_131 Logging-config: type: object - properties: *ref_35 + properties: *ref_36 Serverless: description: Configuration for when SG is running in serverless mode type: object - properties: *ref_130 + properties: *ref_132 Startup-config: type: object x-requirePropertiesSorted: true - properties: *ref_131 + properties: *ref_133 title: Startup-config Runtime-config: type: object - properties: *ref_132 + properties: *ref_134 title: Runtime-config Vendor: description: Product vendor type: object - properties: *ref_56 - required: *ref_57 + properties: *ref_57 + required: *ref_58 title: Vendor Status: type: object - properties: *ref_133 + properties: *ref_135 title: Status Database-audit: title: Simple description: A map of audit events and whether they are enabled or not. - properties: *ref_45 + properties: *ref_46 AuditEventVerbose: title: audit-event-verbose description: Detailed information about an audit event. type: object - properties: *ref_134 + properties: *ref_136 Database-audit-verbose: title: Verbose description: A map of detailed audit events. - properties: *ref_46 + properties: *ref_47 CollectionNames: description: List of collection names type: array - items: *ref_135 + items: *ref_137 ResyncScopesMap: description: scope name with one or more collection names for which resync will be triggered type: object - additionalProperties: *ref_47 - example: *ref_48 + additionalProperties: *ref_48 + example: *ref_49 Resync-status: description: The status of a resync operation type: object - properties: *ref_49 - required: *ref_50 + properties: *ref_50 + required: *ref_51 title: Resync-status IndexSettings: type: object description: Settings for Global Secondary Indexes (GSI). - properties: *ref_51 + properties: *ref_52 IndexInitStatus: description: The status of an asynchronous indexes initialization operation. type: object - properties: *ref_52 - required: *ref_53 + properties: *ref_53 + required: *ref_54 title: IndexInitStatus Compact-status: description: The status returned from a compaction. type: object - properties: *ref_136 - required: *ref_137 + properties: *ref_138 + required: *ref_139 title: Compact-status Attachment-Migration-status: description: The status of a attachment migration operation type: object - properties: *ref_138 - required: *ref_139 + properties: *ref_140 + required: *ref_141 title: Attachment-Migration-status Document: description: The configurable Sync Gateway properties of a document. type: object additionalProperties: true - properties: *ref_82 + properties: *ref_83 New-revision: description: Properties returned when a new document revision is created type: object - properties: *ref_76 - required: *ref_77 + properties: *ref_77 + required: *ref_78 title: New-revision ExpVars: type: object - properties: *ref_140 + properties: *ref_142 NodeInfo: type: object - properties: *ref_141 - required: *ref_142 + properties: *ref_143 + required: *ref_144 Changes-feed: description: Properties of a changes feed type: object - properties: *ref_143 + properties: *ref_145 Design-doc: description: Properties of a design document type: object - properties: *ref_59 + properties: *ref_60 OIDC-callback: type: object - properties: *ref_144 + properties: *ref_146 title: OpenID Connect callback properties OIDC-token: description: Properties expected back from an OpenID Connect provider after successful authentication type: object - properties: *ref_145 + properties: *ref_147 title: OIDC-token OIDC-login-page-handler: description: Properties passed from the OpenID Connect mock login page to the handler type: object - properties: *ref_146 - required: *ref_147 + properties: *ref_148 + required: *ref_149 DeprecatedLogKeyMap: description: A map of log keys and whether they are enabled or not. type: object - example: *ref_107 - additionalProperties: *ref_108 + example: *ref_108 + additionalProperties: *ref_109 responses: User-session-information: description: Properties associated with a user session - content: *ref_4 + content: *ref_3 Not-found: description: Resource could not be found - content: *ref_2 - Invalid-CORS: - description: Origin is not in the approved list of allowed origins - content: *ref_106 + content: *ref_4 + Unauthorized: + description: User does not have access to resource, or resource does not exist + content: *ref_150 request-problem: description: There was a problem with your request content: *ref_11 @@ -10024,20 +10085,20 @@ components: content: *ref_18 User: description: Properties associated with a user - content: *ref_148 + content: *ref_151 Role: description: Properties associated with a role - content: *ref_149 + content: *ref_152 Replicator-updated: description: Updated existing configuration successfully Replicator-created: description: Created new replication successfully pprof-binary: description: OK - content: *ref_37 + content: *ref_38 DB-config-updated: description: Database configuration successfully updated - headers: *ref_43 + headers: *ref_44 DB-config-precondition-failed: description: |- Precondition Failed @@ -10045,13 +10106,13 @@ components: 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: *ref_44 + content: *ref_45 Invalid-content-type: description: Invalid content type - content: *ref_83 + content: *ref_84 changes-feed: description: Successfully returned the changes feed - content: *ref_58 + content: *ref_59 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: @@ -10059,34 +10120,37 @@ components: 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: *ref_84 + content: *ref_85 New-revision: description: New revision created successfully - content: *ref_150 + content: *ref_153 all-docs: description: Operation ran successfully - content: *ref_97 + content: *ref_98 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: *ref_100 + content: *ref_101 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: *ref_102 + content: *ref_103 OIDC-testing-internal-error: description: An error occurred. - content: *ref_103 + content: *ref_104 OIDC-token: description: Properties expected back from an OpenID Connect provider after successful authentication - content: *ref_151 + content: *ref_154 OIDC-testing-redirect: description: Redirecting to Sync Gateway OpenID Connect callback URL - headers: *ref_105 + headers: *ref_106 + 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: *ref_107 requestBodies: User: content: *ref_14 @@ -10100,5 +10164,5 @@ components: Profile: content: *ref_33 OIDC-login-page-handler: - content: *ref_152 + content: *ref_155 description: Properties passed from the OpenID Connect mock login page to the handler diff --git a/modules/ROOT/assets/attachments/bundled-public.yaml b/modules/ROOT/assets/attachments/bundled-public.yaml index fe088361..eaa856bd 100644 --- a/modules/ROOT/assets/attachments/bundled-public.yaml +++ b/modules/ROOT/assets/attachments/bundled-public.yaml @@ -51,7 +51,7 @@ paths: - name: db in: path required: true - schema: &ref_3 + schema: &ref_6 type: string example: db1 description: The name of the database to run the operation against. @@ -61,52 +61,69 @@ paths: responses: '200': description: Properties associated with a user session - content: &ref_74 + content: &ref_76 application/json: schema: type: object - properties: &ref_62 + properties: &ref_0 authentication_handlers: - description: The ways authentication can be established to authenticate as the user. + description: The ways authentication can be established to authenticate as a user. Used for CouchDB compatibility. Always contains "default" and "cookie". type: array - items: - type: string + 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 the user has access to and the sequence number each channel was created at. - - The key is the channel name and the value is the sequence number. + 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 - nullable: true + minLength: 1 + required: + - channels + - name + required: &ref_1 + - authentication_handlers + - ok + - userCtx title: User Session Information - '404': - description: Resource could not be found - content: &ref_2 + '401': + description: User does not have access to resource, or resource does not exist + content: &ref_4 application/json: schema: type: object - properties: &ref_0 + properties: &ref_2 error: description: The error name. type: string reason: description: The error description. type: string - required: &ref_1 + required: &ref_3 - error - reason title: HTTP-Error - example: - error: not_found - reason: no such database "invalid-db" tags: - Session operationId: get_db-_session @@ -115,19 +132,27 @@ paths: description: |- Generates a login session for the user based on the credentials provided in the request body or if that fails (due to invalid credentials or none provided at all), generates the new session for the currently authenticated user instead. On a successful session creation, a session cookie is stored to keep the user authenticated for future API calls. - If CORS is enabled, the origin must match an allowed login origin otherwise an error will be returned. + If `Origin` header is passed to this endpoint, the `Origin` header must match both the `cors.login_origin` and `cors.origin` configuration options. + parameters: + - name: one_time + description: Sets the session to only be valid for a single authentication. This session will expire in 5 minutes if not used. + in: query + schema: + type: boolean requestBody: - description: The body can depend on if using the Public or Admin APIs. + description: When name and password are included in the request body, the session will be created for the specified user. Otherwise the session will be created for the authenticated user making the request. + required: false content: application/json: schema: type: object + title: User Credentials properties: name: - description: User name to generate the session for. + description: User name to generate the session for. Omit this value to generate a session for the authenticated user. type: string password: - description: Password of the user to generate the session for. + description: Password of the user to generate the session for. Omit this value to generate a session for the authenticated user. type: string responses: '200': @@ -135,57 +160,32 @@ paths: content: application/json: schema: - type: object - properties: - authentication_handlers: - description: Used for CouchDB compatability. Always contains "default" and "cookie". - type: array - items: - type: string - enum: - - default - - cookie - ok: - description: Used for CouchDB compatability. Always true. - type: boolean - default: true - userCtx: - type: object + allOf: + - type: object + properties: *ref_0 + required: *ref_1 + title: User Session Information + - type: object properties: - channels: - description: A map of the channels the user is in along with the sequence number the user was granted access. - type: object - additionalProperties: - 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. + one_time_session_id: + description: The id of a single use session if `one_time=true` query parameter was used. type: string - minLength: 1 - required: - - channels - - name - required: - - authentication_handlers - - ok - - userCtx + example: c5af80a039db4ed9d2b6865576b6999935282689 '400': - description: Origin is not in the approved list of allowed origins - content: &ref_45 + description: Value of `Origin` is not in the approved list of allowed origins in `LoginOrigin` of Sync Gateway bootstrap or database configuration. + content: &ref_5 application/json: schema: type: object - properties: *ref_0 - required: *ref_1 + properties: *ref_2 + required: *ref_3 title: HTTP-Error - '404': - description: Resource could not be found - content: *ref_2 + example: + error: Bad Request + reason: No CORS + '401': + description: User does not have access to resource, or resource does not exist + content: *ref_4 tags: - Session operationId: post_db-_session @@ -194,15 +194,28 @@ paths: description: |- Invalidates the session for the currently authenticated user and removes their session cookie. - If CORS is enabled, the origin must match an allowed login origin otherwise an error will be returned. + If `Origin` header is passed to this endpoint, the `Origin` header must match both the `cors.login_origin` and `cors.origin` configuration options. responses: '200': description: Successfully removed session (logged out) '400': - description: Bad Request + description: Value of `Origin` is not in the approved list of allowed origins in `LoginOrigin` of Sync Gateway bootstrap or database configuration. + content: *ref_5 + '401': + description: User does not have access to resource, or resource does not exist + content: *ref_4 '404': - description: Resource could not be found - content: *ref_2 + description: Return if session not found. + content: + application/json: + schema: + type: object + properties: *ref_2 + required: *ref_3 + title: HTTP-Error + example: + error: not_found + reason: no session tags: - Session operationId: delete_db-_session @@ -211,7 +224,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. get: @@ -262,13 +275,13 @@ paths: allOf: - description: The state of the database. type: string - enum: &ref_63 + enum: &ref_65 - Online - Offline - Starting - Stopping - Resyncing - x-enumDescriptions: &ref_64 + x-enumDescriptions: &ref_66 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. @@ -280,7 +293,16 @@ paths: example: 995618a6a6cc9ac79731bd13240e19b5 '404': description: Resource could not be found - content: *ref_2 + content: &ref_7 + application/json: + schema: + type: object + properties: *ref_2 + required: *ref_3 + title: HTTP-Error + example: + error: not_found + reason: no such database "invalid-db" tags: - Database Management operationId: get_db- @@ -292,7 +314,7 @@ paths: description: Database exists '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Database Management operationId: head_db- @@ -307,7 +329,7 @@ paths: application/json: schema: type: object - properties: &ref_67 + properties: &ref_69 ADMIN: description: '`true` if the request is from the Admin API - otherwise omitted.' type: boolean @@ -320,7 +342,7 @@ paths: allOf: - description: Product vendor type: object - properties: &ref_65 + properties: &ref_67 name: description: Product name type: string @@ -331,7 +353,7 @@ paths: Omitted if `api.hide_product_version=true` type: string example: 3.1 - required: &ref_66 + required: &ref_68 - name title: Vendor version: @@ -346,7 +368,7 @@ paths: `true` if the sync gateway node is running in persistent config mode. type: boolean example: true - required: &ref_68 + required: &ref_70 - couchdb - vendor tags: @@ -381,9 +403,9 @@ paths: - name: keyspace in: path required: true - schema: &ref_6 + schema: &ref_10 type: string - examples: &ref_7 + examples: &ref_11 default: summary: Default scope and collection value: db1 @@ -412,7 +434,7 @@ paths: - name: roundtrip in: query required: false - schema: &ref_8 + schema: &ref_12 type: boolean description: Block until document has been received by change cache requestBody: @@ -422,7 +444,7 @@ paths: description: The configurable Sync Gateway properties of a document. type: object additionalProperties: true - properties: &ref_11 + properties: &ref_15 _id: description: The ID of the document. type: string @@ -479,7 +501,7 @@ paths: schema: description: Properties returned when a new document revision is created type: object - properties: &ref_12 + properties: &ref_16 id: description: The ID of the document. type: string @@ -492,40 +514,40 @@ paths: cv: description: The CV of the document. type: string - required: &ref_13 + required: &ref_17 - id - ok - rev title: New-revision '400': description: There was a problem with your request - content: &ref_14 + content: &ref_18 application/json: schema: type: object - properties: *ref_0 - required: *ref_1 + properties: *ref_2 + required: *ref_3 title: HTTP-Error '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 '409': description: Resource already exists under that name - content: &ref_15 + content: &ref_19 application/json: schema: type: object - properties: *ref_0 - required: *ref_1 + properties: *ref_2 + required: *ref_3 title: HTTP-Error '415': description: Invalid content type - content: &ref_16 + content: &ref_20 application/json: schema: type: object - properties: *ref_0 - required: *ref_1 + properties: *ref_2 + required: *ref_3 title: HTTP-Error tags: - Document @@ -536,13 +558,13 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. - name: ddoc in: path required: true - schema: &ref_5 + schema: &ref_9 type: string description: The design document name. get: @@ -559,7 +581,7 @@ paths: schema: description: Properties of a design document type: object - properties: &ref_4 + properties: &ref_8 language: type: string views: @@ -588,7 +610,7 @@ paths: 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: *ref_2 + content: *ref_7 tags: - Unsupported operationId: get_db-_design-ddoc @@ -604,7 +626,7 @@ paths: schema: description: Properties of a design document type: object - properties: *ref_4 + properties: *ref_8 responses: '200': description: Design document changes successfully @@ -612,7 +634,7 @@ paths: 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: *ref_2 + content: *ref_7 tags: - Unsupported operationId: put_db-_design-ddoc @@ -629,7 +651,7 @@ paths: 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: *ref_2 + content: *ref_7 tags: - Unsupported operationId: delete_db-_design-ddoc @@ -641,7 +663,7 @@ paths: 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: *ref_2 + content: *ref_7 tags: - Unsupported description: |- @@ -656,18 +678,18 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. - name: ddoc in: path required: true - schema: *ref_5 + schema: *ref_9 description: The design document name. - name: view in: path required: true - schema: &ref_46 + schema: &ref_49 type: string description: The view to target. get: @@ -681,67 +703,67 @@ paths: in: query required: false description: Indicates whether the specified end key should be included in the result. - schema: &ref_47 + schema: &ref_50 type: boolean - name: descending in: query required: false description: Return documents in descending order. - schema: &ref_48 + schema: &ref_51 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: &ref_49 + schema: &ref_52 type: boolean - name: reduce in: query required: false description: Whether to execute a reduce function on the response or not. - schema: &ref_50 + schema: &ref_53 type: boolean - name: group in: query required: false description: Group the results using the reduce function to a group or single row. - schema: &ref_51 + schema: &ref_54 type: boolean - name: skip in: query required: false description: Skip the specified number of documents before starting to return results. - schema: &ref_52 + schema: &ref_55 type: integer - name: limit in: query required: false description: Return only the specified number of documents - schema: &ref_53 + schema: &ref_56 type: integer - name: group_level in: query required: false description: Specify the group level to be used. - schema: &ref_54 + schema: &ref_57 type: integer - name: startkey_docid in: query required: false description: Return documents starting with the specified document identifier. - schema: &ref_55 + schema: &ref_58 type: string - name: endkey_docid in: query required: false description: Stop returning records when the specified document identifier is reached. - schema: &ref_56 + schema: &ref_59 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: &ref_57 + schema: &ref_60 type: string enum: - ok @@ -749,25 +771,25 @@ paths: - name: startkey in: query required: false - schema: &ref_29 + schema: &ref_33 type: string description: Return records starting with the specified key. - name: endkey in: query required: false - schema: &ref_30 + schema: &ref_34 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: &ref_58 + schema: &ref_61 type: string - name: keys in: query required: false - schema: &ref_28 + schema: &ref_32 type: array items: type: string @@ -811,7 +833,7 @@ paths: description: Forbidden '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Unsupported operationId: get_db-_design-ddoc-_view-view @@ -820,8 +842,8 @@ paths: - name: keyspace in: path required: true - schema: *ref_6 - examples: *ref_7 + schema: *ref_10 + examples: *ref_11 description: |- The keyspace to run the operation against. @@ -829,7 +851,7 @@ paths: - name: docid in: path required: true - schema: &ref_25 + schema: &ref_29 type: string example: doc1 description: The document ID to run the operation against. @@ -840,14 +862,14 @@ paths: - name: rev in: query required: false - schema: &ref_10 + schema: &ref_14 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: &ref_19 + schema: &ref_23 type: array items: type: string @@ -855,13 +877,13 @@ paths: - name: show_exp in: query required: false - schema: &ref_20 + schema: &ref_24 type: boolean description: Whether to show the expiry property (`_exp`) in the response. - name: revs_from in: query required: false - schema: &ref_21 + schema: &ref_25 type: array items: type: string @@ -869,7 +891,7 @@ paths: - name: atts_since in: query required: false - schema: &ref_22 + schema: &ref_26 type: array items: type: string @@ -877,19 +899,19 @@ paths: - name: revs_limit in: query required: false - schema: &ref_23 + schema: &ref_27 type: integer description: Maximum amount of revisions to return for each document. - name: attachments in: query required: false - schema: &ref_24 + schema: &ref_28 type: boolean description: Include attachment bodies in response. - name: replicator2 in: query required: false - schema: &ref_9 + schema: &ref_13 type: boolean description: Returns the document with the required properties for replication. This is an enterprise-edition only feature. responses: @@ -927,24 +949,24 @@ paths: 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: &ref_18 + content: &ref_22 application/json: schema: type: object - properties: *ref_0 - required: *ref_1 + properties: *ref_2 + required: *ref_3 title: HTTP-Error '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 '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: *ref_0 - required: *ref_1 + properties: *ref_2 + required: *ref_3 title: HTTP-Error tags: - Document @@ -963,30 +985,30 @@ paths: - name: roundtrip in: query required: false - schema: *ref_8 + schema: *ref_12 description: Block until document has been received by change cache - name: replicator2 in: query required: false - schema: *ref_9 + schema: *ref_13 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: &ref_59 + schema: &ref_62 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: *ref_10 + schema: *ref_14 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: &ref_17 + schema: &ref_21 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: @@ -996,7 +1018,7 @@ paths: description: The configurable Sync Gateway properties of a document. type: object additionalProperties: true - properties: *ref_11 + properties: *ref_15 responses: '201': description: Created @@ -1010,21 +1032,21 @@ paths: schema: description: Properties returned when a new document revision is created type: object - properties: *ref_12 - required: *ref_13 + properties: *ref_16 + required: *ref_17 title: New-revision '400': description: There was a problem with your request - content: *ref_14 + content: *ref_18 '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 '409': description: Resource already exists under that name - content: *ref_15 + content: *ref_19 '415': description: Invalid content type - content: *ref_16 + content: *ref_20 tags: - Document operationId: put_keyspace-docid @@ -1038,31 +1060,31 @@ paths: - name: rev in: query required: false - schema: *ref_10 + schema: *ref_14 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: *ref_17 + schema: *ref_21 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: &ref_75 + content: &ref_77 application/json: schema: description: Properties returned when a new document revision is created type: object - properties: *ref_12 - required: *ref_13 + properties: *ref_16 + required: *ref_17 title: New-revision '400': description: There was a problem with your request - content: *ref_14 + content: *ref_18 '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Document operationId: delete_keyspace-docid @@ -1075,10 +1097,10 @@ paths: 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: *ref_18 + content: *ref_22 '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Document summary: Check if a document exists @@ -1086,43 +1108,43 @@ paths: - name: rev in: query required: false - schema: *ref_10 + schema: *ref_14 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: *ref_19 + schema: *ref_23 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: *ref_20 + schema: *ref_24 description: Whether to show the expiry property (`_exp`) in the response. - name: revs_from in: query required: false - schema: *ref_21 + schema: *ref_25 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: *ref_22 + schema: *ref_26 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: *ref_23 + schema: *ref_27 description: Maximum amount of revisions to return for each document. - name: attachments in: query required: false - schema: *ref_24 + schema: *ref_28 description: Include attachment bodies in response. - name: replicator2 in: query required: false - schema: *ref_9 + schema: *ref_13 description: Returns the document with the required properties for replication. This is an enterprise-edition only feature. description: Return a status code based on if the document exists or not. operationId: head_keyspace-docid @@ -1131,8 +1153,8 @@ paths: - name: keyspace in: path required: true - schema: *ref_6 - examples: *ref_7 + schema: *ref_10 + examples: *ref_11 description: |- The keyspace to run the operation against. @@ -1140,7 +1162,7 @@ paths: - name: docid in: path required: true - schema: *ref_25 + schema: *ref_29 example: doc1 description: The document ID to run the operation against. - name: attach @@ -1161,7 +1183,7 @@ paths: - name: rev in: query required: false - schema: *ref_10 + schema: *ref_14 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 @@ -1198,7 +1220,7 @@ paths: description: Partial attachment content returned '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 '416': description: Requested range exceeds content length tags: @@ -1249,15 +1271,15 @@ paths: schema: description: Properties returned when a new document revision is created type: object - properties: *ref_12 - required: *ref_13 + properties: *ref_16 + required: *ref_17 title: New-revision '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 '409': description: Resource already exists under that name - content: *ref_15 + content: *ref_19 tags: - Document Attachment operationId: put_keyspace-docid-attach @@ -1276,7 +1298,7 @@ paths: description: The attachment digest. '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Document Attachment summary: Check if attachment exists @@ -1285,7 +1307,7 @@ paths: - name: rev in: query required: false - schema: *ref_10 + schema: *ref_14 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.) operationId: head_keyspace-docid-attach @@ -1319,15 +1341,15 @@ paths: schema: description: Properties returned when a new document revision is created type: object - properties: *ref_12 - required: *ref_13 + properties: *ref_16 + required: *ref_17 title: New-revision '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 '409': description: Resource already exists under that name - content: *ref_15 + content: *ref_19 tags: - Document Attachment operationId: delete_keyspace-docid-attach @@ -1336,8 +1358,8 @@ paths: - name: keyspace in: path required: true - schema: *ref_6 - examples: *ref_7 + schema: *ref_10 + examples: *ref_11 description: |- The keyspace to run the operation against. @@ -1377,7 +1399,7 @@ paths: - name: include_docs in: query required: false - schema: &ref_27 + schema: &ref_31 type: boolean description: Include the body associated with each document. - name: revocations @@ -1445,12 +1467,12 @@ paths: responses: '200': description: Successfully returned the changes feed - content: &ref_26 + content: &ref_30 application/json: schema: description: Properties of a changes feed type: object - properties: &ref_69 + properties: &ref_71 results: type: array items: @@ -1486,10 +1508,10 @@ paths: type: string '400': description: There was a problem with your request - content: *ref_14 + content: *ref_18 '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Document operationId: get_keyspace-_changes @@ -1541,13 +1563,13 @@ paths: responses: '200': description: Successfully returned the changes feed - content: *ref_26 + content: *ref_30 '400': description: There was a problem with your request - content: *ref_14 + content: *ref_18 '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Document operationId: post_keyspace-_changes @@ -1556,8 +1578,8 @@ paths: - name: keyspace in: path required: true - schema: *ref_6 - examples: *ref_7 + schema: *ref_10 + examples: *ref_11 description: |- The keyspace to run the operation against. @@ -1573,57 +1595,57 @@ paths: - name: include_docs in: query required: false - schema: *ref_27 + schema: *ref_31 description: Include the body associated with each document. - name: channels in: query required: false - schema: &ref_31 + schema: &ref_35 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: &ref_32 + schema: &ref_36 type: boolean description: Include what user/roles that each document grants access too. - name: revs in: query required: false - schema: &ref_33 + schema: &ref_37 type: boolean description: Include all the revisions for each document under the `_revisions` property. - name: update_seq in: query required: false - schema: &ref_34 + schema: &ref_38 type: boolean description: Include the document sequence number `update_seq` property for each document. - name: keys in: query required: false - schema: *ref_28 + schema: *ref_32 description: An array of document ID strings to filter by. - name: startkey in: query required: false - schema: *ref_29 + schema: *ref_33 description: Return records starting with the specified key. - name: endkey in: query required: false - schema: *ref_30 + schema: *ref_34 description: Stop returning records when this key is reached. - name: limit in: query required: false - schema: &ref_35 + schema: &ref_39 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: &ref_36 + content: &ref_40 application/json: schema: type: object @@ -1655,19 +1677,19 @@ paths: - update_seq '400': description: There was a problem with your request - content: *ref_14 + content: *ref_18 '403': description: This API endpoint has been disabled by the administrator. content: application/json: schema: type: object - properties: *ref_0 - required: *ref_1 + properties: *ref_2 + required: *ref_3 title: HTTP-Error '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Document operationId: get_keyspace-_all_docs @@ -1682,42 +1704,42 @@ paths: - name: include_docs in: query required: false - schema: *ref_27 + schema: *ref_31 description: Include the body associated with each document. - name: channels in: query required: false - schema: *ref_31 + schema: *ref_35 description: Include the channels each document is part of that the calling user also has access too. - name: access in: query required: false - schema: *ref_32 + schema: *ref_36 description: Include what user/roles that each document grants access too. - name: revs in: query required: false - schema: *ref_33 + schema: *ref_37 description: Include all the revisions for each document under the `_revisions` property. - name: update_seq in: query required: false - schema: *ref_34 + schema: *ref_38 description: Include the document sequence number `update_seq` property for each document. - name: startkey in: query required: false - schema: *ref_29 + schema: *ref_33 description: Return records starting with the specified key. - name: endkey in: query required: false - schema: *ref_30 + schema: *ref_34 description: Stop returning records when this key is reached. - name: limit in: query required: false - schema: *ref_35 + schema: *ref_39 description: This limits the number of result rows returned. Using a value of `0` has the same effect as the value `1`. requestBody: content: @@ -1735,22 +1757,22 @@ paths: responses: '200': description: Operation ran successfully - content: *ref_36 + content: *ref_40 '400': description: There was a problem with your request - content: *ref_14 + content: *ref_18 '403': description: This API endpoint has been disabled by the administrator. content: application/json: schema: type: object - properties: *ref_0 - required: *ref_1 + properties: *ref_2 + required: *ref_3 title: HTTP-Error '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Document operationId: post_keyspace-_all_docs @@ -1759,8 +1781,8 @@ paths: - name: keyspace in: path required: true - schema: *ref_6 - examples: *ref_7 + schema: *ref_10 + examples: *ref_11 description: |- The keyspace to run the operation against. @@ -1791,7 +1813,7 @@ paths: description: The configurable Sync Gateway properties of a document. type: object additionalProperties: true - properties: *ref_11 + properties: *ref_15 required: - docs example: @@ -1860,10 +1882,10 @@ paths: status: 409 '400': description: There was a problem with your request - content: *ref_14 + content: *ref_18 '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Document operationId: post_keyspace-_bulk_docs @@ -1872,8 +1894,8 @@ paths: - name: keyspace in: path required: true - schema: *ref_6 - examples: *ref_7 + schema: *ref_10 + examples: *ref_11 description: |- The keyspace to run the operation against. @@ -1898,7 +1920,7 @@ paths: - name: revs in: query required: false - schema: *ref_33 + schema: *ref_37 description: Include all the revisions for each document under the `_revisions` property. - name: revs_limit in: query @@ -1945,7 +1967,7 @@ paths: description: Bad Request '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Document operationId: post_keyspace-_bulk_get @@ -1954,8 +1976,8 @@ paths: - name: keyspace in: path required: true - schema: *ref_6 - examples: *ref_7 + schema: *ref_10 + examples: *ref_11 description: |- The keyspace to run the operation against. @@ -1977,10 +1999,10 @@ paths: description: Successfully found local document '400': description: There was a problem with your request - content: *ref_14 + content: *ref_18 '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Document operationId: get_keyspace-_local-docid @@ -2008,15 +2030,15 @@ paths: schema: description: Properties returned when a new document revision is created type: object - properties: *ref_12 - required: *ref_13 + properties: *ref_16 + required: *ref_17 title: New-revision '400': description: There was a problem with your request - content: *ref_14 + content: *ref_18 '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 '409': description: A conflict would result from updating this document revision. tags: @@ -2040,10 +2062,10 @@ paths: description: Successfully removed the local document. '400': description: There was a problem with your request - content: *ref_14 + content: *ref_18 '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 '409': description: A revision ID conflict would result from deleting this document revision. tags: @@ -2055,10 +2077,10 @@ paths: description: Document exists '400': description: There was a problem with your request - content: *ref_14 + content: *ref_18 '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Document summary: Check if local document exists @@ -2072,8 +2094,8 @@ paths: - name: keyspace in: path required: true - schema: *ref_6 - examples: *ref_7 + schema: *ref_10 + examples: *ref_11 description: |- The keyspace to run the operation against. @@ -2116,7 +2138,7 @@ paths: type: string '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 tags: - Document operationId: post_keyspace-_revs_diff @@ -2125,7 +2147,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. get: @@ -2135,13 +2157,13 @@ paths: - name: provider in: query required: false - schema: &ref_37 + schema: &ref_41 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: &ref_38 + schema: &ref_42 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: @@ -2156,7 +2178,7 @@ paths: 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: *ref_2 + content: *ref_7 '500': description: Unable to connect and validate with the OpenID Connect provider requested tags: @@ -2167,7 +2189,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. get: @@ -2177,12 +2199,12 @@ paths: - name: provider in: query required: false - schema: *ref_37 + schema: *ref_41 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: *ref_38 + schema: *ref_42 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': @@ -2196,7 +2218,7 @@ paths: description: The OpenID Connect authentication URL. '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 '500': description: Unable to connect and validate with the OpenID Connect provider requested tags: @@ -2207,7 +2229,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. get: @@ -2222,28 +2244,28 @@ paths: - name: code in: query required: true - schema: &ref_60 + schema: &ref_63 type: string description: The OpenID Connect authentication code. - name: provider in: query required: false - schema: *ref_37 + schema: *ref_41 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: &ref_61 + schema: &ref_64 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: &ref_39 + content: &ref_43 application/json: schema: type: object - properties: &ref_70 + properties: &ref_72 id_token: description: The OpenID Connect ID token type: string @@ -2272,7 +2294,7 @@ paths: 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: *ref_2 + content: *ref_7 '500': description: A problem occurred in regards to the token content: @@ -2292,7 +2314,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. get: @@ -2308,17 +2330,17 @@ paths: - name: provider in: query required: false - schema: *ref_37 + schema: *ref_41 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: *ref_39 + content: *ref_43 '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: *ref_2 + content: *ref_7 '500': description: Unable to connect and validate with the OpenID Connect provider requested tags: @@ -2330,7 +2352,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. get: @@ -2375,7 +2397,7 @@ paths: 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: *ref_2 + content: *ref_7 tags: - Unsupported operationId: get_db-_oidc_testing-.well-known-openid-configuration @@ -2385,7 +2407,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. get: @@ -2395,7 +2417,7 @@ paths: - name: scope in: query required: true - schema: &ref_40 + schema: &ref_44 type: string description: The OpenID Connect authentication scope. responses: @@ -2403,26 +2425,26 @@ paths: description: OK '400': description: A validation error occurred with the scope. - content: &ref_41 + content: &ref_45 application/json: schema: type: object - properties: *ref_0 - required: *ref_1 + properties: *ref_2 + required: *ref_3 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: *ref_2 + content: *ref_7 '500': description: An error occurred. - content: &ref_42 + content: &ref_46 application/json: schema: type: object - properties: *ref_0 - required: *ref_1 + properties: *ref_2 + required: *ref_3 title: HTTP-Error tags: - Unsupported @@ -2434,22 +2456,22 @@ paths: - name: scope in: query required: true - schema: *ref_40 + schema: *ref_44 description: The OpenID Connect authentication scope. responses: '200': description: OK '400': description: A validation error occurred with the scope. - content: *ref_41 + content: *ref_45 '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: *ref_2 + content: *ref_7 '500': description: An error occurred. - content: *ref_42 + content: *ref_46 tags: - Unsupported operationId: post_db-_oidc_testing-authorize @@ -2459,7 +2481,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. post: @@ -2485,12 +2507,12 @@ paths: responses: '200': description: Properties expected back from an OpenID Connect provider after successful authentication - content: &ref_76 + content: &ref_78 application/json: schema: description: Properties expected back from an OpenID Connect provider after successful authentication type: object - properties: &ref_71 + properties: &ref_73 access_token: type: string token_type: @@ -2508,7 +2530,7 @@ paths: 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: *ref_2 + content: *ref_7 tags: - Unsupported operationId: post_db-_oidc_testing-token @@ -2518,7 +2540,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. get: @@ -2559,7 +2581,7 @@ paths: 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: *ref_2 + content: *ref_7 '500': description: An error occurred while getting the private RSA key content: @@ -2580,7 +2602,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. get: @@ -2590,13 +2612,13 @@ paths: - name: redirect_uri in: query required: false - schema: &ref_43 + schema: &ref_47 type: string description: The Sync Gateway OpenID Connect callback URL. - name: scope in: query required: true - schema: *ref_40 + schema: *ref_44 description: The OpenID Connect authentication scope. - name: username in: query @@ -2621,7 +2643,7 @@ paths: responses: '302': description: Redirecting to Sync Gateway OpenID Connect callback URL - headers: &ref_44 + headers: &ref_48 Location: schema: type: string @@ -2630,7 +2652,7 @@ paths: 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: *ref_2 + content: *ref_7 tags: - Unsupported operationId: get_db-_oidc_testing-authenticate @@ -2641,20 +2663,20 @@ paths: - name: redirect_uri in: query required: false - schema: *ref_43 + schema: *ref_47 description: The Sync Gateway OpenID Connect callback URL. - name: scope in: query required: true - schema: *ref_40 + schema: *ref_44 description: The OpenID Connect authentication scope. requestBody: - content: &ref_77 + content: &ref_79 application/json: schema: description: Properties passed from the OpenID Connect mock login page to the handler type: object - properties: &ref_72 + properties: &ref_74 username: type: string tokenttl: @@ -2663,7 +2685,7 @@ paths: type: string authenticated: type: string - required: &ref_73 + required: &ref_75 - username - tokenttl - identity-token-formats @@ -2672,12 +2694,12 @@ paths: responses: '302': description: Redirecting to Sync Gateway OpenID Connect callback URL - headers: *ref_44 + headers: *ref_48 '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: *ref_2 + content: *ref_7 tags: - Unsupported operationId: post_db-_oidc_testing-authenticate @@ -2686,7 +2708,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. get: @@ -2707,15 +2729,15 @@ paths: description: Upgraded to a web socket connection '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 '426': description: Cannot upgrade connection to a web socket connection content: application/json: schema: type: object - properties: *ref_0 - required: *ref_1 + properties: *ref_2 + required: *ref_3 title: HTTP-Error example: error: Upgrade Required @@ -2748,7 +2770,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. post: @@ -2756,7 +2778,7 @@ paths: description: |- Creates a new session based on a Facebook user. On a successful session creation, a session cookie is stored to keep the user authenticated for future API calls. - If CORS is enabled, the origin must match an allowed login origin otherwise an error will be returned. + 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: @@ -2772,8 +2794,8 @@ paths: '200': description: Session created successfully '400': - description: Origin is not in the approved list of allowed origins - content: *ref_45 + description: Value of `Origin` is not in the approved list of allowed origins in `LoginOrigin` of Sync Gateway bootstrap or database configuration. + content: *ref_5 '401': description: Received error from Facebook verifier content: @@ -2787,7 +2809,7 @@ paths: type: string '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 '502': description: Received invalid response from the Facebook verifier content: @@ -2820,7 +2842,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. post: @@ -2828,7 +2850,7 @@ paths: description: |- Creates a new session based on a Google user. On a successful session creation, a session cookie is stored to keep the user authenticated for future API calls. - If CORS is enabled, the origin must match an allowed login origin otherwise an error will be returned. + 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: @@ -2844,8 +2866,8 @@ paths: '200': description: Session created successfully '400': - description: Origin is not in the approved list of allowed origins - content: *ref_45 + description: Value of `Origin` is not in the approved list of allowed origins in `LoginOrigin` of Sync Gateway bootstrap or database configuration. + content: *ref_5 '401': description: Received error from Google token verifier or invalid application ID in the config content: @@ -2859,7 +2881,7 @@ paths: type: string '404': description: Resource could not be found - content: *ref_2 + content: *ref_7 '502': description: Received invalid response from the Google token verifier content: @@ -2882,7 +2904,7 @@ paths: - name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. post: @@ -2920,15 +2942,15 @@ components: name: db in: path required: true - schema: *ref_3 + schema: *ref_6 example: db1 description: The name of the database to run the operation against. keyspace: name: keyspace in: path required: true - schema: *ref_6 - examples: *ref_7 + schema: *ref_10 + examples: *ref_11 description: |- The keyspace to run the operation against. @@ -2937,327 +2959,331 @@ components: name: roundtrip in: query required: false - schema: *ref_8 + schema: *ref_12 description: Block until document has been received by change cache ddoc: name: ddoc in: path required: true - schema: *ref_5 + schema: *ref_9 description: The design document name. view: name: view in: path required: true - schema: *ref_46 + schema: *ref_49 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: *ref_47 + schema: *ref_50 descending: name: descending in: query required: false description: Return documents in descending order. - schema: *ref_48 + schema: *ref_51 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: *ref_49 + schema: *ref_52 reduce: name: reduce in: query required: false description: Whether to execute a reduce function on the response or not. - schema: *ref_50 + schema: *ref_53 group: name: group in: query required: false description: Group the results using the reduce function to a group or single row. - schema: *ref_51 + schema: *ref_54 skip: name: skip in: query required: false description: Skip the specified number of documents before starting to return results. - schema: *ref_52 + schema: *ref_55 limit: name: limit in: query required: false description: Return only the specified number of documents - schema: *ref_53 + schema: *ref_56 group_level: name: group_level in: query required: false description: Specify the group level to be used. - schema: *ref_54 + schema: *ref_57 startkey_docid: name: startkey_docid in: query required: false description: Return documents starting with the specified document identifier. - schema: *ref_55 + schema: *ref_58 endkey_docid: name: endkey_docid in: query required: false description: Stop returning records when the specified document identifier is reached. - schema: *ref_56 + schema: *ref_59 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: *ref_57 + schema: *ref_60 startkey: name: startkey in: query required: false - schema: *ref_29 + schema: *ref_33 description: Return records starting with the specified key. endkey: name: endkey in: query required: false - schema: *ref_30 + schema: *ref_34 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: *ref_58 + schema: *ref_61 keys: name: keys in: query required: false - schema: *ref_28 + schema: *ref_32 description: An array of document ID strings to filter by. docid: name: docid in: path required: true - schema: *ref_25 + schema: *ref_29 example: doc1 description: The document ID to run the operation against. rev: name: rev in: query required: false - schema: *ref_10 + schema: *ref_14 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: *ref_19 + schema: *ref_23 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: *ref_20 + schema: *ref_24 description: Whether to show the expiry property (`_exp`) in the response. revs_from: name: revs_from in: query required: false - schema: *ref_21 + schema: *ref_25 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: *ref_22 + schema: *ref_26 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: *ref_23 + schema: *ref_27 description: Maximum amount of revisions to return for each document. includeAttachments: name: attachments in: query required: false - schema: *ref_24 + schema: *ref_28 description: Include attachment bodies in response. replicator2: name: replicator2 in: query required: false - schema: *ref_9 + schema: *ref_13 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: *ref_59 + schema: *ref_62 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. Document-If-Match: name: If-Match in: header required: false - schema: *ref_17 + schema: *ref_21 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. include_docs: name: include_docs in: query required: false - schema: *ref_27 + schema: *ref_31 description: Include the body associated with each document. Include-channels: name: channels in: query required: false - schema: *ref_31 + schema: *ref_35 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: *ref_32 + schema: *ref_36 description: Include what user/roles that each document grants access too. include-revs: name: revs in: query required: false - schema: *ref_33 + schema: *ref_37 description: Include all the revisions for each document under the `_revisions` property. include-seqs: name: update_seq in: query required: false - schema: *ref_34 + schema: *ref_38 description: Include the document sequence number `update_seq` property for each document. limit-result-rows: name: limit in: query required: false - schema: *ref_35 + schema: *ref_39 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: *ref_37 + schema: *ref_41 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: *ref_38 + schema: *ref_42 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: *ref_60 + schema: *ref_63 description: The OpenID Connect authentication code. oidc-state: name: state in: query required: false - schema: *ref_61 + schema: *ref_64 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: *ref_40 + schema: *ref_44 description: The OpenID Connect authentication scope. oidc-redirect_uri: name: redirect_uri in: query required: false - schema: *ref_43 + schema: *ref_47 description: The Sync Gateway OpenID Connect callback URL. schemas: User-session-information: type: object - properties: *ref_62 + properties: *ref_0 + required: *ref_1 title: User Session Information HTTP-Error: type: object - properties: *ref_0 - required: *ref_1 + properties: *ref_2 + required: *ref_3 title: HTTP-Error DatabaseState: description: The state of the database. type: string - enum: *ref_63 - x-enumDescriptions: *ref_64 + enum: *ref_65 + x-enumDescriptions: *ref_66 Vendor: description: Product vendor type: object - properties: *ref_65 - required: *ref_66 + properties: *ref_67 + required: *ref_68 title: Vendor NodeInfo: type: object - properties: *ref_67 - required: *ref_68 + properties: *ref_69 + required: *ref_70 Document: description: The configurable Sync Gateway properties of a document. type: object additionalProperties: true - properties: *ref_11 + properties: *ref_15 New-revision: description: Properties returned when a new document revision is created type: object - properties: *ref_12 - required: *ref_13 + properties: *ref_16 + required: *ref_17 title: New-revision Design-doc: description: Properties of a design document type: object - properties: *ref_4 + properties: *ref_8 Changes-feed: description: Properties of a changes feed type: object - properties: *ref_69 + properties: *ref_71 OIDC-callback: type: object - properties: *ref_70 + properties: *ref_72 title: OpenID Connect callback properties OIDC-token: description: Properties expected back from an OpenID Connect provider after successful authentication type: object - properties: *ref_71 + properties: *ref_73 title: OIDC-token OIDC-login-page-handler: description: Properties passed from the OpenID Connect mock login page to the handler type: object - properties: *ref_72 - required: *ref_73 + properties: *ref_74 + required: *ref_75 responses: User-session-information: description: Properties associated with a user session - content: *ref_74 + content: *ref_76 + Unauthorized: + description: User does not have access to resource, or resource does not exist + content: *ref_4 + 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: *ref_5 Not-found: description: Resource could not be found - content: *ref_2 - Invalid-CORS: - description: Origin is not in the approved list of allowed origins - content: *ref_45 + content: *ref_7 request-problem: description: There was a problem with your request - content: *ref_14 + content: *ref_18 Conflict: description: Resource already exists under that name - content: *ref_15 + content: *ref_19 Invalid-content-type: description: Invalid content type - content: *ref_16 + content: *ref_20 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: @@ -3265,38 +3291,38 @@ components: 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: *ref_18 + content: *ref_22 New-revision: description: New revision created successfully - content: *ref_75 + content: *ref_77 changes-feed: description: Successfully returned the changes feed - content: *ref_26 + content: *ref_30 all-docs: description: Operation ran successfully - content: *ref_36 + content: *ref_40 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: *ref_39 + content: *ref_43 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: *ref_41 + content: *ref_45 OIDC-testing-internal-error: description: An error occurred. - content: *ref_42 + content: *ref_46 OIDC-token: description: Properties expected back from an OpenID Connect provider after successful authentication - content: *ref_76 + content: *ref_78 OIDC-testing-redirect: description: Redirecting to Sync Gateway OpenID Connect callback URL - headers: *ref_44 + headers: *ref_48 requestBodies: OIDC-login-page-handler: - content: *ref_77 + content: *ref_79 description: Properties passed from the OpenID Connect mock login page to the handler diff --git a/modules/ROOT/partials/sgw-openapi-admin.html b/modules/ROOT/partials/sgw-openapi-admin.html index bef51057..7bcb09c0 100644 --- a/modules/ROOT/partials/sgw-openapi-admin.html +++ b/modules/ROOT/partials/sgw-openapi-admin.html @@ -1,5 +1,5 @@ - -

Sync Gateway Admin REST API (4.0)

Download OpenAPI specification:

Introduction

Sync Gateway Admin REST API (4.0)

Download OpenAPI specification:

Introduction

The Sync Gateway Admin REST API is used to administer user accounts and roles, and to run administrative tasks in superuser mode.

-

Authentication

Authentication

Manage authentication

-

OpenID Connect authentication initiation via Location header redirect

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

-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
provider
string

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.

+

OpenID Connect authentication initiation via Location header redirect

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

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
provider
string

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
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

OpenID Connect authentication initiation via WWW-Authenticate header

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.

-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
provider
string

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.

+" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Unable to connect and validate with the OpenID Connect provider requested

+

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

OpenID Connect authentication initiation via WWW-Authenticate header

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.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
provider
string

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
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

OpenID Connect authentication callback

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

-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
error
string

The OpenID Connect error, if any occurred.

+" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Unable to connect and validate with the OpenID Connect provider requested

+

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

OpenID Connect authentication callback

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

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
error
string

The OpenID Connect error, if any occurred.

code
required
string

The OpenID Connect authentication code.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The OpenID Connect authentication code.

provider
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

state
string

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).

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Response samples

Content type
application/json
{
  • "id_token": "string",
  • "refresh_token": "string",
  • "session_id": "string",
  • "name": "string",
  • "access_token": "string",
  • "token_type": "string",
  • "expires_in": 0
}

OpenID Connect token refresh

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

-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
refresh_token
required
string

The OpenID Connect refresh token.

+" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

A problem occurred in regards to the token

+

Response samples

Content type
application/json
{
  • "id_token": "string",
  • "refresh_token": "string",
  • "session_id": "string",
  • "name": "string",
  • "access_token": "string",
  • "token_type": "string",
  • "expires_in": 0
}

OpenID Connect token refresh

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

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
refresh_token
required
string

The OpenID Connect refresh token.

provider
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Response samples

Content type
application/json
{
  • "id_token": "string",
  • "refresh_token": "string",
  • "session_id": "string",
  • "name": "string",
  • "access_token": "string",
  • "token_type": "string",
  • "expires_in": 0
}

Create a new Facebook-based session Deprecated

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

-

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

-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
Request Body schema: application/json
access_token
required
string

Facebook access token to base the new session on.

+" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Unable to connect and validate with the OpenID Connect provider requested

+

Response samples

Content type
application/json
{
  • "id_token": "string",
  • "refresh_token": "string",
  • "session_id": "string",
  • "name": "string",
  • "access_token": "string",
  • "token_type": "string",
  • "expires_in": 0
}

Create a new Facebook-based session Deprecated

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.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
Request Body schema: application/json
access_token
required
string

Facebook access token to base the new session on.

Responses

Request samples

Content type
application/json
{
  • "access_token": "string"
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Create a new Google-based session Deprecated

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

-

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

-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
Request Body schema: application/json
id_token
required
string

Google ID token to base the new session on.

+" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Unable to send request to Facebook API

+

Request samples

Content type
application/json
{
  • "access_token": "string"
}

Response samples

Content type
application/json
{
  • "error": "Bad Request",
  • "reason": "No CORS"
}

Create a new Google-based session Deprecated

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.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
Request Body schema: application/json
id_token
required
string

Google ID token to base the new session on.

Responses

Request samples

Content type
application/json
{
  • "id_token": "string"
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Server

Unable to send request to the Google token verifier

+

Request samples

Content type
application/json
{
  • "id_token": "string"
}

Response samples

Content type
application/json
{
  • "error": "Bad Request",
  • "reason": "No CORS"
}

Server

Manage server activities

-

Get server configuration

Get server configuration

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
query Parameters
redact
boolean
Deprecated
Default: true

No longer supported field.

+
query Parameters
redact
boolean
Deprecated
Default: true

No longer supported field.

include_runtime
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Responses

Response samples

Content type
application/json
{
  • "api": {
    },
  • "auth": {
    },
  • "bootstrap": {
    },
  • "bucket_credentials": {
    },
  • "database_credentials": {
    },
  • "heap_profile_collection_threshold": 0,
  • "heap_profile_disable_collection": false,
  • "logging": {
    },
  • "max_file_descriptors": 5000,
  • "replicator": {
    },
  • "unsupported": {
    },
  • "couchbase_keepalive_interval": 0
}

Set runtime configuration

There was a problem with your request

+

Response samples

Content type
application/json
{
  • "api": {
    },
  • "auth": {
    },
  • "bootstrap": {
    },
  • "bucket_credentials": {
    },
  • "database_credentials": {
    },
  • "heap_profile_collection_threshold": 0,
  • "heap_profile_disable_collection": false,
  • "logging": {
    },
  • "max_file_descriptors": 5000,
  • "replicator": {
    },
  • "unsupported": {
    },
  • "couchbase_keepalive_interval": 0
}

Set runtime configuration

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
Request Body schema: application/json
object
max_concurrent_replications
integer
Default: 0

Maximum number of concurrent replication connections allowed. If set to 0 this limit will be ignored.

+
Request Body schema: application/json
object
max_concurrent_replications
integer
Default: 0

Maximum number of concurrent replication connections allowed. If set to 0 this limit will be ignored.

Responses

Request samples

Content type
application/json
{
  • "logging": {
    },
  • "max_concurrent_replications": 0
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get the server status

There was a problem with your request

+

Request samples

Content type
application/json
{
  • "logging": {
    },
  • "max_concurrent_replications": 0
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get the server status

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

Required Sync Gateway RBAC roles:

  • Sync Gateway Dev Ops

Responses

Response samples

Content type
application/json
{
  • "databases": {
    },
  • "version": "string",
  • "vendor": {
    }
}

Get the status of the Sync Gateway Collect Info

There was a problem with your request

+

Response samples

Content type
application/json
{
  • "databases": {
    },
  • "version": "string",
  • "vendor": {
    }
}

Get the status of the Sync Gateway Collect Info

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

Response samples

Content type
application/json
{
  • "status": "stopped"
}

Start Sync Gateway Collect Info

Returned sgcollect_info status

+

Response samples

Content type
application/json
{
  • "status": "stopped"
}

Start Sync Gateway Collect Info

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
Request Body schema: application/json

sgcollect_info options

-
redact_level
string
Default: "partial"
Enum: "partial" "none"

The redaction level to use for redacting the collected logs.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

sgcollect_info options

+
redact_level
string
Default: "partial"
Enum: "partial" "none"

The redaction level to use for redacting the collected logs.

redact_salt
string

The salt to use for the log redactions.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The salt to use for the log redactions.

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

The directory to output the collected logs zip file at.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

upload
boolean

If set, upload the logs to Couchbase Support.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

If set, upload the logs to Couchbase Support.

A customer name must be set if this is set.

upload_host
string
Default: "https://uploads.couchbase.com"

The host to send the logs too.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The host to send the logs too.

upload_proxy
string

The proxy to use while uploading the logs.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The proxy to use while uploading the logs.

customer
string

The customer name to use when uploading the logs.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The customer name to use when uploading the logs.

ticket
string [ 1 .. 7 ] characters

The Zendesk ticket number to use when uploading logs.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The Zendesk ticket number to use when uploading logs.

Responses

Request samples

Content type
application/json
{
  • "redact_level": "partial",
  • "redact_salt": "string",
  • "output_dir": "The configured path set in the startup config `logging.log_file_path`",
  • "upload": true,
  • "upload_proxy": "string",
  • "customer": "string",
  • "ticket": "string"
}

Response samples

Content type
application/json
{
  • "status": "started"
}

Cancel the Sync Gateway Collect Info job

An error occurred while trying to run sgcollect_info

+

Request samples

Content type
application/json
{
  • "redact_level": "partial",
  • "redact_salt": "string",
  • "output_dir": "The configured path set in the startup config `logging.log_file_path`",
  • "upload": true,
  • "upload_proxy": "string",
  • "customer": "string",
  • "ticket": "string"
}

Response samples

Content type
application/json
{
  • "status": "started"
}

Cancel the Sync Gateway Collect Info job

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

Response samples

Content type
application/json
{
  • "status": "cancelled"
}

Run the post upgrade process on all databases

There was a problem with your request

+

Response samples

Content type
application/json
{
  • "status": "cancelled"
}

Run the post upgrade process on all databases

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
query Parameters
preview
boolean
Default: false

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

+
query Parameters
preview
boolean
Default: false

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

Responses

Response samples

Content type
application/json
{
  • "post_upgrade_results": {
    },
  • "preview": true
}

Get server information

Returns information about the Sync Gateway node.

+" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Returned results

+

Response samples

Content type
application/json
{
  • "post_upgrade_results": {
    },
  • "preview": true
}

Get server information

Returns information about the Sync Gateway node.

Responses

Response samples

Content type
application/json
{
  • "ADMIN": true,
  • "couchdb": "Welcome",
  • "vendor": {
    },
  • "version": "Couchbase Sync Gateway/3.1.0(1;a765231) EE",
  • "persistent_config": true
}

Check if server online

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

+" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Returned server information

+

Response samples

Content type
application/json
{
  • "ADMIN": true,
  • "couchdb": "Welcome",
  • "vendor": {
    },
  • "version": "Couchbase Sync Gateway/3.1.0(1;a765231) EE",
  • "persistent_config": true
}

Check if server online

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

Responses

Check if API is available

Returns OK status if API is available.

+" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Server is online

+

Check if API is available

Returns OK status if API is available.

Responses

Response samples

Content type
text/plain
OK

Get console logging settings Deprecated

Returned status

+

Response samples

Content type
text/plain
OK

Get console logging settings Deprecated

Deprecated in favour of GET /_config +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

Response samples

Content type
application/json
{
  • "HTTP": true,
  • "CRUD": false,
  • "Changes": true
}

Set console logging settings Deprecated

Returned map of console log keys

+

Response samples

Content type
application/json
{
  • "HTTP": true,
  • "CRUD": false,
  • "Changes": true
}

Set console logging settings Deprecated

Deprecated in favour of PUT /_config +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
query Parameters
logLevel
string
Enum: "none" "error" "warn" "info" "debug" "trace"

The is what to set the console log level too.

+
query Parameters
logLevel
string
Enum: "none" "error" "warn" "info" "debug" "trace"

The is what to set the console log level too.

level
integer [ 1 .. 3 ]
Deprecated

Deprecated: use log level instead.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.'

Request Body schema: application/json

The map of log keys to use for console logging.

-
property name*
additional property
boolean

The log key and whether it is enabled or not.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

The map of log keys to use for console logging.

+
property name*
additional property
boolean

The log key and whether it is enabled or not.

Responses

Request samples

Content type
application/json
{
  • "HTTP": true,
  • "CRUD": false,
  • "Changes": true
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Update console logging settings Deprecated

There was a problem with your request

+

Request samples

Content type
application/json
{
  • "HTTP": true,
  • "CRUD": false,
  • "Changes": true
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Update console logging settings Deprecated

Deprecated in favour of PUT /_config +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
query Parameters
logLevel
string
Enum: "none" "error" "warn" "info" "debug" "trace"

The is what to set the console log level too.

+
query Parameters
logLevel
string
Enum: "none" "error" "warn" "info" "debug" "trace"

The is what to set the console log level too.

level
integer [ 1 .. 3 ]
Deprecated

Deprecated: use log level instead.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.'

Request Body schema: application/json

The console log keys to upsert.

-
property name*
additional property
boolean

The log key and whether it is enabled or not.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

The console log keys to upsert.

+
property name*
additional property
boolean

The log key and whether it is enabled or not.

Responses

Request samples

Content type
application/json
{
  • "HTTP": true,
  • "CRUD": false,
  • "Changes": true
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Database Management

There was a problem with your request

+

Request samples

Content type
application/json
{
  • "HTTP": true,
  • "CRUD": false,
  • "Changes": true
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Database Management

Create and manage Sync Gateway databases

-

Get database information

Get database information

Retrieve information about the database.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

Retrieve information about the database.

Required Sync Gateway RBAC roles:

  • Sync Gateway Dev Ops
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Responses

Response samples

Content type
application/json
{
  • "db_name": "db",
  • "update_seq": 123456,
  • "committed_update_seq": 123456,
  • "instance_start_time": 1644600082279583,
  • "compact_running": true,
  • "purge_seq": 0,
  • "disk_format_version": 0,
  • "state": "Online",
  • "server_uuid": "995618a6a6cc9ac79731bd13240e19b5",
  • "require_resync": true,
  • "init_in_progress": true
}

Remove a database

Resource could not be found

+

Response samples

Content type
application/json
{
  • "db_name": "db",
  • "update_seq": 123456,
  • "committed_update_seq": 123456,
  • "instance_start_time": 1644600082279583,
  • "compact_running": true,
  • "purge_seq": 0,
  • "disk_format_version": 0,
  • "state": "Online",
  • "server_uuid": "995618a6a6cc9ac79731bd13240e19b5",
  • "require_resync": true,
  • "init_in_progress": true
}

Remove a database

Removes a database from the Sync Gateway cluster

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Responses

Response samples

Content type
application/json
{ }

Check if database exists

Cannot remove database from bucket

+

Response samples

Content type
application/json
{ }

Check if database exists

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

Required Sync Gateway RBAC roles:

  • Sync Gateway Dev Ops
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Responses

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Create a new Sync Gateway database

Resource could not be found

+

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Create a new Sync Gateway database

This is to create a new database for Sync Gateway.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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.

@@ -877,221 +877,221 @@
  • Sync Gateway Architect
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
disable_oidc_validation
boolean
Default: false

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

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
disable_oidc_validation
boolean
Default: false

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

Request Body schema: application/json

The configuration to use for the new database

-
allow_empty_password
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

The configuration to use for the new database

+
allow_empty_password
boolean
Default: false

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

bucket
string
Default: "The database name"

The Couchbase Server backing bucket for the database.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The Couchbase Server backing bucket for the database.

bucket_op_timeout_ms
number

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

cacertpath
string

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

-
object
certpath
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

+
object
certpath
string

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

changes_request_plus
boolean
Default: false

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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 or request_plus for POST /{keyspace}/_changes.

client_partition_window_secs
integer
Default: 2592000

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Defaults to 30 days (in seconds)

compact_interval_days
number
Default: 1

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

-
object

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

+
object (Cors Configuration)

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

object

Delta sync configuration settings.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Delta sync configuration settings.

This is an Enterprise Edition feature only

disable_password_auth
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

disable_public_all_docs
boolean
Default: false

This controls whether the GET /{keyspace}/_all_docs REST API endpoint is publicly accessible or not. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

This controls whether the 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 or 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.

object

These are the settings for webhooks.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

These are the settings for webhooks.

object (User)

Properties associated with a user

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Properties associated with a user

import_backup_old_rev
boolean
Default: false

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

import_docs
boolean

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

import_filter
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

import_partitions
number [ 1 .. 1024 ]
Default: 16

** This is an Enterprise Edition feature only**

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

** 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.

object

Global Secondary Index Settings

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Global Secondary Index Settings

javascript_timeout_secs
number
Default: 60

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

keypath
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

kv_tls_port
integer
Default: 11207

The Memcached TLS port.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The Memcached TLS port.

local_doc_expiry_secs
integer
Default: 7776000

The number of seconds before a _local document should expire.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The number of seconds before a _local document should expire.

object

Configuration for Local JWT authentication.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Configuration for Local JWT authentication.

object

Per-database logging configuration.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Per-database logging configuration.

max_concurrent_query_ops
integer
Default: 1000

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

name
string

The name of the database.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the database.

offline
boolean
Default: false

Start the database in an offline state.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Start the database in an offline state.

object

Configuration for OpenID Connect authentication.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Configuration for OpenID Connect authentication.

old_rev_expiry_seconds
number
Default: 300

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

password
string

The password for authenticating to the server.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The password for authenticating to the server.

query_pagination_limit
integer
Default: 5000

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

-
object
revs_limit
number >= 0
Default: 50

The maximum depth a document's revision tree can grow to.

-
object
object <= 1 properties

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

+
object
revs_limit
number >= 0
Default: 50

The maximum depth a document's revision tree can grow to.

+
object
object <= 1 properties

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

send_www_authenticate_header
boolean
Default: true

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

serve_insecure_attachment_types
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

server
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

session_cookie_http_only
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

session_cookie_name
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

session_cookie_secure
boolean

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

sgreplicate_enabled
boolean
Default: true

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

sgreplicate_websocket_heartbeat_secs
integer
Default: 300

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

slow_query_warning_threshold
number
Default: 500

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

store_legacy_revtree_data
boolean
Default: true

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).

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

suspendable
boolean
Default: false

Set to true to allow the database to be suspended.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Set to true to allow the database to be suspended.

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

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

The Javascript function that newly created documents are ran through for the default scope and collection.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The Javascript function that newly created documents are ran through for the default scope and collection.

If scopes parameter is set, this is ignored.

object

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

use_views
boolean
Default: false

Force the use of views instead of GSI.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Force the use of views instead of GSI.

user_xattr_key
string <= 15

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

username
string

The username for authenticating to the server.

-
object
view_query_timeout_secs
integer
Default: 75

The number of seconds before a view query should timeout.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The username for authenticating to the server.

+
object
view_query_timeout_secs
integer
Default: 75

The number of seconds before a view query should timeout.

allow_conflicts
boolean
Deprecated
Default: false

Since Sync Gateway 4.0, this option has no effect. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

enable_shared_bucket_access
boolean
Deprecated
Default: true

Since Sync Gateway 4.0, this option has no effect. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

feed_type
string
Deprecated
Default: "DCP"
Value: "DCP"

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

num_index_replicas
number
Deprecated
Default: 1

Deprecated, please use the database setting index.num_replicas instead

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Deprecated, please use the database setting index.num_replicas instead

pool
string
Deprecated
Default: "default"

This field is unsupported and ignored.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

This field is unsupported and ignored.

rev_cache_size
number
Deprecated

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

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

Responses

Request samples

Content type
application/json
{
  • "allow_empty_password": false,
  • "bucket": "The database name",
  • "bucket_op_timeout_ms": 0,
  • "cacertpath": "string",
  • "cache": {
    },
  • "certpath": "string",
  • "changes_request_plus": false,
  • "client_partition_window_secs": 2592000,
  • "compact_interval_days": 1,
  • "cors": {
    },
  • "delta_sync": {
    },
  • "disable_password_auth": false,
  • "disable_public_all_docs": false,
  • "event_handlers": {
    },
  • "guest": {
    },
  • "import_backup_old_rev": false,
  • "import_docs": true,
  • "import_filter": "function(doc) { if (doc.type != 'mobile') { return false; } return true; }",
  • "import_partitions": 16,
  • "index": {
    },
  • "javascript_timeout_secs": 60,
  • "keypath": "string",
  • "kv_tls_port": 11207,
  • "local_doc_expiry_secs": 7776000,
  • "local_jwt": {
    },
  • "logging": {
    },
  • "max_concurrent_query_ops": 1000,
  • "name": "string",
  • "offline": false,
  • "oidc": {
    },
  • "old_rev_expiry_seconds": 300,
  • "password": "string",
  • "query_pagination_limit": 5000,
  • "replications": {
    },
  • "revs_limit": 50,
  • "roles": {
    },
  • "scopes": {
    },
  • "send_www_authenticate_header": true,
  • "serve_insecure_attachment_types": false,
  • "server": "string",
  • "session_cookie_http_only": false,
  • "session_cookie_name": "string",
  • "session_cookie_secure": true,
  • "sgreplicate_enabled": true,
  • "sgreplicate_websocket_heartbeat_secs": 300,
  • "slow_query_warning_threshold": 500,
  • "store_legacy_revtree_data": true,
  • "suspendable": false,
  • "sync": "function(doc){channel(doc.channels);}",
  • "unsupported": {
    },
  • "use_views": false,
  • "user_xattr_key": "string",
  • "username": "string",
  • "users": {
    },
  • "view_query_timeout_secs": 75,
  • "allow_conflicts": false,
  • "enable_shared_bucket_access": true,
  • "feed_type": "DCP",
  • "num_index_replicas": 1,
  • "pool": "default",
  • "rev_cache_size": 0
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get a list of all the databases

A server error occurred

+

Request samples

Content type
application/json
{
  • "allow_empty_password": false,
  • "bucket": "The database name",
  • "bucket_op_timeout_ms": 0,
  • "cacertpath": "string",
  • "cache": {
    },
  • "certpath": "string",
  • "changes_request_plus": false,
  • "client_partition_window_secs": 2592000,
  • "compact_interval_days": 1,
  • "cors": {},
  • "delta_sync": {
    },
  • "disable_password_auth": false,
  • "disable_public_all_docs": false,
  • "event_handlers": {
    },
  • "guest": {
    },
  • "import_backup_old_rev": false,
  • "import_docs": true,
  • "import_filter": "function(doc) { if (doc.type != 'mobile') { return false; } return true; }",
  • "import_partitions": 16,
  • "index": {
    },
  • "javascript_timeout_secs": 60,
  • "keypath": "string",
  • "kv_tls_port": 11207,
  • "local_doc_expiry_secs": 7776000,
  • "local_jwt": {
    },
  • "logging": {
    },
  • "max_concurrent_query_ops": 1000,
  • "name": "string",
  • "offline": false,
  • "oidc": {
    },
  • "old_rev_expiry_seconds": 300,
  • "password": "string",
  • "query_pagination_limit": 5000,
  • "replications": {
    },
  • "revs_limit": 50,
  • "roles": {
    },
  • "scopes": {
    },
  • "send_www_authenticate_header": true,
  • "serve_insecure_attachment_types": false,
  • "server": "string",
  • "session_cookie_http_only": false,
  • "session_cookie_name": "string",
  • "session_cookie_secure": true,
  • "sgreplicate_enabled": true,
  • "sgreplicate_websocket_heartbeat_secs": 300,
  • "slow_query_warning_threshold": 500,
  • "store_legacy_revtree_data": true,
  • "suspendable": false,
  • "sync": "function(doc){channel(doc.channels);}",
  • "unsupported": {
    },
  • "use_views": false,
  • "user_xattr_key": "string",
  • "username": "string",
  • "users": {
    },
  • "view_query_timeout_secs": 75,
  • "allow_conflicts": false,
  • "enable_shared_bucket_access": true,
  • "feed_type": "DCP",
  • "num_index_replicas": 1,
  • "pool": "default",
  • "rev_cache_size": 0
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get a list of all the databases

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
query Parameters
verbose
boolean

Responses

Response samples

Content type
application/json
Example
[
  • "db1",
  • "db2"
]

Get resync status

query Parameters
verbose
boolean

Responses

Response samples

Content type
application/json
Example
[
  • "db1",
  • "db2"
]

Get resync status

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Responses

Response samples

Content type
application/json
{
  • "status": "running",
  • "start_time": "string",
  • "last_error": "string",
  • "docs_changed": 0,
  • "docs_processed": 0,
  • "collections_processing": {
    }
}

Start or stop Resync

Resource could not be found

+

Response samples

Content type
application/json
{
  • "status": "running",
  • "start_time": "string",
  • "last_error": "string",
  • "docs_changed": 0,
  • "docs_processed": 0,
  • "collections_processing": {
    }
}

Start or stop Resync

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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 with {"offline": true} to set the database to offline.

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

@@ -1115,25 +1115,25 @@
  • Sync Gateway Architect
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
action
string
Default: "start"
Enum: "start" "stop"

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

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
action
string
Default: "start"
Enum: "start" "stop"

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

regenerate_sequences
boolean

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

reset
boolean
Default: false

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

-
Request Body schema: application/json
object

This controls for which collections resync will run

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

+
Request Body schema: application/json
object

This controls for which collections resync will run

regenerate_sequences
boolean
Default: false

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

Responses

Request samples

Content type
application/json
{
  • "scopes": {
    },
  • "regenerate_sequences": false
}

Response samples

Content type
application/json
{
  • "status": "running",
  • "start_time": "string",
  • "last_error": "string",
  • "docs_changed": 0,
  • "docs_processed": 0,
  • "collections_processing": {
    }
}

Start asynchronous index initialization

Service Unavailable

+

Request samples

Content type
application/json
{
  • "scopes": {
    },
  • "regenerate_sequences": false
}

Response samples

Content type
application/json
{
  • "status": "running",
  • "start_time": "string",
  • "last_error": "string",
  • "docs_changed": 0,
  • "docs_processed": 0,
  • "collections_processing": {
    }
}

Start asynchronous index initialization

This can be used to start index initialization with different parameters from a running database. The typical workflow is:

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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.
  2. Wait for index initialization to complete with GET /{db}/_index_init.
  3. @@ -1157,47 +1157,47 @@
    • Sync Gateway Architect
    -
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
action
string
Default: "start"
Enum Description
start

Starts the creation of indexes.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
action
string
Default: "start"
Enum Description
start

Starts the creation of indexes.

stop

Stops tracking the index creation by Sync Gateway. These indexes will still be created on Couchbase Server.

+" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Stops tracking the index creation by Sync Gateway. These indexes will still be created on Couchbase Server.

Defines whether the index creation operation is being started or stopped.

-
Request Body schema: application/json
create_separate_principal_indexes
boolean
Default: false

Defines whether the index creation operation is being started or stopped.

+
Request Body schema: application/json
create_separate_principal_indexes
boolean
Default: false

Whether to create separate indexes for users and roles instead of a single larger syncDocs index.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

num_partitions
number (Number of Index Partitions)
Default: 1

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 for more information.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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 for more information.

If not specified or 1, all indexes will be non partitioned.

Responses

Request samples

Content type
application/json
{
  • "create_separate_principal_indexes": false,
  • "num_partitions": 1
}

Response samples

Content type
application/json
{
  • "status": "completed",
  • "start_time": "string",
  • "last_error": "string",
  • "index_status": {
    },
  • "settings": {
    }
}

Get status of index initialization

Service Unavailable

+

Request samples

Content type
application/json
{
  • "create_separate_principal_indexes": false,
  • "num_partitions": 1
}

Response samples

Content type
application/json
{
  • "status": "completed",
  • "start_time": "string",
  • "last_error": "string",
  • "index_status": {
    },
  • "settings": {
    }
}

Get status of index initialization

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Responses

Response samples

Content type
application/json
{
  • "status": "completed",
  • "start_time": "string",
  • "last_error": "string",
  • "index_status": {
    },
  • "settings": {
    }
}

Bring the database online

Resource could not be found

+

Response samples

Content type
application/json
{
  • "status": "completed",
  • "start_time": "string",
  • "last_error": "string",
  • "index_status": {
    },
  • "settings": {
    }
}

Bring the database online

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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 with {"offline": false} to set the database to online.

Bringing a database online will:

    @@ -1231,21 +1231,21 @@
    • Sync Gateway Architect
    -
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Request Body schema: application/json

Add an optional delay to wait before bringing the database online

-
delay
integer
Default: 0

The amount of seconds to delay bringing the database online.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

Add an optional delay to wait before bringing the database online

+
delay
integer
Default: 0

The amount of seconds to delay bringing the database online.

Responses

Request samples

Content type
application/json
{
  • "delay": 0
}

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Take the database offline

An error occurred

+

Request samples

Content type
application/json
{
  • "delay": 0
}

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Take the database offline

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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 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.

@@ -1275,17 +1275,17 @@
  • Sync Gateway Architect
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Responses

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Manage a compact operation

An error occurred while trying to take the database offline

+

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Manage a compact operation

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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.
  • @@ -1307,697 +1307,697 @@
    • Sync Gateway Architect
    -
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
type
string
Default: "tombstone"
Enum: "attachment" "tombstone"
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
type
string
Default: "tombstone"
Enum: "attachment" "tombstone"

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.'
action
string
Default: "start"
Enum: "start" "stop"

Defines whether the compact operation is being started or stopped.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Defines whether the compact operation is being started or stopped.

reset
boolean

Attachment compaction only

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Attachment compaction only

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

dry_run
boolean

Attachment compaction only

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.'

Responses

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get the status of the most recent compact operation

Cannot start compaction due to another compaction operation still running.

+

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get the status of the most recent compact operation

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

Required Sync Gateway RBAC roles:

  • Sync Gateway Architect
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
type
string
Default: "tombstone"
Enum: "attachment" "tombstone"
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
type
string
Default: "tombstone"
Enum: "attachment" "tombstone"

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Response samples

Content type
application/json
{
  • "status": "string",
  • "start_time": "string",
  • "last_error": "string",
  • "docs_purged": "string",
  • "marked_attachments": "string",
  • "purged_attachments": "string",
  • "compact_id": "string",
  • "phase": "string",
  • "dry_run": "mark"
}

Manage a attachment migration operation

Resource could not be found

+

Response samples

Content type
application/json
{
  • "status": "string",
  • "start_time": "string",
  • "last_error": "string",
  • "docs_purged": "string",
  • "marked_attachments": "string",
  • "purged_attachments": "string",
  • "compact_id": "string",
  • "phase": "string",
  • "dry_run": "mark"
}

Manage a attachment migration operation

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
action
string
Default: "start"
Enum: "start" "stop"

Defines whether the an attachment migration operation is being started or stopped.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
action
string
Default: "start"
Enum: "start" "stop"

Defines whether the an attachment migration operation is being started or stopped.

reset
boolean

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Responses

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get the status of the most recent attachment migration operation

Cannot start attachment migration due to another migration operation still running.

+

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get the status of the most recent attachment migration operation

This will retrieve the current status of the most recent attachment migration operation.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

This will retrieve the current status of the most recent attachment migration operation.

Required Sync Gateway RBAC roles:

  • Sync Gateway Architect
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Responses

Response samples

Content type
application/json
{
  • "status": "running",
  • "start_time": "string",
  • "last_error": "string",
  • "migration_id": "string",
  • "docs_changed": 0,
  • "docs_processed": 0,
  • "docs_failed": 0
}

Ensure Full Commit Deprecated

Resource could not be found

+

Response samples

Content type
application/json
{
  • "status": "running",
  • "start_time": "string",
  • "last_error": "string",
  • "migration_id": "string",
  • "docs_changed": 0,
  • "docs_processed": 0,
  • "docs_failed": 0
}

Ensure Full Commit Deprecated

This endpoint is non-functional but is present for CouchDB compatibility. This was deprecated in CouchDB 3.0.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Responses

Response samples

Content type
application/json
{
  • "instance_start_time": 1644600082279583,
  • "ok": true
}

Database Configuration

OK

+

Response samples

Content type
application/json
{
  • "instance_start_time": 1644600082279583,
  • "ok": true
}

Database Configuration

Configure Sync Gateway databases

-

Get database configuration

Get database configuration

Retrieve the full configuration for the database specified.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

Retrieve the full configuration for the database specified.

Required Sync Gateway RBAC roles:

  • Sync Gateway Architect
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
redact
boolean
Deprecated
Default: true

No longer supported field.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
redact
boolean
Deprecated
Default: true

No longer supported field.

include_javascript
boolean
Default: true

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

include_runtime
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

refresh_config
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Responses

Response samples

Content type
application/json
{
  • "allow_empty_password": false,
  • "bucket": "The database name",
  • "bucket_op_timeout_ms": 0,
  • "cacertpath": "string",
  • "cache": {
    },
  • "certpath": "string",
  • "changes_request_plus": false,
  • "client_partition_window_secs": 2592000,
  • "compact_interval_days": 1,
  • "cors": {
    },
  • "delta_sync": {
    },
  • "disable_password_auth": false,
  • "disable_public_all_docs": false,
  • "event_handlers": {
    },
  • "guest": {
    },
  • "import_backup_old_rev": false,
  • "import_docs": true,
  • "import_filter": "function(doc) { if (doc.type != 'mobile') { return false; } return true; }",
  • "import_partitions": 16,
  • "index": {
    },
  • "javascript_timeout_secs": 60,
  • "keypath": "string",
  • "kv_tls_port": 11207,
  • "local_doc_expiry_secs": 7776000,
  • "local_jwt": {
    },
  • "logging": {
    },
  • "max_concurrent_query_ops": 1000,
  • "name": "string",
  • "offline": false,
  • "oidc": {
    },
  • "old_rev_expiry_seconds": 300,
  • "password": "string",
  • "query_pagination_limit": 5000,
  • "replications": {
    },
  • "revs_limit": 50,
  • "roles": {
    },
  • "scopes": {
    },
  • "send_www_authenticate_header": true,
  • "serve_insecure_attachment_types": false,
  • "server": "string",
  • "session_cookie_http_only": false,
  • "session_cookie_name": "string",
  • "session_cookie_secure": true,
  • "sgreplicate_enabled": true,
  • "sgreplicate_websocket_heartbeat_secs": 300,
  • "slow_query_warning_threshold": 500,
  • "store_legacy_revtree_data": true,
  • "suspendable": false,
  • "sync": "function(doc){channel(doc.channels);}",
  • "unsupported": {
    },
  • "use_views": false,
  • "user_xattr_key": "string",
  • "username": "string",
  • "users": {
    },
  • "view_query_timeout_secs": 75,
  • "allow_conflicts": false,
  • "enable_shared_bucket_access": true,
  • "feed_type": "DCP",
  • "num_index_replicas": 1,
  • "pool": "default",
  • "rev_cache_size": 0
}

Replace database configuration

Resource could not be found

+

Response samples

Content type
application/json
{
  • "allow_empty_password": false,
  • "bucket": "The database name",
  • "bucket_op_timeout_ms": 0,
  • "cacertpath": "string",
  • "cache": {
    },
  • "certpath": "string",
  • "changes_request_plus": false,
  • "client_partition_window_secs": 2592000,
  • "compact_interval_days": 1,
  • "cors": {},
  • "delta_sync": {
    },
  • "disable_password_auth": false,
  • "disable_public_all_docs": false,
  • "event_handlers": {
    },
  • "guest": {
    },
  • "import_backup_old_rev": false,
  • "import_docs": true,
  • "import_filter": "function(doc) { if (doc.type != 'mobile') { return false; } return true; }",
  • "import_partitions": 16,
  • "index": {
    },
  • "javascript_timeout_secs": 60,
  • "keypath": "string",
  • "kv_tls_port": 11207,
  • "local_doc_expiry_secs": 7776000,
  • "local_jwt": {
    },
  • "logging": {
    },
  • "max_concurrent_query_ops": 1000,
  • "name": "string",
  • "offline": false,
  • "oidc": {
    },
  • "old_rev_expiry_seconds": 300,
  • "password": "string",
  • "query_pagination_limit": 5000,
  • "replications": {
    },
  • "revs_limit": 50,
  • "roles": {
    },
  • "scopes": {
    },
  • "send_www_authenticate_header": true,
  • "serve_insecure_attachment_types": false,
  • "server": "string",
  • "session_cookie_http_only": false,
  • "session_cookie_name": "string",
  • "session_cookie_secure": true,
  • "sgreplicate_enabled": true,
  • "sgreplicate_websocket_heartbeat_secs": 300,
  • "slow_query_warning_threshold": 500,
  • "store_legacy_revtree_data": true,
  • "suspendable": false,
  • "sync": "function(doc){channel(doc.channels);}",
  • "unsupported": {
    },
  • "use_views": false,
  • "user_xattr_key": "string",
  • "username": "string",
  • "users": {
    },
  • "view_query_timeout_secs": 75,
  • "allow_conflicts": false,
  • "enable_shared_bucket_access": true,
  • "feed_type": "DCP",
  • "num_index_replicas": 1,
  • "pool": "default",
  • "rev_cache_size": 0
}

Replace database configuration

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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)
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
disable_oidc_validation
boolean
Default: false

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

-
header Parameters
If-Match
string

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.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
disable_oidc_validation
boolean
Default: false

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

+
header Parameters
If-Match
string

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.

Request Body schema: application/json

The new database configuration to use

-
allow_empty_password
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

The new database configuration to use

+
allow_empty_password
boolean
Default: false

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

bucket
string
Default: "The database name"

The Couchbase Server backing bucket for the database.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The Couchbase Server backing bucket for the database.

bucket_op_timeout_ms
number

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

cacertpath
string

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

-
object
certpath
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

+
object
certpath
string

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

changes_request_plus
boolean
Default: false

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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 or request_plus for POST /{keyspace}/_changes.

client_partition_window_secs
integer
Default: 2592000

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Defaults to 30 days (in seconds)

compact_interval_days
number
Default: 1

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

-
object

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

+
object (Cors Configuration)

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

object

Delta sync configuration settings.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Delta sync configuration settings.

This is an Enterprise Edition feature only

disable_password_auth
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

disable_public_all_docs
boolean
Default: false

This controls whether the GET /{keyspace}/_all_docs REST API endpoint is publicly accessible or not. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

This controls whether the 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 or 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.

object

These are the settings for webhooks.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

These are the settings for webhooks.

object (User)

Properties associated with a user

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Properties associated with a user

import_backup_old_rev
boolean
Default: false

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

import_docs
boolean

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

import_filter
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

import_partitions
number [ 1 .. 1024 ]
Default: 16

** This is an Enterprise Edition feature only**

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

** 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.

object

Global Secondary Index Settings

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Global Secondary Index Settings

javascript_timeout_secs
number
Default: 60

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

keypath
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

kv_tls_port
integer
Default: 11207

The Memcached TLS port.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The Memcached TLS port.

local_doc_expiry_secs
integer
Default: 7776000

The number of seconds before a _local document should expire.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The number of seconds before a _local document should expire.

object

Configuration for Local JWT authentication.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Configuration for Local JWT authentication.

object

Per-database logging configuration.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Per-database logging configuration.

max_concurrent_query_ops
integer
Default: 1000

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

name
string

The name of the database.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the database.

offline
boolean
Default: false

Start the database in an offline state.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Start the database in an offline state.

object

Configuration for OpenID Connect authentication.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Configuration for OpenID Connect authentication.

old_rev_expiry_seconds
number
Default: 300

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

password
string

The password for authenticating to the server.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The password for authenticating to the server.

query_pagination_limit
integer
Default: 5000

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

-
object
revs_limit
number >= 0
Default: 50

The maximum depth a document's revision tree can grow to.

-
object
object <= 1 properties

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

+
object
revs_limit
number >= 0
Default: 50

The maximum depth a document's revision tree can grow to.

+
object
object <= 1 properties

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

send_www_authenticate_header
boolean
Default: true

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

serve_insecure_attachment_types
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

server
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

session_cookie_http_only
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

session_cookie_name
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

session_cookie_secure
boolean

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

sgreplicate_enabled
boolean
Default: true

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

sgreplicate_websocket_heartbeat_secs
integer
Default: 300

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

slow_query_warning_threshold
number
Default: 500

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

store_legacy_revtree_data
boolean
Default: true

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).

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

suspendable
boolean
Default: false

Set to true to allow the database to be suspended.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Set to true to allow the database to be suspended.

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

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

The Javascript function that newly created documents are ran through for the default scope and collection.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The Javascript function that newly created documents are ran through for the default scope and collection.

If scopes parameter is set, this is ignored.

object

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

use_views
boolean
Default: false

Force the use of views instead of GSI.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Force the use of views instead of GSI.

user_xattr_key
string <= 15

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

username
string

The username for authenticating to the server.

-
object
view_query_timeout_secs
integer
Default: 75

The number of seconds before a view query should timeout.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The username for authenticating to the server.

+
object
view_query_timeout_secs
integer
Default: 75

The number of seconds before a view query should timeout.

allow_conflicts
boolean
Deprecated
Default: false

Since Sync Gateway 4.0, this option has no effect. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

enable_shared_bucket_access
boolean
Deprecated
Default: true

Since Sync Gateway 4.0, this option has no effect. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

feed_type
string
Deprecated
Default: "DCP"
Value: "DCP"

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

num_index_replicas
number
Deprecated
Default: 1

Deprecated, please use the database setting index.num_replicas instead

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Deprecated, please use the database setting index.num_replicas instead

pool
string
Deprecated
Default: "default"

This field is unsupported and ignored.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

This field is unsupported and ignored.

rev_cache_size
number
Deprecated

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

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

Responses

Request samples

Content type
application/json
{
  • "allow_empty_password": false,
  • "bucket": "The database name",
  • "bucket_op_timeout_ms": 0,
  • "cacertpath": "string",
  • "cache": {
    },
  • "certpath": "string",
  • "changes_request_plus": false,
  • "client_partition_window_secs": 2592000,
  • "compact_interval_days": 1,
  • "cors": {
    },
  • "delta_sync": {
    },
  • "disable_password_auth": false,
  • "disable_public_all_docs": false,
  • "event_handlers": {
    },
  • "guest": {
    },
  • "import_backup_old_rev": false,
  • "import_docs": true,
  • "import_filter": "function(doc) { if (doc.type != 'mobile') { return false; } return true; }",
  • "import_partitions": 16,
  • "index": {
    },
  • "javascript_timeout_secs": 60,
  • "keypath": "string",
  • "kv_tls_port": 11207,
  • "local_doc_expiry_secs": 7776000,
  • "local_jwt": {
    },
  • "logging": {
    },
  • "max_concurrent_query_ops": 1000,
  • "name": "string",
  • "offline": false,
  • "oidc": {
    },
  • "old_rev_expiry_seconds": 300,
  • "password": "string",
  • "query_pagination_limit": 5000,
  • "replications": {
    },
  • "revs_limit": 50,
  • "roles": {
    },
  • "scopes": {
    },
  • "send_www_authenticate_header": true,
  • "serve_insecure_attachment_types": false,
  • "server": "string",
  • "session_cookie_http_only": false,
  • "session_cookie_name": "string",
  • "session_cookie_secure": true,
  • "sgreplicate_enabled": true,
  • "sgreplicate_websocket_heartbeat_secs": 300,
  • "slow_query_warning_threshold": 500,
  • "store_legacy_revtree_data": true,
  • "suspendable": false,
  • "sync": "function(doc){channel(doc.channels);}",
  • "unsupported": {
    },
  • "use_views": false,
  • "user_xattr_key": "string",
  • "username": "string",
  • "users": {
    },
  • "view_query_timeout_secs": 75,
  • "allow_conflicts": false,
  • "enable_shared_bucket_access": true,
  • "feed_type": "DCP",
  • "num_index_replicas": 1,
  • "pool": "default",
  • "rev_cache_size": 0
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Update database configuration

Request samples

Content type
application/json
{
  • "allow_empty_password": false,
  • "bucket": "The database name",
  • "bucket_op_timeout_ms": 0,
  • "cacertpath": "string",
  • "cache": {
    },
  • "certpath": "string",
  • "changes_request_plus": false,
  • "client_partition_window_secs": 2592000,
  • "compact_interval_days": 1,
  • "cors": {},
  • "delta_sync": {
    },
  • "disable_password_auth": false,
  • "disable_public_all_docs": false,
  • "event_handlers": {
    },
  • "guest": {
    },
  • "import_backup_old_rev": false,
  • "import_docs": true,
  • "import_filter": "function(doc) { if (doc.type != 'mobile') { return false; } return true; }",
  • "import_partitions": 16,
  • "index": {
    },
  • "javascript_timeout_secs": 60,
  • "keypath": "string",
  • "kv_tls_port": 11207,
  • "local_doc_expiry_secs": 7776000,
  • "local_jwt": {
    },
  • "logging": {
    },
  • "max_concurrent_query_ops": 1000,
  • "name": "string",
  • "offline": false,
  • "oidc": {
    },
  • "old_rev_expiry_seconds": 300,
  • "password": "string",
  • "query_pagination_limit": 5000,
  • "replications": {
    },
  • "revs_limit": 50,
  • "roles": {
    },
  • "scopes": {
    },
  • "send_www_authenticate_header": true,
  • "serve_insecure_attachment_types": false,
  • "server": "string",
  • "session_cookie_http_only": false,
  • "session_cookie_name": "string",
  • "session_cookie_secure": true,
  • "sgreplicate_enabled": true,
  • "sgreplicate_websocket_heartbeat_secs": 300,
  • "slow_query_warning_threshold": 500,
  • "store_legacy_revtree_data": true,
  • "suspendable": false,
  • "sync": "function(doc){channel(doc.channels);}",
  • "unsupported": {
    },
  • "use_views": false,
  • "user_xattr_key": "string",
  • "username": "string",
  • "users": {
    },
  • "view_query_timeout_secs": 75,
  • "allow_conflicts": false,
  • "enable_shared_bucket_access": true,
  • "feed_type": "DCP",
  • "num_index_replicas": 1,
  • "pool": "default",
  • "rev_cache_size": 0
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Update database configuration

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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)
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
header Parameters
If-Match
string

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.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
header Parameters
If-Match
string

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.

Request Body schema: application/json

The database configuration fields to update

-
allow_empty_password
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

The database configuration fields to update

+
allow_empty_password
boolean
Default: false

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

bucket
string
Default: "The database name"

The Couchbase Server backing bucket for the database.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The Couchbase Server backing bucket for the database.

bucket_op_timeout_ms
number

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

cacertpath
string

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

-
object
certpath
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

+
object
certpath
string

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

changes_request_plus
boolean
Default: false

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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 or request_plus for POST /{keyspace}/_changes.

client_partition_window_secs
integer
Default: 2592000

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Defaults to 30 days (in seconds)

compact_interval_days
number
Default: 1

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

-
object

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

+
object (Cors Configuration)

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

object

Delta sync configuration settings.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Delta sync configuration settings.

This is an Enterprise Edition feature only

disable_password_auth
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

disable_public_all_docs
boolean
Default: false

This controls whether the GET /{keyspace}/_all_docs REST API endpoint is publicly accessible or not. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

This controls whether the 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 or 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.

object

These are the settings for webhooks.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

These are the settings for webhooks.

object (User)

Properties associated with a user

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Properties associated with a user

import_backup_old_rev
boolean
Default: false

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

import_docs
boolean

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

import_filter
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

import_partitions
number [ 1 .. 1024 ]
Default: 16

** This is an Enterprise Edition feature only**

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

** 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.

object

Global Secondary Index Settings

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Global Secondary Index Settings

javascript_timeout_secs
number
Default: 60

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

keypath
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

kv_tls_port
integer
Default: 11207

The Memcached TLS port.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The Memcached TLS port.

local_doc_expiry_secs
integer
Default: 7776000

The number of seconds before a _local document should expire.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The number of seconds before a _local document should expire.

object

Configuration for Local JWT authentication.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Configuration for Local JWT authentication.

object

Per-database logging configuration.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Per-database logging configuration.

max_concurrent_query_ops
integer
Default: 1000

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

name
string

The name of the database.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the database.

offline
boolean
Default: false

Start the database in an offline state.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Start the database in an offline state.

object

Configuration for OpenID Connect authentication.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Configuration for OpenID Connect authentication.

old_rev_expiry_seconds
number
Default: 300

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

password
string

The password for authenticating to the server.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The password for authenticating to the server.

query_pagination_limit
integer
Default: 5000

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

-
object
revs_limit
number >= 0
Default: 50

The maximum depth a document's revision tree can grow to.

-
object
object <= 1 properties

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

+
object
revs_limit
number >= 0
Default: 50

The maximum depth a document's revision tree can grow to.

+
object
object <= 1 properties

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

send_www_authenticate_header
boolean
Default: true

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

serve_insecure_attachment_types
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

server
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

session_cookie_http_only
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

session_cookie_name
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

session_cookie_secure
boolean

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

sgreplicate_enabled
boolean
Default: true

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

sgreplicate_websocket_heartbeat_secs
integer
Default: 300

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

slow_query_warning_threshold
number
Default: 500

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

store_legacy_revtree_data
boolean
Default: true

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).

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

suspendable
boolean
Default: false

Set to true to allow the database to be suspended.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Set to true to allow the database to be suspended.

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

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

The Javascript function that newly created documents are ran through for the default scope and collection.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The Javascript function that newly created documents are ran through for the default scope and collection.

If scopes parameter is set, this is ignored.

object

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

use_views
boolean
Default: false

Force the use of views instead of GSI.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Force the use of views instead of GSI.

user_xattr_key
string <= 15

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

username
string

The username for authenticating to the server.

-
object
view_query_timeout_secs
integer
Default: 75

The number of seconds before a view query should timeout.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The username for authenticating to the server.

+
object
view_query_timeout_secs
integer
Default: 75

The number of seconds before a view query should timeout.

allow_conflicts
boolean
Deprecated
Default: false

Since Sync Gateway 4.0, this option has no effect. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

enable_shared_bucket_access
boolean
Deprecated
Default: true

Since Sync Gateway 4.0, this option has no effect. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

feed_type
string
Deprecated
Default: "DCP"
Value: "DCP"

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

num_index_replicas
number
Deprecated
Default: 1

Deprecated, please use the database setting index.num_replicas instead

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Deprecated, please use the database setting index.num_replicas instead

pool
string
Deprecated
Default: "default"

This field is unsupported and ignored.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

This field is unsupported and ignored.

rev_cache_size
number
Deprecated

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

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

Responses

Request samples

Content type
application/json
{
  • "allow_empty_password": false,
  • "bucket": "The database name",
  • "bucket_op_timeout_ms": 0,
  • "cacertpath": "string",
  • "cache": {
    },
  • "certpath": "string",
  • "changes_request_plus": false,
  • "client_partition_window_secs": 2592000,
  • "compact_interval_days": 1,
  • "cors": {
    },
  • "delta_sync": {
    },
  • "disable_password_auth": false,
  • "disable_public_all_docs": false,
  • "event_handlers": {
    },
  • "guest": {
    },
  • "import_backup_old_rev": false,
  • "import_docs": true,
  • "import_filter": "function(doc) { if (doc.type != 'mobile') { return false; } return true; }",
  • "import_partitions": 16,
  • "index": {
    },
  • "javascript_timeout_secs": 60,
  • "keypath": "string",
  • "kv_tls_port": 11207,
  • "local_doc_expiry_secs": 7776000,
  • "local_jwt": {
    },
  • "logging": {
    },
  • "max_concurrent_query_ops": 1000,
  • "name": "string",
  • "offline": false,
  • "oidc": {
    },
  • "old_rev_expiry_seconds": 300,
  • "password": "string",
  • "query_pagination_limit": 5000,
  • "replications": {
    },
  • "revs_limit": 50,
  • "roles": {
    },
  • "scopes": {
    },
  • "send_www_authenticate_header": true,
  • "serve_insecure_attachment_types": false,
  • "server": "string",
  • "session_cookie_http_only": false,
  • "session_cookie_name": "string",
  • "session_cookie_secure": true,
  • "sgreplicate_enabled": true,
  • "sgreplicate_websocket_heartbeat_secs": 300,
  • "slow_query_warning_threshold": 500,
  • "store_legacy_revtree_data": true,
  • "suspendable": false,
  • "sync": "function(doc){channel(doc.channels);}",
  • "unsupported": {
    },
  • "use_views": false,
  • "user_xattr_key": "string",
  • "username": "string",
  • "users": {
    },
  • "view_query_timeout_secs": 75,
  • "allow_conflicts": false,
  • "enable_shared_bucket_access": true,
  • "feed_type": "DCP",
  • "num_index_replicas": 1,
  • "pool": "default",
  • "rev_cache_size": 0
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get database audit configuration

Request samples

Content type
application/json
{
  • "allow_empty_password": false,
  • "bucket": "The database name",
  • "bucket_op_timeout_ms": 0,
  • "cacertpath": "string",
  • "cache": {
    },
  • "certpath": "string",
  • "changes_request_plus": false,
  • "client_partition_window_secs": 2592000,
  • "compact_interval_days": 1,
  • "cors": {},
  • "delta_sync": {
    },
  • "disable_password_auth": false,
  • "disable_public_all_docs": false,
  • "event_handlers": {
    },
  • "guest": {
    },
  • "import_backup_old_rev": false,
  • "import_docs": true,
  • "import_filter": "function(doc) { if (doc.type != 'mobile') { return false; } return true; }",
  • "import_partitions": 16,
  • "index": {
    },
  • "javascript_timeout_secs": 60,
  • "keypath": "string",
  • "kv_tls_port": 11207,
  • "local_doc_expiry_secs": 7776000,
  • "local_jwt": {
    },
  • "logging": {
    },
  • "max_concurrent_query_ops": 1000,
  • "name": "string",
  • "offline": false,
  • "oidc": {
    },
  • "old_rev_expiry_seconds": 300,
  • "password": "string",
  • "query_pagination_limit": 5000,
  • "replications": {
    },
  • "revs_limit": 50,
  • "roles": {
    },
  • "scopes": {
    },
  • "send_www_authenticate_header": true,
  • "serve_insecure_attachment_types": false,
  • "server": "string",
  • "session_cookie_http_only": false,
  • "session_cookie_name": "string",
  • "session_cookie_secure": true,
  • "sgreplicate_enabled": true,
  • "sgreplicate_websocket_heartbeat_secs": 300,
  • "slow_query_warning_threshold": 500,
  • "store_legacy_revtree_data": true,
  • "suspendable": false,
  • "sync": "function(doc){channel(doc.channels);}",
  • "unsupported": {
    },
  • "use_views": false,
  • "user_xattr_key": "string",
  • "username": "string",
  • "users": {
    },
  • "view_query_timeout_secs": 75,
  • "allow_conflicts": false,
  • "enable_shared_bucket_access": true,
  • "feed_type": "DCP",
  • "num_index_replicas": 1,
  • "pool": "default",
  • "rev_cache_size": 0
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get database audit configuration

Retrieve the audit configuration for the database specified.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

Retrieve the audit configuration for the database specified.

Required Sync Gateway RBAC roles:

  • Sync Gateway Architect
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
verbose
boolean
Default: false

Whether to show name and description with each audit event.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
verbose
boolean
Default: false

Whether to show name and description with each audit event.

filterable
boolean
Default: false

Whether to show only filterable audit events.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Whether to show only filterable audit events.

Responses

Response samples

Content type
application/json
Example
{
  • "enabled": true,
  • "events": {
    },
  • "disabled_users": [
    ],
  • "disabled_roles": [
    ]
}

Replace database audit configuration

Resource could not be found

+

Response samples

Content type
application/json
Example
{
  • "enabled": true,
  • "events": {
    },
  • "disabled_users": [
    ],
  • "disabled_roles": [
    ]
}

Replace database audit configuration

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Request Body schema: application/json

The new database audit configuration to use

-
One of
enabled
boolean
object
Array of objects

List of users for which audit logging is disabled.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

The new database audit configuration to use

+
One of
enabled
boolean
object
Array of objects

List of users for which audit logging is disabled.

Array of objects

List of roles for which audit logging is disabled. Either cbs or sgw.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

List of roles for which audit logging is disabled. Either cbs or sgw.

Responses

Request samples

Content type
application/json
Example
{
  • "enabled": true,
  • "events": {
    },
  • "disabled_users": [
    ],
  • "disabled_roles": [
    ]
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Update database audit configuration

Resource could not be found

+

Request samples

Content type
application/json
Example
{
  • "enabled": true,
  • "events": {
    },
  • "disabled_users": [
    ],
  • "disabled_roles": [
    ]
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Update database audit configuration

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
verbose
boolean
Default: false

Whether to show name and description with each audit event.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
verbose
boolean
Default: false

Whether to show name and description with each audit event.

Request Body schema: application/json

The database configuration fields to update

-
One of
enabled
boolean
object
Array of objects

List of users for which audit logging is disabled.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

The database configuration fields to update

+
One of
enabled
boolean
object
Array of objects

List of users for which audit logging is disabled.

Array of objects

List of roles for which audit logging is disabled. Either cbs or sgw.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

List of roles for which audit logging is disabled. Either cbs or sgw.

Responses

Request samples

Content type
application/json
Example
{
  • "enabled": true,
  • "events": {
    },
  • "disabled_users": [
    ],
  • "disabled_roles": [
    ]
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get database sync function

Not Found

+

Request samples

Content type
application/json
Example
{
  • "enabled": true,
  • "events": {
    },
  • "disabled_users": [
    ],
  • "disabled_roles": [
    ]
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get database sync function

This returns the database's sync function.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

Responses

Response samples

Content type
application/javascript
function (doc, oldDoc) {
+" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Resource could not be found

+

Response samples

Content type
application/javascript
function (doc, oldDoc) {
   channel(doc.channels);
-}

Set database sync function

}

Set database sync function

This will allow you to update the sync function.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

This will allow you to update the sync function.

Required Sync Gateway RBAC roles:

  • Sync Gateway Architect
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

-
query Parameters
disable_oidc_validation
boolean
Default: false

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

-
header Parameters
If-Match
string

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.

+
query Parameters
disable_oidc_validation
boolean
Default: false

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

+
header Parameters
If-Match
string

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.

Request Body schema: application/javascript

The new sync function to use

-
string

Responses

Request samples

Content type
application/javascript
function (doc, oldDoc) {
+

Request samples

Content type
application/javascript
function (doc, oldDoc) {
   channel(doc.channels);
-}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Remove custom sync function

}

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Remove custom sync function

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

The default sync function is equivalent to:

function (doc) {
   channel(doc.channels);
@@ -2017,997 +2017,997 @@
 
  • Sync Gateway Architect
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

-
header Parameters
If-Match
string

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.

+
header Parameters
If-Match
string

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

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Get database import filter

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Get database import filter

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

Responses

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Set database import filter

Resource could not be found

+

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Set database import filter

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

Required Sync Gateway RBAC roles:

  • Sync Gateway Architect
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

-
query Parameters
disable_oidc_validation
boolean
Default: false

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

-
header Parameters
If-Match
string

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.

+
query Parameters
disable_oidc_validation
boolean
Default: false

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

+
header Parameters
If-Match
string

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.

Request Body schema: application/javascript

The import filter to use

-
string

Responses

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Delete import filter

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Delete import filter

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

-
header Parameters
If-Match
string

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.

+
header Parameters
If-Match
string

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

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Database Security

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Database Security

Create and manage database users and roles

-

Get all the names of the users

Get all the names of the users

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
name_only
boolean
Default: true

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

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
name_only
boolean
Default: true

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

limit
integer

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Responses

Response samples

Content type
application/json
[
  • "Alice",
  • "Bob"
]

Create a new user

Resource could not be found

+

Response samples

Content type
application/json
[
  • "Alice",
  • "Bob"
]

Create a new user

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Request Body schema: application/json

Properties associated with a user

-
name
string

Properties associated with a user

+
name
string

The name of the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the user.

User names can only have alphanumeric ASCII characters and underscores.

password
string

The password of the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The password of the user.

Mandatory. unless allow_empty_password is true in the database configs.

admin_channels
Array of strings

A list of channels to explicitly grant to the user for the default collection. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

A list of channels to explicitly grant to the user for the default collection. See collection_access for channels in named collections.

email
string

The email address of the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The email address of the user.

disabled
boolean
Default: false

If true, the user will not be able to login to the account as it is disabled.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

If true, the user will not be able to login to the account as it is disabled.

admin_roles
Array of strings

A list of roles to explicitly grant to the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

A list of roles to explicitly grant to the user.

object

A set of access grants by scope and collection for a specific collection.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

A set of access grants by scope and collection for a specific collection.

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "password": "string",
  • "admin_channels": [
    ],
  • "email": "string",
  • "disabled": false,
  • "admin_roles": [
    ],
  • "collection_access": {
    }
}

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Get a user

Resource already exists under that name

+

Request samples

Content type
application/json
{
  • "name": "string",
  • "password": "string",
  • "admin_channels": [
    ],
  • "email": "string",
  • "disabled": false,
  • "admin_roles": [
    ],
  • "collection_access": {
    }
}

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Get a user

Retrieve a single users information.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

Retrieve a single users information.

Required Sync Gateway RBAC roles:

  • Sync Gateway Architect
  • Sync Gateway Application
  • Sync Gateway Application Read Only
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

name
required
string

The name of the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the user.

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "password": "string",
  • "admin_channels": [
    ],
  • "all_channels": [
    ],
  • "email": "string",
  • "disabled": false,
  • "admin_roles": [
    ],
  • "roles": [
    ],
  • "jwt_roles": [
    ],
  • "jwt_channels": [
    ],
  • "jwt_issuer": "string",
  • "jwt_last_updated": "2019-08-24T14:15:22Z",
  • "collection_access": {
    }
}

Upsert a user

Resource could not be found

+

Response samples

Content type
application/json
{
  • "name": "string",
  • "password": "string",
  • "admin_channels": [
    ],
  • "all_channels": [
    ],
  • "email": "string",
  • "disabled": false,
  • "admin_roles": [
    ],
  • "roles": [
    ],
  • "jwt_roles": [
    ],
  • "jwt_channels": [
    ],
  • "jwt_issuer": "string",
  • "jwt_last_updated": "2019-08-24T14:15:22Z",
  • "collection_access": {
    }
}

Upsert a user

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

name
required
string

The name of the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the user.

Request Body schema: application/json

Properties associated with a user

-
name
string

Properties associated with a user

+
name
string

The name of the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the user.

User names can only have alphanumeric ASCII characters and underscores.

password
string

The password of the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The password of the user.

Mandatory. unless allow_empty_password is true in the database configs.

admin_channels
Array of strings

A list of channels to explicitly grant to the user for the default collection. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

A list of channels to explicitly grant to the user for the default collection. See collection_access for channels in named collections.

email
string

The email address of the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The email address of the user.

disabled
boolean
Default: false

If true, the user will not be able to login to the account as it is disabled.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

If true, the user will not be able to login to the account as it is disabled.

admin_roles
Array of strings

A list of roles to explicitly grant to the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

A list of roles to explicitly grant to the user.

object

A set of access grants by scope and collection for a specific collection.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

A set of access grants by scope and collection for a specific collection.

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "password": "string",
  • "admin_channels": [
    ],
  • "email": "string",
  • "disabled": false,
  • "admin_roles": [
    ],
  • "collection_access": {
    }
}

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Delete a user

Resource could not be found

+

Request samples

Content type
application/json
{
  • "name": "string",
  • "password": "string",
  • "admin_channels": [
    ],
  • "email": "string",
  • "disabled": false,
  • "admin_roles": [
    ],
  • "collection_access": {
    }
}

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Delete a user

Delete a user from the database.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

Delete a user from the database.

Required Sync Gateway RBAC roles:

  • Sync Gateway Architect
  • Sync Gateway Application
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

name
required
string

The name of the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the user.

Responses

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Check if user exists

Resource could not be found

+

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Check if user exists

Check if the user exists by checking the status code.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

name
required
string

The name of the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the user.

Responses

Get all names of the roles

Not Found

+

Get all names of the roles

Retrieves all the roles that are in the database.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

-
query Parameters
deleted
boolean
Default: false
Enum: true false

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

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
query Parameters
deleted
boolean
Default: false
Enum: true false

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

Responses

Response samples

Content type
application/json
[
  • "Administrator",
  • "Moderator"
]

Create a new role

Resource could not be found

+

Response samples

Content type
application/json
[
  • "Administrator",
  • "Moderator"
]

Create a new role

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Request Body schema: application/json

Properties associated with a role

-
name
string

Properties associated with a role

+
name
string

The name of the role.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the role.

Role names can only have alphanumeric ASCII characters and underscores.

admin_channels
Array of strings

A list of channels to explicitly grant to the role for the default collection. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

A list of channels to explicitly grant to the role for the default collection. See collection_access for channels in named collections.

object

A set of access grants by scope and collection for a specific collection.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

A set of access grants by scope and collection for a specific collection.

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "admin_channels": [
    ],
  • "collection_access": {
    }
}

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Get a role

Resource already exists under that name

+

Request samples

Content type
application/json
{
  • "name": "string",
  • "admin_channels": [
    ],
  • "collection_access": {
    }
}

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Get a role

Retrieve a single roles properties.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

Retrieve a single roles properties.

Required Sync Gateway RBAC roles:

  • Sync Gateway Architect
  • Sync Gateway Application
  • Sync Gateway Application Read Only
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

name
required
string

The name of the role.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the role.

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "admin_channels": [
    ],
  • "all_channels": [
    ],
  • "collection_access": {
    }
}

Upsert a role

Resource could not be found

+

Response samples

Content type
application/json
{
  • "name": "string",
  • "admin_channels": [
    ],
  • "all_channels": [
    ],
  • "collection_access": {
    }
}

Upsert a role

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

name
required
string

The name of the role.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the role.

Request Body schema: application/json

Properties associated with a role

-
name
string

Properties associated with a role

+
name
string

The name of the role.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the role.

Role names can only have alphanumeric ASCII characters and underscores.

admin_channels
Array of strings

A list of channels to explicitly grant to the role for the default collection. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

A list of channels to explicitly grant to the role for the default collection. See collection_access for channels in named collections.

object

A set of access grants by scope and collection for a specific collection.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

A set of access grants by scope and collection for a specific collection.

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "admin_channels": [
    ],
  • "collection_access": {
    }
}

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Delete a role

Resource could not be found

+

Request samples

Content type
application/json
{
  • "name": "string",
  • "admin_channels": [
    ],
  • "collection_access": {
    }
}

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Delete a role

Delete a role from the database.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

Delete a role from the database.

Required Sync Gateway RBAC roles:

  • Sync Gateway Architect
  • Sync Gateway Application
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

name
required
string

The name of the role.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the role.

Responses

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Check if role exists

Resource could not be found

+

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Check if role exists

Check if the role exists by checking the status code.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

name
required
string

The name of the role.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the role.

Responses

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Session

Resource could not be found

+

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Session

Manage user sessions

-

Get information about the current user

This will get the information about the current user.

-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+

Get information about the current user

This will get the information about the current user.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Responses

Response samples

Content type
application/json
{
  • "authentication_handlers": [
    ],
  • "ok": true,
  • "userCtx": {
    }
}

Create a new user session

Resource could not be found

+

Response samples

Content type
application/json
{
  • "authentication_handlers": [
    ],
  • "ok": true,
  • "userCtx": {
    }
}

Create a new user session

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

Request Body schema: application/json

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

-
name
string

User name to generate the session for.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

+
name
string

User name to generate the session for.

ttl
integer

Time until the session expires. Uses default value of 24 hours if left blank. This value must be greater or equal to 1.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Time until the session expires. Uses default value of 24 hours if left blank. This value must be greater or equal to 1.

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "ttl": 0
}

Response samples

Content type
application/json
{
  • "session_id": "c5af80a039db4ed9d2b6865576b6999935282689",
  • "expires": "2022-01-21T15:24:44Z",
  • "cookie_name": "SyncGatewaySession"
}

Get session information

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

+

Request samples

Content type
application/json
{
  • "name": "string",
  • "ttl": 0
}

Response samples

Content type
application/json
{
  • "session_id": "c5af80a039db4ed9d2b6865576b6999935282689",
  • "expires": "2022-01-21T15:24:44Z",
  • "cookie_name": "SyncGatewaySession"
}

Get session information

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

sessionid
required
string

The ID of the session to target.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The ID of the session to target.

Responses

Response samples

Content type
application/json
{
  • "authentication_handlers": [
    ],
  • "ok": true,
  • "userCtx": {
    }
}

Remove session

Resource could not be found

+

Response samples

Content type
application/json
{
  • "authentication_handlers": [
    ],
  • "ok": true,
  • "userCtx": {
    }
}

Remove session

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

sessionid
required
string

The ID of the session to target.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The ID of the session to target.

Responses

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Remove all of a users sessions

Resource could not be found

+

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Remove all of a users sessions

Invalidates all the sessions that a user has.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

name
required
string

The name of the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the user.

Responses

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Remove session with user validation

Resource could not be found

+

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Remove session with user validation

Invalidates the session only if it belongs to the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

Invalidates the session only if it belongs to the user.

Required Sync Gateway RBAC roles:

  • Sync Gateway Architect
  • Sync Gateway Application
-
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

+
path Parameters
db
required
string
Example: db1

The name of the database to run the operation against.

name
required
string

The name of the user.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The name of the user.

sessionid
required
string

The ID of the session to target.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The ID of the session to target.

Responses

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Document

Resource could not be found

+

Response samples

Content type
application/json
{
  • "error": "not_found",
  • "reason": "no such database \"invalid-db\""
}

Document

Create and manage documents and attachments

-

Get a document with the corresponding metadata

Get a document with the corresponding metadata

Returns a document's latest revision with its metadata as stored.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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
required
string
Example: doc1

The document ID to run the operation against.

-
query Parameters
include_doc
string

Include the body associated with the document.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The document ID to run the operation against.

+
query Parameters
include_doc
string

Include the body associated with the document.

redact
boolean

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

salt
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

Responses

Response samples

Content type
application/json
{
  • "channels": [
    ],
  • "myblob": {
    },
  • "_xattrs": {
    }
}

Purge a document

Resource could not be found

+

Response samples

Content type
application/json
{
  • "channels": [
    ],
  • "myblob": {
    },
  • "_xattrs": {
    }
}

Purge a document

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).

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

Request Body schema: application/json

Purge request body

-
doc_id*
additional property
Array of strings
Items Value: "*"

Purge request body

+
doc_id*
additional property
Array of strings
Items Value: "*"

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

All revisions will be permanently removed for that document.

Responses

Request samples

Content type
application/json
Example
{
  • "doc_id": [
    ]
}

Response samples

Content type
application/json
Example
{
  • "purged": {
    }
}

Create a new document

Resource could not be found

+

Request samples

Content type
application/json
Example
{
  • "doc_id": [
    ]
}

Response samples

Content type
application/json
Example
{
  • "purged": {
    }
}

Create a new document

Create a new document in the keyspace.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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.

-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

-
query Parameters
roundtrip
boolean

Block until document has been received by change cache

-
Request Body schema: application/json
_id
string

The ID of the document.

+
query Parameters
roundtrip
boolean

Block until document has been received by change cache

+
Request Body schema: application/json
_id
string

The ID of the document.

_rev
string

The revision of the document.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The revision of the document.

_exp
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

_deleted
boolean

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

-
object
object
property name*
additional property
any

Responses

object
object
property name*
additional property
any

Responses

Request samples

Content type
application/json
{
  • "_id": "string",
  • "_rev": "string",
  • "_exp": "string",
  • "_deleted": true,
  • "_revisions": {
    },
  • "_attachments": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "ok": true,
  • "rev": "string",
  • "cv": "string"
}

Get changes list

Invalid content type

+

Request samples

Content type
application/json
{
  • "_id": "string",
  • "_rev": "string",
  • "_exp": "string",
  • "_deleted": true,
  • "_revisions": {
    },
  • "_attachments": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "ok": true,
  • "rev": "string",
  • "cv": "string"
}

Get changes list

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

-
query Parameters
limit
integer

Maximum number of changes to return.

+
query Parameters
limit
integer

Maximum number of changes to return.

since
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

style
string
Default: "main_only"
Enum: "main_only" "all_docs"

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

active_only
boolean
Default: false

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

include_docs
boolean

Include the body associated with each document.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Include the body associated with each document.

revocations
boolean

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

filter
string
Enum: "sync_gateway/bychannel" "_doc_ids"

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

channels
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

doc_ids
Array of strings

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

heartbeat
integer
Default: 0

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

timeout
integer [ 0 .. 900000 ]
Default: 300000

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

feed
string
Default: "normal"
Enum: "normal" "longpoll" "continuous" "websocket"

The type of changes feed to use.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The type of changes feed to use.

request_plus
boolean
Default: false

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.

-
version_type
string
Default: "rev"
Enum Description
rev

Revision Tree IDs. For example: 1-293a80ce8f4874724732f27d35b3959a13cd96e0

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

+
version_type
string
Default: "rev"
Enum Description
rev

Revision Tree IDs. For example: 1-293a80ce8f4874724732f27d35b3959a13cd96e0

cv

Current Version. For example: 1854e4e557cc0000@zTWkmBiYZgNQo7BHVZrB/Q

+" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Current Version. For example: 1854e4e557cc0000@zTWkmBiYZgNQo7BHVZrB/Q

The preferred type of document versioning to use for the changes feed.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The preferred type of document versioning to use for the changes feed.

Responses

Response samples

Content type
application/json
{
  • "results": [
    ],
  • "last_seq": "string"
}

Get changes list

Resource could not be found

+

Response samples

Content type
application/json
{
  • "results": [
    ],
  • "last_seq": "string"
}

Get changes list

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

-
Request Body schema: application/json
limit
string

Maximum number of changes to return.

+
Request Body schema: application/json
limit
string

Maximum number of changes to return.

style
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

active_only
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

include_docs
string

Include the body associated with each document.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Include the body associated with each document.

revocations
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

filter
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

channels
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

doc_ids
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

heartbeat
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

timeout
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

feed
string

The type of changes feed to use.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The type of changes feed to use.

request_plus
boolean
Default: false

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.

-
version_type
string
Default: "rev"
Enum Description
rev

Revision Tree IDs. For example: 1-293a80ce8f4874724732f27d35b3959a13cd96e0

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

+
version_type
string
Default: "rev"
Enum Description
rev

Revision Tree IDs. For example: 1-293a80ce8f4874724732f27d35b3959a13cd96e0

cv

Current Version. For example: 1854e4e557cc0000@zTWkmBiYZgNQo7BHVZrB/Q

+" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Current Version. For example: 1854e4e557cc0000@zTWkmBiYZgNQo7BHVZrB/Q

The preferred type of document versioning to use for the changes feed.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The preferred type of document versioning to use for the changes feed.

Responses

Request samples

Content type
application/json
{
  • "limit": "string",
  • "style": "string",
  • "active_only": "string",
  • "include_docs": "string",
  • "revocations": "string",
  • "filter": "string",
  • "channels": "string",
  • "doc_ids": "string",
  • "heartbeat": "string",
  • "timeout": "string",
  • "feed": "string",
  • "request_plus": false,
  • "version_type": "rev"
}

Response samples

Content type
application/json
{
  • "results": [
    ],
  • "last_seq": "string"
}

Compare revisions to what is in the database

Resource could not be found

+

Request samples

Content type
application/json
{
  • "limit": "string",
  • "style": "string",
  • "active_only": "string",
  • "include_docs": "string",
  • "revocations": "string",
  • "filter": "string",
  • "channels": "string",
  • "doc_ids": "string",
  • "heartbeat": "string",
  • "timeout": "string",
  • "feed": "string",
  • "request_plus": false,
  • "version_type": "rev"
}

Response samples

Content type
application/json
{
  • "results": [
    ],
  • "last_seq": "string"
}

Compare revisions to what is in the database

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

-
Request Body schema: application/json
docid
Array of strings

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

+
Request Body schema: application/json
docid
Array of strings

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

Responses

Request samples

Content type
application/json
{
  • "docid": [
    ]
}

Response samples

Content type
application/json
{
  • "docid": {
    }
}

Get local document

Resource could not be found

+

Request samples

Content type
application/json
{
  • "docid": [
    ]
}

Response samples

Content type
application/json
{
  • "docid": {
    }
}

Get local document

This request retrieves a local document.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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
required
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Responses

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Upsert a local document

Resource could not be found

+

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Upsert a local document

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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
required
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Request Body schema: application/json

The body of the document

-
_rev
string

Revision to replace. Required if updating existing local document.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

The body of the document

+
_rev
string

Revision to replace. Required if updating existing local document.

Responses

Request samples

Content type
application/json
{
  • "_rev": "2-5145e1086bb8d1d71a531e9f6b543c58"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "ok": true,
  • "rev": "string",
  • "cv": "string"
}

Delete a local document

A conflict would result from updating this document revision.

+

Request samples

Content type
application/json
{
  • "_rev": "2-5145e1086bb8d1d71a531e9f6b543c58"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "ok": true,
  • "rev": "string",
  • "cv": "string"
}

Delete a local document

This request deletes a local document.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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
required
string

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

-
query Parameters
rev
required
string

The Revision Tree ID of the revision to delete.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

+
query Parameters
rev
required
string

The Revision Tree ID of the revision to delete.

Responses

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Check if local document exists

A conflict would result from deleting this document revision.

+

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Check if local document exists

This request checks if a local document exists.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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
required
string

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Responses

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get a document

Resource could not be found

+

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get a document

Retrieve a document from the database by its doc ID.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

Retrieve a document from the database by its doc ID.

Required Sync Gateway RBAC roles:

  • Sync Gateway Application
  • Sync Gateway Application Read Only
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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
required
string
Example: doc1

The document ID to run the operation against.

-
query Parameters
rev
string
Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

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.)

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The document ID to run the operation against.

+
query Parameters
rev
string
Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

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
Array of strings

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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
boolean

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

revs_from
Array of strings

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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
Array of strings

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

revs_limit
integer

Maximum amount of revisions to return for each document.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Maximum amount of revisions to return for each document.

attachments
boolean

Include attachment bodies in response.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Include attachment bodies in response.

replicator2
boolean

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Responses

Response samples

Content type
application/json
{
  • "FailedLoginAttempts": 5,
  • "Friends": [
    ],
  • "_id": "AliceSettings",
  • "_rev": "1-64d4a1f179db5c1848fe52967b47c166",
  • "_cv": "1@src"
}

Upsert a document

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

+

Response samples

Content type
application/json
{
  • "FailedLoginAttempts": 5,
  • "Friends": [
    ],
  • "_id": "AliceSettings",
  • "_rev": "1-64d4a1f179db5c1848fe52967b47c166",
  • "_cv": "1@src"
}

Upsert a document

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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.

@@ -3023,119 +3023,119 @@
  • Sync Gateway Application
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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
required
string
Example: doc1

The document ID to run the operation against.

-
query Parameters
roundtrip
boolean

Block until document has been received by change cache

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The document ID to run the operation against.

+
query Parameters
roundtrip
boolean

Block until document has been received by change cache

replicator2
boolean

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

new_edits
boolean
Default: true

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

rev
string
Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

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.)

-
header Parameters
If-Match
string

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.

-
Request Body schema: application/json
_id
string

The ID of the document.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.)

+
header Parameters
If-Match
string

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.

+
Request Body schema: application/json
_id
string

The ID of the document.

_rev
string

The revision of the document.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The revision of the document.

_exp
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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.

_deleted
boolean

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

-
object
object
property name*
additional property
any

Responses

object
object
property name*
additional property
any

Responses

Request samples

Content type
application/json
{
  • "_id": "string",
  • "_rev": "string",
  • "_exp": "string",
  • "_deleted": true,
  • "_revisions": {
    },
  • "_attachments": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "ok": true,
  • "rev": "string",
  • "cv": "string"
}

Delete a document

Invalid content type

+

Request samples

Content type
application/json
{
  • "_id": "string",
  • "_rev": "string",
  • "_exp": "string",
  • "_deleted": true,
  • "_revisions": {
    },
  • "_attachments": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "ok": true,
  • "rev": "string",
  • "cv": "string"
}

Delete a document

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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
required
string
Example: doc1

The document ID to run the operation against.

-
query Parameters
rev
string
Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

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.)

-
header Parameters
If-Match
string

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The document ID to run the operation against.

+
query Parameters
rev
string
Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

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.)

+
header Parameters
If-Match
string

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

Response samples

Content type
application/json
{
  • "id": "string",
  • "ok": true,
  • "rev": "string",
  • "cv": "string"
}

Check if a document exists

Resource could not be found

+

Response samples

Content type
application/json
{
  • "id": "string",
  • "ok": true,
  • "rev": "string",
  • "cv": "string"
}

Check if a document exists

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

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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
-
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection
path Parameters
keyspace
required
string
Examples:
  • db1 - Default scope and collection
  • db1.collection1 - Named collection within the default scope
  • db1.scope1.collection1 - Fully-qualified scope and collection

The keyspace to run the operation against.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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
required
string
Example: doc1

The document ID to run the operation against.

-
query Parameters
rev
string
Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

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.)

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

The document ID to run the operation against.

+
query Parameters
rev
string
Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

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
Array of strings

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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
boolean

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

revs_from
Array of strings

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.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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
Array of strings

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

revs_limit
integer

Maximum amount of revisions to return for each document.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Maximum amount of revisions to return for each document.

attachments
boolean

Include attachment bodies in response.

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

Include attachment bodies in response.

replicator2
boolean

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

+" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

Responses

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get an attachment from a document

Resource could not be found

+

Response samples

Content type
application/json
{
  • "error": "string",
  • "reason": "string"
}

Get an attachment from a document

This request retrieves a file attachment associated with the document.

+" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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:

@@ -3151,125 +3151,125 @@
  • Sync Gateway Application
  • Sync Gateway Application Read Only
  • -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string
    Example: doc1

    The document ID to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The document ID to run the operation against.

    attach
    required
    string

    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).

    -
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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.)

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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).

    +
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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.)

    content_encoding
    boolean
    Default: true

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    meta
    boolean
    Default: false

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

    -
    header Parameters
    Range
    string
    Example: bytes=123-456

    RFC-2616 bytes range header.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    +
    header Parameters
    Range
    string
    Example: bytes=123-456

    RFC-2616 bytes range header.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Create or update an attachment on a document

    Requested range exceeds content length

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Create or update an attachment on a document

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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
    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string
    Example: doc1

    The document ID to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The document ID to run the operation against.

    attach
    required
    string

    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).

    -
    query Parameters
    rev
    string

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

    -
    header Parameters
    Content-Type
    string
    Default: application/octet-stream

    The content type of the attachment.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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).

    +
    query Parameters
    rev
    string

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

    +
    header Parameters
    Content-Type
    string
    Default: application/octet-stream

    The content type of the attachment.

    If-Match
    string

    An alternative way of specifying the document revision ID.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    An alternative way of specifying the document revision ID.

    Request Body schema: Attachment content type

    The attachment data

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    The attachment data

    string

    The content to store in the body

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The content to store in the body

    Responses

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Check if attachment exists

    Resource already exists under that name

    +

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Check if attachment exists

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

    Required Sync Gateway RBAC roles:

    • Sync Gateway Application
    • Sync Gateway Application Read Only
    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string
    Example: doc1

    The document ID to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The document ID to run the operation against.

    attach
    required
    string

    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).

    -
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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.)

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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).

    +
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Delete an attachment on a document

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Delete an attachment on a document

    This request deletes an attachment associated with the document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This request deletes an attachment associated with the document.

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

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string
    Example: doc1

    The document ID to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The document ID to run the operation against.

    attach
    required
    string

    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).

    -
    query Parameters
    rev
    string

    The existing document revision ID to modify.

    -
    header Parameters
    If-Match
    string

    An alternative way of specifying the document revision ID.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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).

    +
    query Parameters
    rev
    string

    The existing document revision ID to modify.

    +
    header Parameters
    If-Match
    string

    An alternative way of specifying the document revision ID.

    Responses

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Gets all the documents in the database with the given parameters

    Resource already exists under that name

    +

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Gets all the documents in the database with the given parameters

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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 or POST /{keyspace}/_bulk_get have more efficient implementations and should be used instead.

    Required Sync Gateway RBAC roles:

    @@ -3285,37 +3285,37 @@
  • Sync Gateway Application
  • Sync Gateway Application Read Only
  • -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    query Parameters
    include_docs
    boolean

    Include the body associated with each document.

    +
    query Parameters
    include_docs
    boolean

    Include the body associated with each document.

    channels
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    access
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    revs
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    update_seq
    boolean

    Include the document sequence number update_seq property for each document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Include the document sequence number update_seq property for each document.

    keys
    Array of strings

    An array of document ID strings to filter by.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    An array of document ID strings to filter by.

    startkey
    string

    Return records starting with the specified key.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return records starting with the specified key.

    endkey
    string

    Stop returning records when this key is reached.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Stop returning records when this key is reached.

    limit
    number

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    Responses

    Response samples

    Content type
    application/json
    {
    • "rows": [
      ],
    • "total_rows": 0,
    • "update_seq": 0
    }

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

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "rows": [
      ],
    • "total_rows": 0,
    • "update_seq": 0
    }

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

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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 or POST /{keyspace}/_bulk_get have more efficient implementations and should be used instead.

    Required Sync Gateway RBAC roles:

    @@ -3331,37 +3331,37 @@
  • Sync Gateway Application
  • Sync Gateway Application Read Only
  • -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    query Parameters
    include_docs
    boolean

    Include the body associated with each document.

    +
    query Parameters
    include_docs
    boolean

    Include the body associated with each document.

    channels
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    access
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    revs
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    update_seq
    boolean

    Include the document sequence number update_seq property for each document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Include the document sequence number update_seq property for each document.

    startkey
    string

    Return records starting with the specified key.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return records starting with the specified key.

    endkey
    string

    Stop returning records when this key is reached.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Stop returning records when this key is reached.

    limit
    number

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

    -
    Request Body schema: application/json
    keys
    required
    Array of strings

    List of the documents to retrieve.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    +
    Request Body schema: application/json
    keys
    required
    Array of strings

    List of the documents to retrieve.

    Responses

    Request samples

    Content type
    application/json
    {
    • "keys": [
      ]
    }

    Response samples

    Content type
    application/json
    {
    • "rows": [
      ],
    • "total_rows": 0,
    • "update_seq": 0
    }

    Bulk document operations

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "keys": [
      ]
    }

    Response samples

    Content type
    application/json
    {
    • "rows": [
      ],
    • "total_rows": 0,
    • "update_seq": 0
    }

    Bulk document operations

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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.

    @@ -3377,23 +3377,23 @@
    • Sync Gateway Application
    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    Request Body schema: application/json
    new_edits
    boolean
    Default: true

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

    -
    required
    Array of objects

    Responses

    Request samples

    Content type
    application/json
    {
    • "new_edits": true,
    • "docs": [
      ]
    }

    Response samples

    Content type
    application/json
    Example
    [
    • {
      },
    • {
      },
    • {
      }
    ]

    Get multiple documents in a MIME multipart response

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "new_edits": true,
    • "docs": [
      ]
    }

    Response samples

    Content type
    application/json
    Example
    [
    • {
      },
    • {
      },
    • {
      }
    ]

    Get multiple documents in a MIME multipart response

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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.

    @@ -3411,111 +3411,111 @@
  • Sync Gateway Application
  • Sync Gateway Application Read Only
  • -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    query Parameters
    attachments
    boolean
    Default: false

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

    +
    query Parameters
    attachments
    boolean
    Default: false

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

    revs
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    revs_limit
    integer

    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.

    -
    header Parameters
    X-Accept-Part-Encoding
    string

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    +
    header Parameters
    X-Accept-Part-Encoding
    string

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

    Accept-Encoding
    string

    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.

    -
    Request Body schema: application/json
    required
    Array of objects

    Responses

    Request Body schema: application/json
    required
    Array of objects

    Responses

    Request samples

    Content type
    application/json
    {
    • "docs": [
      ]
    }

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Replication

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "docs": [
      ]
    }

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Replication

    Create and manage inter-Sync Gateway replications

    -

    Get all replication configurations

    Get all replication configurations

    This will retrieve all database replication definitions.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This will retrieve all database replication definitions.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Replicator
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    Responses

    Response samples

    Content type
    application/json
    {
    • "replication_id": {
      }
    }

    Upsert a replication

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "replication_id": {
      }
    }

    Upsert a replication

    Create or update a replication in the database.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    Request Body schema: application/json

    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.

    -
    adhoc
    boolean
    Default: false

    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.

    +
    adhoc
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    batch_size
    integer
    Default: 200

    The amount of changes to be sent in one batch of replications. Changing this is an Enterprise Edition only feature.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The amount of changes to be sent in one batch of replications. Changing this is an Enterprise Edition only feature.

    collections_enabled
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    collections_local
    Array of strings
    Default: []

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    collections_remote
    Array of strings or null
    Default: []

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    conflict_resolution_type
    string
    Default: "default"
    Enum Description
    default
    conflict_resolution_type
    string
    Default: "default"
    Enum Description
    default

    This will use:

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    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.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    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.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    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.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    This will result in conflicts going through your own custom conflict resolver. You must provide this logic as a Javascript function in the custom_conflict_resolver parameter.

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    Changing this is an Enterprise Edition only feature.

    continuous
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    custom_conflict_resolver
    string
    Default: ""

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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:

      @@ -3553,45 +3553,45 @@

      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.

      -
    direction
    required
    string
    Enum Description
    pull

    changes are pulled from the remote database

    +
    direction
    required
    string
    Enum Description
    pull

    changes are pulled from the remote database

    push

    changes are pushed to the remote database

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    changes are pushed to the remote database

    pushAndPull

    changes are both push-to and pulled-from the remote database

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    changes are both push-to and pulled-from the remote database

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    enable_delta_sync
    boolean
    Default: false

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    filter
    string
    Enum Description

    Do not filter any documents.

    +
    filter
    string
    Enum Description

    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.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    If set, a pull replication will be limited to a specific set of channels specified by the query_param.channels property.

    This defines whether to filter documents.

    -
    initial_state
    string
    Default: "running"
    Enum Description
    running

    The replication will immediately start running.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    This defines whether to filter documents.

    +
    initial_state
    string
    Default: "running"
    Enum Description
    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.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    The replication configuration will be created but the replication will not start running until the user explicitly starts it.

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    max_backoff_time
    integer
    Default: 5

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    purge_on_removal
    boolean
    Default: false

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    query_params
    Array of strings

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

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

    "filter":"sync_gateway/bychannel",
     "query_params": {
    @@ -3609,123 +3609,123 @@
     
    remote
    string

    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. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    remote_password
    string

    The password to use to authenticate with the remote. This password will be redacted in the replication config.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The password to use to authenticate with the remote. This password will be redacted in the replication config.

    remote_username
    string

    The username to use to authenticate with the remote.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The username to use to authenticate with the remote.

    replication_id
    string <= 160

    This is the ID of the replication.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    run_as
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    password
    string
    Deprecated

    This has been deprecated in favour of remote_password.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    username
    string
    Deprecated

    This has been deprecated in favour of remote_username.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    This has been deprecated in favour of remote_username.

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

    Responses

    Request samples

    Content type
    application/json
    {
    • "adhoc": false,
    • "batch_size": 200,
    • "collections_enabled": false,
    • "collections_local": [
      ],
    • "collections_remote": [
      ],
    • "conflict_resolution_type": "default",
    • "continuous": false,
    • "custom_conflict_resolver": "",
    • "direction": "push",
    • "enable_delta_sync": false,
    • "filter": "sync_gateway/bychannel",
    • "initial_state": "running",
    • "max_backoff_time": 5,
    • "purge_on_removal": false,
    • "query_params": [
      ],
    • "remote": "string",
    • "remote_password": "string",
    • "remote_username": "string",
    • "replication_id": "string",
    • "run_as": "string",
    • "password": "string",
    • "username": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Get a replication configuration

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "adhoc": false,
    • "batch_size": 200,
    • "collections_enabled": false,
    • "collections_local": [
      ],
    • "collections_remote": [
      ],
    • "conflict_resolution_type": "default",
    • "continuous": false,
    • "custom_conflict_resolver": "",
    • "direction": "push",
    • "enable_delta_sync": false,
    • "filter": "sync_gateway/bychannel",
    • "initial_state": "running",
    • "max_backoff_time": 5,
    • "purge_on_removal": false,
    • "query_params": [
      ],
    • "remote": "string",
    • "remote_password": "string",
    • "remote_username": "string",
    • "replication_id": "string",
    • "run_as": "string",
    • "password": "string",
    • "username": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Get a replication configuration

    Retrieve a replication configuration from the database.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Retrieve a replication configuration from the database.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Replicator
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    replicationid
    required
    string [ 1 .. 160 ]

    What replication to target based on its replication ID.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    What replication to target based on its replication ID.

    Responses

    Response samples

    Content type
    application/json
    {
    • "replication_id": "string",
    • "adhoc": false,
    • "batch_size": 200,
    • "collections_enabled": false,
    • "collections_local": [
      ],
    • "collections_remote": [
      ],
    • "conflict_resolution_type": "default",
    • "continuous": false,
    • "custom_conflict_resolver": "",
    • "direction": "push",
    • "enable_delta_sync": false,
    • "filter": "sync_gateway/bychannel",
    • "initial_state": "running",
    • "max_backoff_time": 5,
    • "purge_on_removal": false,
    • "query_params": [
      ],
    • "remote": "string",
    • "remote_password": "string",
    • "remote_username": "string",
    • "run_as": "string",
    • "password": "string",
    • "username": "string",
    • "assigned_node": "string",
    • "target_state": "running",
    • "cluster_uuid": "string"
    }

    Upsert a replication

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "replication_id": "string",
    • "adhoc": false,
    • "batch_size": 200,
    • "collections_enabled": false,
    • "collections_local": [
      ],
    • "collections_remote": [
      ],
    • "conflict_resolution_type": "default",
    • "continuous": false,
    • "custom_conflict_resolver": "",
    • "direction": "push",
    • "enable_delta_sync": false,
    • "filter": "sync_gateway/bychannel",
    • "initial_state": "running",
    • "max_backoff_time": 5,
    • "purge_on_removal": false,
    • "query_params": [
      ],
    • "remote": "string",
    • "remote_password": "string",
    • "remote_username": "string",
    • "run_as": "string",
    • "password": "string",
    • "username": "string",
    • "assigned_node": "string",
    • "target_state": "running",
    • "cluster_uuid": "string"
    }

    Upsert a replication

    Create or update a replication in the database.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    replicationid
    required
    string [ 1 .. 160 ]

    What replication to target based on its replication ID.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    What replication to target based on its replication ID.

    Request Body schema: application/json

    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.

    -
    adhoc
    boolean
    Default: false

    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.

    +
    adhoc
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    batch_size
    integer
    Default: 200

    The amount of changes to be sent in one batch of replications. Changing this is an Enterprise Edition only feature.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The amount of changes to be sent in one batch of replications. Changing this is an Enterprise Edition only feature.

    collections_enabled
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    collections_local
    Array of strings
    Default: []

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    collections_remote
    Array of strings or null
    Default: []

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    conflict_resolution_type
    string
    Default: "default"
    Enum Description
    default
    conflict_resolution_type
    string
    Default: "default"
    Enum Description
    default

    This will use:

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    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.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    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.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    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.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    This will result in conflicts going through your own custom conflict resolver. You must provide this logic as a Javascript function in the custom_conflict_resolver parameter.

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    Changing this is an Enterprise Edition only feature.

    continuous
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    custom_conflict_resolver
    string
    Default: ""

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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:

      @@ -3763,45 +3763,45 @@

      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.

      -
    direction
    required
    string
    Enum Description
    pull

    changes are pulled from the remote database

    +
    direction
    required
    string
    Enum Description
    pull

    changes are pulled from the remote database

    push

    changes are pushed to the remote database

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    changes are pushed to the remote database

    pushAndPull

    changes are both push-to and pulled-from the remote database

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    changes are both push-to and pulled-from the remote database

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    enable_delta_sync
    boolean
    Default: false

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    filter
    string
    Enum Description

    Do not filter any documents.

    +
    filter
    string
    Enum Description

    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.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    If set, a pull replication will be limited to a specific set of channels specified by the query_param.channels property.

    This defines whether to filter documents.

    -
    initial_state
    string
    Default: "running"
    Enum Description
    running

    The replication will immediately start running.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    This defines whether to filter documents.

    +
    initial_state
    string
    Default: "running"
    Enum Description
    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.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    The replication configuration will be created but the replication will not start running until the user explicitly starts it.

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    max_backoff_time
    integer
    Default: 5

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    purge_on_removal
    boolean
    Default: false

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    query_params
    Array of strings

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

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

    "filter":"sync_gateway/bychannel",
     "query_params": {
    @@ -3819,137 +3819,137 @@
     
    remote
    string

    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. +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    remote_password
    string

    The password to use to authenticate with the remote. This password will be redacted in the replication config.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The password to use to authenticate with the remote. This password will be redacted in the replication config.

    remote_username
    string

    The username to use to authenticate with the remote.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The username to use to authenticate with the remote.

    replication_id
    string <= 160

    This is the ID of the replication.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    run_as
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    password
    string
    Deprecated

    This has been deprecated in favour of remote_password.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    username
    string
    Deprecated

    This has been deprecated in favour of remote_username.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    This has been deprecated in favour of remote_username.

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

    Responses

    Request samples

    Content type
    application/json
    {
    • "adhoc": false,
    • "batch_size": 200,
    • "collections_enabled": false,
    • "collections_local": [
      ],
    • "collections_remote": [
      ],
    • "conflict_resolution_type": "default",
    • "continuous": false,
    • "custom_conflict_resolver": "",
    • "direction": "push",
    • "enable_delta_sync": false,
    • "filter": "sync_gateway/bychannel",
    • "initial_state": "running",
    • "max_backoff_time": 5,
    • "purge_on_removal": false,
    • "query_params": [
      ],
    • "remote": "string",
    • "remote_password": "string",
    • "remote_username": "string",
    • "replication_id": "string",
    • "run_as": "string",
    • "password": "string",
    • "username": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Stop and delete a replication

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "adhoc": false,
    • "batch_size": 200,
    • "collections_enabled": false,
    • "collections_local": [
      ],
    • "collections_remote": [
      ],
    • "conflict_resolution_type": "default",
    • "continuous": false,
    • "custom_conflict_resolver": "",
    • "direction": "push",
    • "enable_delta_sync": false,
    • "filter": "sync_gateway/bychannel",
    • "initial_state": "running",
    • "max_backoff_time": 5,
    • "purge_on_removal": false,
    • "query_params": [
      ],
    • "remote": "string",
    • "remote_password": "string",
    • "remote_username": "string",
    • "replication_id": "string",
    • "run_as": "string",
    • "password": "string",
    • "username": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Stop and delete a replication

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

    Required Sync Gateway RBAC roles:

    • Sync Gateway Replicator
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    replicationid
    required
    string [ 1 .. 160 ]

    What replication to target based on its replication ID.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    What replication to target based on its replication ID.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Check if a replication exists

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Check if a replication exists

    Check if a replication exists.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Check if a replication exists.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Replicator
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    replicationid
    required
    string [ 1 .. 160 ]

    What replication to target based on its replication ID.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    What replication to target based on its replication ID.

    Responses

    Get all replication statuses

    Replication does not exist

    +

    Get all replication statuses

    Retrieve all the replication statuses in the Sync Gateway node.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Retrieve all the replication statuses in the Sync Gateway node.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Replicator
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    activeOnly
    boolean
    Default: false

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    activeOnly
    boolean
    Default: false

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

    localOnly
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    includeError
    boolean
    Default: true

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    includeConfig
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    Responses

    Response samples

    Content type
    application/json
    [
    • {
      }
    ]

    Get replication status

    There was a problem with your request

    +

    Response samples

    Content type
    application/json
    [
    • {
      }
    ]

    Get replication status

    Retrieve the status of a replication.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Retrieve the status of a replication.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Replicator
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    replicationid
    required
    string [ 1 .. 160 ]

    What replication to target based on its replication ID.

    -
    query Parameters
    activeOnly
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    What replication to target based on its replication ID.

    +
    query Parameters
    activeOnly
    boolean
    Default: false

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

    localOnly
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    includeError
    boolean
    Default: true

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    includeConfig
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    Responses

    Response samples

    Content type
    application/json
    {
    • "replication_id": "string",
    • "config": {
      },
    • "status": "running",
    • "error_message": "string",
    • "docs_read": 0,
    • "docs_checked_pull": 0,
    • "docs_purged": 0,
    • "rejected_by_local": 0,
    • "last_seq_pull": "string",
    • "deltas_recv": 0,
    • "deltas_requested": 0,
    • "docs_written": 0,
    • "docs_checked_push": 0,
    • "doc_write_failures": 0,
    • "doc_write_conflicts": 0,
    • "rejected_by_remote": 0,
    • "last_seq_push": "string",
    • "deltas_sent": 0
    }

    Control a replication state

    Could not find replication

    +

    Response samples

    Content type
    application/json
    {
    • "replication_id": "string",
    • "config": {
      },
    • "status": "running",
    • "error_message": "string",
    • "docs_read": 0,
    • "docs_checked_pull": 0,
    • "docs_purged": 0,
    • "rejected_by_local": 0,
    • "last_seq_pull": "string",
    • "deltas_recv": 0,
    • "deltas_requested": 0,
    • "docs_written": 0,
    • "docs_checked_push": 0,
    • "doc_write_failures": 0,
    • "doc_write_conflicts": 0,
    • "rejected_by_remote": 0,
    • "last_seq_push": "string",
    • "deltas_sent": 0
    }

    Control a replication state

    Control the replication by changing its state.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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
    • @@ -3971,82 +3971,82 @@
      • Sync Gateway Replicator
      -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    replicationid
    required
    string [ 1 .. 160 ]

    What replication to target based on its replication ID.

    -
    query Parameters
    action
    required
    string
    Enum: "start" "stop" "reset"

    The target state to put the replicator into.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    What replication to target based on its replication ID.

    +
    query Parameters
    action
    required
    string
    Enum: "start" "stop" "reset"

    The target state to put the replicator into.

    Responses

    Response samples

    Content type
    application/json
    {
    • "replication_id": "string",
    • "config": {
      },
    • "status": "running",
    • "error_message": "string",
    • "docs_read": 0,
    • "docs_checked_pull": 0,
    • "docs_purged": 0,
    • "rejected_by_local": 0,
    • "last_seq_pull": "string",
    • "deltas_recv": 0,
    • "deltas_requested": 0,
    • "docs_written": 0,
    • "docs_checked_push": 0,
    • "doc_write_failures": 0,
    • "doc_write_conflicts": 0,
    • "rejected_by_remote": 0,
    • "last_seq_push": "string",
    • "deltas_sent": 0
    }

    Check if replication exists

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "replication_id": "string",
    • "config": {
      },
    • "status": "running",
    • "error_message": "string",
    • "docs_read": 0,
    • "docs_checked_pull": 0,
    • "docs_purged": 0,
    • "rejected_by_local": 0,
    • "last_seq_pull": "string",
    • "deltas_recv": 0,
    • "deltas_requested": 0,
    • "docs_written": 0,
    • "docs_checked_push": 0,
    • "doc_write_failures": 0,
    • "doc_write_conflicts": 0,
    • "rejected_by_remote": 0,
    • "last_seq_push": "string",
    • "deltas_sent": 0
    }

    Check if replication exists

    Check if a replication exists.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Check if a replication exists.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Replicator
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    replicationid
    required
    string [ 1 .. 160 ]

    What replication to target based on its replication ID.

    -
    query Parameters
    activeOnly
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    What replication to target based on its replication ID.

    +
    query Parameters
    activeOnly
    boolean
    Default: false

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

    localOnly
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    includeError
    boolean
    Default: true

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    includeConfig
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Handle incoming BLIP Sync web socket request

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Handle incoming BLIP Sync web socket request

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    client
    string
    Default: "cbl2"
    Enum: "cbl2" "sgr2"

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    client
    string
    Default: "cbl2"
    Enum: "cbl2" "sgr2"

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

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Metrics

    Cannot upgrade connection to a web socket connection

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Metrics

    Get Sync Gateway statistics

    -

    Get memory statistics

    Get memory statistics

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

    Required Sync Gateway RBAC roles:

    • Sync Gateway Architect
    • @@ -4054,10 +4054,10 @@
    • External Stats Reader

    Responses

    Response samples

    Content type
    application/json
    {
    • "memstats": { }
    }

    Get all Sync Gateway statistics in JSON format

    Returned memory usage statistics

    +

    Response samples

    Content type
    application/json
    {
    • "memstats": { }
    }

    Get all Sync Gateway statistics in JSON format

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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:

      @@ -4075,373 +4075,373 @@

    Responses

    Response samples

    Content type
    application/json
    {
    • "cmdline": { },
    • "memstats": { },
    • "cb": { },
    • "mc": { },
    • "syncGateway_changeCache": {
      },
    • "syncGateway_db": {
      },
    • "syncgateway": {
      }
    }

    Profiling

    Response samples

    Content type
    application/json
    {
    • "cmdline": { },
    • "memstats": { },
    • "cb": { },
    • "mc": { },
    • "syncGateway_changeCache": {
      },
    • "syncGateway_db": {
      },
    • "syncgateway": {
      }
    }

    Profiling

    Generate information to help debug and fine-tune Sync Gateway

    -

    Create point-in-time profile

    Create point-in-time profile

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    path Parameters
    profilename
    required
    string
    Enum: "heap" "block" "threadcreate" "mutex" "goroutine"

    The handler to use for profiling.

    -
    Request Body schema: application/json
    file
    string

    This is the file to output the pprof profile at.

    +
    path Parameters
    profilename
    required
    string
    Enum: "heap" "block" "threadcreate" "mutex" "goroutine"

    The handler to use for profiling.

    +
    Request Body schema: application/json
    file
    string

    This is the file to output the pprof profile at.

    Responses

    Request samples

    Content type
    application/json
    {
    • "file": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Start or Stop continuous CPU profiling

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "file": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Start or Stop continuous CPU profiling

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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
    -
    Request Body schema: application/json
    file
    string

    This is the file to output the pprof profile at.

    +
    Request Body schema: application/json
    file
    string

    This is the file to output the pprof profile at.

    Responses

    Request samples

    Content type
    application/json
    {
    • "file": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Dump heap profile

    There was a problem with your request

    +

    Request samples

    Content type
    application/json
    {
    • "file": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Dump heap profile

    This endpoint will dump a pprof heap profile.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This endpoint will dump a pprof heap profile.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    Request Body schema: application/json
    file
    string

    This is the file to output the pprof profile at.

    +
    Request Body schema: application/json
    file
    string

    This is the file to output the pprof profile at.

    Responses

    Request samples

    Content type
    application/json
    {
    • "file": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Get goroutine profile

    There was a problem with your request

    +

    Request samples

    Content type
    application/json
    {
    • "file": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Get goroutine profile

    Stack traces of all current goroutines.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Stack traces of all current goroutines.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer

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

    +
    query Parameters
    seconds
    integer

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

    Responses

    Get goroutine profile

    OK

    +

    Get goroutine profile

    Stack traces of all current goroutines.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Stack traces of all current goroutines.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer

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

    +
    query Parameters
    seconds
    integer

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

    Responses

    Get passed in command line parameters

    OK

    +

    Get passed in command line parameters

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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

    Get passed in command line parameters

    OK

    +

    Get passed in command line parameters

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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

    Get symbol pprof debug information

    OK

    +

    Get symbol pprof debug information

    Required Sync Gateway RBAC roles:

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops

    Responses

    Get symbol pprof debug information

    OK

    +

    Get symbol pprof debug information

    Required Sync Gateway RBAC roles:

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops

    Responses

    Get the heap pprof debug file

    OK

    +

    Get the heap pprof debug file

    Required Sync Gateway RBAC roles:

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer

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

    +
    query Parameters
    seconds
    integer

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

    Responses

    Get the heap pprof debug file

    OK

    +

    Get the heap pprof debug file

    Required Sync Gateway RBAC roles:

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer

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

    +
    query Parameters
    seconds
    integer

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

    Responses

    Get the profile pprof debug file

    OK

    +

    Get the profile pprof debug file

    Required Sync Gateway RBAC roles:

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer

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

    +
    query Parameters
    seconds
    integer

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

    Responses

    Get the profile pprof debug file

    OK

    +

    Get the profile pprof debug file

    Required Sync Gateway RBAC roles:

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer

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

    +
    query Parameters
    seconds
    integer

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

    Responses

    Get block profile

    OK

    +

    Get block profile

    Returns stack traces that led to blocking on synchronization primitives.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Returns stack traces that led to blocking on synchronization primitives.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer >= 0
    Default: 30

    The amount of seconds to run the profiler for.

    +
    query Parameters
    seconds
    integer >= 0
    Default: 30

    The amount of seconds to run the profiler for.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "forbidden",
    • "reason": "Can only run one mutex profile at a time"
    }

    Get block profile

    Forbidden

    +

    Response samples

    Content type
    application/json
    {
    • "error": "forbidden",
    • "reason": "Can only run one mutex profile at a time"
    }

    Get block profile

    Returns stack traces that led to blocking on synchronization primitives.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Returns stack traces that led to blocking on synchronization primitives.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer >= 0
    Default: 30

    The amount of seconds to run the profiler for.

    +
    query Parameters
    seconds
    integer >= 0
    Default: 30

    The amount of seconds to run the profiler for.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "forbidden",
    • "reason": "Can only run one mutex profile at a time"
    }

    Get the threadcreate pprof debug file

    Forbidden

    +

    Response samples

    Content type
    application/json
    {
    • "error": "forbidden",
    • "reason": "Can only run one mutex profile at a time"
    }

    Get the threadcreate pprof debug file

    Required Sync Gateway RBAC roles:

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops

    Responses

    Get the threadcreate pprof debug file

    OK

    +

    Get the threadcreate pprof debug file

    Required Sync Gateway RBAC roles:

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops

    Responses

    Get mutex profile

    OK

    +

    Get mutex profile

    Returns stack traces of holders of contended mutexes.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Returns stack traces of holders of contended mutexes.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer >= 0
    Default: 30

    The amount of seconds to run the profiler for.

    +
    query Parameters
    seconds
    integer >= 0
    Default: 30

    The amount of seconds to run the profiler for.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "forbidden",
    • "reason": "Can only run one mutex profile at a time"
    }

    Get mutex profile

    Forbidden

    +

    Response samples

    Content type
    application/json
    {
    • "error": "forbidden",
    • "reason": "Can only run one mutex profile at a time"
    }

    Get mutex profile

    Returns stack traces of holders of contended mutexes.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Returns stack traces of holders of contended mutexes.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer >= 0
    Default: 30

    The amount of seconds to run the profiler for.

    +
    query Parameters
    seconds
    integer >= 0
    Default: 30

    The amount of seconds to run the profiler for.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "forbidden",
    • "reason": "Can only run one mutex profile at a time"
    }

    Get trace profile

    Forbidden

    +

    Response samples

    Content type
    application/json
    {
    • "error": "forbidden",
    • "reason": "Can only run one mutex profile at a time"
    }

    Get trace profile

    Responds with the execution trace in binary form.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Responds with the execution trace in binary form.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer
    Default: 1

    Responses

    Get trace profile

    query Parameters
    seconds
    integer
    Default: 1

    Responses

    Get trace profile

    Responds with the execution trace in binary form.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Responds with the execution trace in binary form.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer
    Default: 1

    Responses

    Get fgprof profile

    query Parameters
    seconds
    integer
    Default: 1

    Responses

    Get fgprof profile

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer >= 0
    Default: 30

    The amount of seconds to run the profiler for.

    +
    query Parameters
    seconds
    integer >= 0
    Default: 30

    The amount of seconds to run the profiler for.

    Responses

    Get fgprof profile

    OK

    +

    Get fgprof profile

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

    Required Sync Gateway RBAC roles:

    • Sync Gateway Dev Ops
    -
    query Parameters
    seconds
    integer >= 0
    Default: 30

    The amount of seconds to run the profiler for.

    +
    query Parameters
    seconds
    integer >= 0
    Default: 30

    The amount of seconds to run the profiler for.

    Responses

    Unsupported

    OK

    +

    Unsupported

    Endpoints that are not supported by Sync Gateway

    -

    Revision tree structure in Graphviz Dot format | Unsupported

    Revision tree structure in Graphviz Dot format | Unsupported

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

    To use:

    1. Install the Graphviz tool. Using Brew, this can be done by calling brew install graphviz.
    2. @@ -4467,445 +4467,445 @@
    3. Sync Gateway Application Read Only
    4. Note: This endpoint is useful for debugging purposes only. It is not officially supported.

      -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string
    Example: doc1

    The document ID to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The document ID to run the operation against.

    Responses

    Response samples

    Content type
    application/json
    "digraph graphname{\"1-d4d949b7feafc8c31215684baa45b6cd\" -> \"2-4f3f24143ea43d85a9a340ac016fdfc4\"; }"

    Flush the entire database bucket | Unsupported

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    "digraph graphname{\"1-d4d949b7feafc8c31215684baa45b6cd\" -> \"2-4f3f24143ea43d85a9a340ac016fdfc4\"; }"

    Flush the entire database bucket | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Dump a view | Unsupported

    The bucket does not support flush or delete

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Dump a view | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    view
    required
    string

    The view to target.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The view to target.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Query a view on the default design document | Unsupported

    Internal Server Error

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Query a view on the default design document | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    view
    required
    string

    The view to target.

    -
    query Parameters
    inclusive_end
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The view to target.

    +
    query Parameters
    inclusive_end
    boolean

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

    descending
    boolean

    Return documents in descending order.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return documents in descending order.

    include_docs
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    reduce
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    group
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    skip
    integer

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    limit
    integer

    Return only the specified number of documents

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return only the specified number of documents

    group_level
    integer

    Specify the group level to be used.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Specify the group level to be used.

    startkey_docid
    string

    Return documents starting with the specified document identifier.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return documents starting with the specified document identifier.

    endkey_docid
    string

    Stop returning records when the specified document identifier is reached.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Stop returning records when the specified document identifier is reached.

    stale
    string
    Enum: "ok" "update_after"

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    startkey
    string

    Return records starting with the specified key.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return records starting with the specified key.

    endkey
    string

    Stop returning records when this key is reached.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Stop returning records when this key is reached.

    key
    string

    Return only the document that matches the specified key.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return only the document that matches the specified key.

    keys
    Array of strings

    An array of document ID strings to filter by.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    An array of document ID strings to filter by.

    Responses

    Response samples

    Content type
    application/json
    {
    • "total_rows": 0,
    • "rows": [
      ],
    • "errors": [
      ]
    }

    Dump all the documents in a channel | Unsupported

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "total_rows": 0,
    • "rows": [
      ],
    • "errors": [
      ]
    }

    Dump all the documents in a channel | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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
    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    channel
    required
    string

    The channel to dump all the documents from.

    -
    query Parameters
    since
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The channel to dump all the documents from.

    +
    query Parameters
    since
    string

    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.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Disabled endpoint

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Disabled endpoint

    This endpoint is disabled.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This endpoint is disabled.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Architect
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    Responses

    Get views of a design document | Unsupported

    This endpoint is disabled

    +

    Get views of a design document | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This is unsupported

    Query a design document.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Application
    • Sync Gateway Application Read Only
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    ddoc
    required
    string

    The design document name.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The design document name.

    Responses

    Response samples

    Content type
    application/json
    {
    • "language": "string",
    • "views": {
      },
    • "options": {
      }
    }

    Update views of a design document | Unsupported

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "language": "string",
    • "views": {
      },
    • "options": {
      }
    }

    Update views of a design document | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This is unsupported

    Update the views of a design document.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Application
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    ddoc
    required
    string

    The design document name.

    -
    Request Body schema: application/json
    language
    string
    object
    object

    Responses

    Request Body schema: application/json
    language
    string
    object
    object

    Responses

    Request samples

    Content type
    application/json
    {
    • "language": "string",
    • "views": {
      },
    • "options": {
      }
    }

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Delete a design document | Unsupported

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "language": "string",
    • "views": {
      },
    • "options": {
      }
    }

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Delete a design document | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This is unsupported

    Delete a design document.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Application
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    ddoc
    required
    string

    The design document name.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The design document name.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Check if view of design document exists | Unsupported

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Check if view of design document exists | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This is unsupported

    Check if a design document can be queried.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Application
    • Sync Gateway Application Read Only
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    ddoc
    required
    string

    The design document name.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The design document name.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Query a view on a design document | Unsupported

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Query a view on a design document | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This is unsupported

    Query a view on a design document.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Application
    • Sync Gateway Application Read Only
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    ddoc
    required
    string

    The design document name.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The design document name.

    view
    required
    string

    The view to target.

    -
    query Parameters
    inclusive_end
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The view to target.

    +
    query Parameters
    inclusive_end
    boolean

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

    descending
    boolean

    Return documents in descending order.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return documents in descending order.

    include_docs
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    reduce
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    group
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    skip
    integer

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    limit
    integer

    Return only the specified number of documents

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return only the specified number of documents

    group_level
    integer

    Specify the group level to be used.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Specify the group level to be used.

    startkey_docid
    string

    Return documents starting with the specified document identifier.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return documents starting with the specified document identifier.

    endkey_docid
    string

    Stop returning records when the specified document identifier is reached.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Stop returning records when the specified document identifier is reached.

    stale
    string
    Enum: "ok" "update_after"

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    startkey
    string

    Return records starting with the specified key.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return records starting with the specified key.

    endkey
    string

    Stop returning records when this key is reached.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Stop returning records when this key is reached.

    key
    string

    Return only the document that matches the specified key.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return only the document that matches the specified key.

    keys
    Array of strings

    An array of document ID strings to filter by.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    An array of document ID strings to filter by.

    Responses

    Response samples

    Content type
    application/json
    {
    • "total_rows": 0,
    • "rows": [
      ],
    • "errors": [
      ]
    }

    OpenID Connect mock provider

    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.

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "total_rows": 0,
    • "rows": [
      ],
    • "errors": [
      ]
    }

    OpenID Connect mock provider

    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.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    Responses

    Response samples

    Content type
    application/json
    {
    • "issuer": "string",
    • "authorization_endpoint": "string",
    • "token_endpoint": "string",
    • "jwks_uri": "string",
    • "userinfo_endpoint": "string",
    • "id_token_signing_alg_values_supported": "string",
    • "response_types_supported": "string",
    • "subject_types_supported": "string",
    • "scopes_supported": "string",
    • "claims_supported": "string",
    • "token_endpoint_auth_methods_supported": "string"
    }

    OpenID Connect mock login page

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    scope
    required
    string

    The OpenID Connect authentication scope.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "issuer": "string",
    • "authorization_endpoint": "string",
    • "token_endpoint": "string",
    • "jwks_uri": "string",
    • "userinfo_endpoint": "string",
    • "id_token_signing_alg_values_supported": "string",
    • "response_types_supported": "string",
    • "subject_types_supported": "string",
    • "scopes_supported": "string",
    • "claims_supported": "string",
    • "token_endpoint_auth_methods_supported": "string"
    }

    OpenID Connect mock login page

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    scope
    required
    string

    The OpenID Connect authentication scope.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    OpenID Connect mock login page

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    scope
    required
    string

    The OpenID Connect authentication scope.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    An error occurred.

    +

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    OpenID Connect mock login page

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    scope
    required
    string

    The OpenID Connect authentication scope.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    OpenID Connect mock token

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    Request Body schema: application/json
    grant_type
    required
    string

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

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    An error occurred.

    +

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    OpenID Connect mock token

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    Request Body schema: application/json
    grant_type
    required
    string

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

    code
    string

    grant_type=authorization_code only: The OpenID Connect authentication token.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    grant_type=authorization_code only: The OpenID Connect authentication token.

    refresh_token
    string

    grant_type=refresh_token only: The OpenID Connect refresh token.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    grant_type=refresh_token only: The OpenID Connect refresh token.

    Responses

    Request samples

    Content type
    application/json
    {
    • "grant_type": "string",
    • "code": "string",
    • "refresh_token": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "access_token": "string",
    • "token_type": "string",
    • "refresh_token": "string",
    • "expires_in": "string",
    • "id_token": "string"
    }

    OpenID Connect public certificates for signing keys

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "grant_type": "string",
    • "code": "string",
    • "refresh_token": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "access_token": "string",
    • "token_type": "string",
    • "refresh_token": "string",
    • "expires_in": "string",
    • "id_token": "string"
    }

    OpenID Connect public certificates for signing keys

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    Responses

    Response samples

    Content type
    application/json
    {
    • "keys": [
      ]
    }

    OpenID Connect mock login page handler

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    redirect_uri
    string

    The Sync Gateway OpenID Connect callback URL.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    An error occurred while getting the private RSA key

    +

    Response samples

    Content type
    application/json
    {
    • "keys": [
      ]
    }

    OpenID Connect mock login page handler

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    redirect_uri
    string

    The Sync Gateway OpenID Connect callback URL.

    scope
    required
    string

    The OpenID Connect authentication scope.

    -
    username
    required
    string
    tokenttl
    required
    integer
    identity-token-formats
    required
    string
    authenticated
    required
    string

    Responses

    username
    required
    string
    tokenttl
    required
    integer
    identity-token-formats
    required
    string
    authenticated
    required
    string

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    OpenID Connect mock login page handler

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    redirect_uri
    string

    The Sync Gateway OpenID Connect callback URL.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    OpenID Connect mock login page handler

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    redirect_uri
    string

    The Sync Gateway OpenID Connect callback URL.

    scope
    required
    string

    The OpenID Connect authentication scope.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The OpenID Connect authentication scope.

    Request Body schema: application/json

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

    -
    username
    required
    string
    tokenttl
    required
    string
    identity-token-formats
    required
    string
    authenticated
    required
    string

    Responses

    Request samples

    Content type
    application/json
    {
    • "username": "string",
    • "tokenttl": "string",
    • "identity-token-formats": "string",
    • "authenticated": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }
    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "username": "string",
    • "tokenttl": "string",
    • "identity-token-formats": "string",
    • "authenticated": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }
    -

    Sync Gateway Metrics REST API (4.0)

    Download OpenAPI specification:

    Introduction

    Sync Gateway Metrics REST API (4.0)

    Download OpenAPI specification:

    Introduction

    Sync Gateway manages access and synchronization between Couchbase Lite and Couchbase Server. The Sync Gateway Metrics REST API returns Sync Gateway metrics, in JSON or Prometheus-compatible formats, for performance monitoring and diagnostic purposes.

    -

    Prometheus

    Prometheus

    Endpoints for use with Prometheus

    -

    Get debugging and monitoring runtime stats in Prometheus Exposition format

    Get debugging and monitoring runtime stats in Prometheus Exposition format

    Returns Sync Gateway statistics and other runtime variables in Prometheus Exposition format.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    Returns Sync Gateway statistics and other runtime variables in Prometheus Exposition format.

    Required Sync Gateway RBAC roles:

    • Sync Gateway Architect
    • @@ -337,13 +337,13 @@

    Responses

    Response samples

    Content type
    application/json
    {
    • "sgw_audit_num_audits_filtered_by_role": 0,
    • "sgw_audit_num_audits_filtered_by_user": 0,
    • "sgw_audit_num_audits_logged": 0,
    • "sgw_cache_abandoned_seqs": 0,
    • "sgw_cache_chan_cache_active_revs": 0,
    • "sgw_cache_chan_cache_bypass_count": 0,
    • "sgw_cache_chan_cache_channels_added": 0,
    • "sgw_cache_chan_cache_channels_evicted_inactive": 0,
    • "sgw_cache_chan_cache_channels_evicted_nru": 0,
    • "sgw_cache_chan_cache_compact_count": 0,
    • "sgw_cache_chan_cache_compact_time": 0,
    • "sgw_cache_chan_cache_hits": 0,
    • "sgw_cache_chan_cache_max_entries": 0,
    • "sgw_cache_chan_cache_misses": 0,
    • "sgw_cache_chan_cache_num_channels": 0,
    • "sgw_cache_chan_cache_pending_queries": 0,
    • "sgw_cache_chan_cache_removal_revs": 0,
    • "sgw_cache_chan_cache_tombstone_revs": 0,
    • "sgw_cache_current_skipped_seq_count": 0,
    • "sgw_cache_high_seq_cached": 0,
    • "sgw_cache_high_seq_stable": 0,
    • "sgw_cache_non_mobile_ignored_count": 0,
    • "sgw_cache_num_active_channels": 0,
    • "sgw_cache_num_skipped_seqs": 0,
    • "sgw_cache_pending_seq_len": 0,
    • "sgw_cache_rev_cache_bypass": 0,
    • "sgw_cache_rev_cache_hits": 0,
    • "sgw_cache_rev_cache_misses": 0,
    • "sgw_cache_revision_cache_num_items": 0,
    • "sgw_cache_revision_cache_total_memory": 0,
    • "sgw_cache_skipped_seq_cap": 0,
    • "sgw_cache_skipped_seq_len": 0,
    • "sgw_cache_view_queries": 0,
    • "sgw_collection_doc_reads_bytes": 0,
    • "sgw_collection_doc_writes_bytes": 0,
    • "sgw_collection_import_count": 0,
    • "sgw_collection_num_doc_reads": 0,
    • "sgw_collection_num_doc_writes": 0,
    • "sgw_collection_sync_function_count": 0,
    • "sgw_collection_sync_function_exception_count": 0,
    • "sgw_collection_sync_function_reject_access_count": 0,
    • "sgw_collection_sync_function_reject_count": 0,
    • "sgw_collection_sync_function_time": 0,
    • "sgw_config_database_config_bucket_mismatches": 0,
    • "sgw_config_database_config_collection_conflicts": 0,
    • "sgw_database_compaction_attachment_start_time": 0,
    • "sgw_database_compaction_tombstone_start_time": 0,
    • "sgw_database_conflict_write_count": 0,
    • "sgw_database_crc32c_match_count": 0,
    • "sgw_database_dcp_caching_count": 0,
    • "sgw_database_dcp_caching_time": 0,
    • "sgw_database_dcp_received_count": 0,
    • "sgw_database_dcp_received_time": 0,
    • "sgw_database_doc_reads_bytes_blip": 0,
    • "sgw_database_doc_writes_bytes": 0,
    • "sgw_database_doc_writes_bytes_blip": 0,
    • "sgw_database_doc_writes_xattr_bytes": 0,
    • "sgw_database_high_seq_feed": 0,
    • "sgw_database_http_bytes_written": 0,
    • "sgw_database_num_attachments_compacted": 0,
    • "sgw_database_num_doc_reads_blip": 0,
    • "sgw_database_num_doc_reads_rest": 0,
    • "sgw_database_num_doc_writes": 0,
    • "sgw_database_num_idle_kv_ops": 0,
    • "sgw_database_num_public_rest_requests": 0,
    • "sgw_database_num_replications_active": 0,
    • "sgw_database_num_replications_rejected_limit": 0,
    • "sgw_database_num_replications_total": 0,
    • "sgw_database_num_tombstones_compacted": 0,
    • "sgw_database_public_rest_bytes_read": 0,
    • "sgw_database_replication_bytes_received": 0,
    • "sgw_database_replication_bytes_sent": 0,
    • "sgw_database_sequence_assigned_count": 0,
    • "sgw_database_sequence_get_count": 0,
    • "sgw_database_sequence_incr_count": 0,
    • "sgw_database_sequence_released_count": 0,
    • "sgw_database_sequence_reserved_count": 0,
    • "sgw_database_sync_function_count": 0,
    • "sgw_database_sync_function_exception_count": 0,
    • "sgw_database_sync_function_time": 0,
    • "sgw_database_total_sync_time": 0,
    • "sgw_database_warn_channel_name_size_count": 0,
    • "sgw_database_warn_channels_per_doc_count": 0,
    • "sgw_database_warn_grants_per_doc_count": 0,
    • "sgw_database_warn_xattr_size_count": 0,
    • "sgw_delta_sync_delta_cache_hit": 0,
    • "sgw_delta_sync_delta_pull_replication_count": 0,
    • "sgw_delta_sync_delta_push_doc_count": 0,
    • "sgw_delta_sync_delta_sync_miss": 0,
    • "sgw_delta_sync_deltas_requested": 0,
    • "sgw_delta_sync_deltas_sent": 0,
    • "sgw_gsi_views__count": 0,
    • "sgw_gsi_views__error_count": 0,
    • "sgw_gsi_views__time": 0,
    • "sgw_replication_expected_sequence_len": 0,
    • "sgw_replication_expected_sequence_len_post_cleanup": 0,
    • "sgw_replication_processed_sequence_len": 0,
    • "sgw_replication_processed_sequence_len_post_cleanup": 0,
    • "sgw_replication_pull_attachment_pull_bytes": 0,
    • "sgw_replication_pull_attachment_pull_count": 0,
    • "sgw_replication_pull_max_pending": 0,
    • "sgw_replication_pull_norev_send_count": 0,
    • "sgw_replication_pull_num_pull_repl_active_continuous": 0,
    • "sgw_replication_pull_num_pull_repl_active_one_shot": 0,
    • "sgw_replication_pull_num_pull_repl_caught_up": 0,
    • "sgw_replication_pull_num_pull_repl_since_zero": 0,
    • "sgw_replication_pull_num_pull_repl_total_caught_up": 0,
    • "sgw_replication_pull_num_pull_repl_total_continuous": 0,
    • "sgw_replication_pull_num_pull_repl_total_one_shot": 0,
    • "sgw_replication_pull_num_replications_active": 0,
    • "sgw_replication_pull_replacement_rev_send_count": 0,
    • "sgw_replication_pull_request_changes_count": 0,
    • "sgw_replication_pull_request_changes_time": 0,
    • "sgw_replication_pull_rev_error_count": 0,
    • "sgw_replication_pull_rev_processing_time": 0,
    • "sgw_replication_pull_rev_send_count": 0,
    • "sgw_replication_pull_rev_send_latency": 0,
    • "sgw_replication_push_attachment_push_bytes": 0,
    • "sgw_replication_push_attachment_push_count": 0,
    • "sgw_replication_push_doc_push_count": 0,
    • "sgw_replication_push_doc_push_error_count": 0,
    • "sgw_replication_push_propose_change_count": 0,
    • "sgw_replication_push_propose_change_time": 0,
    • "sgw_replication_push_write_processing_time": 0,
    • "sgw_replication_push_write_throttled_count": 0,
    • "sgw_replication_push_write_throttled_time": 0,
    • "sgw_replication_sgr_conflict_resolved_local_count": 0,
    • "sgw_replication_sgr_conflict_resolved_merge_count": 0,
    • "sgw_replication_sgr_conflict_resolved_remote_count": 0,
    • "sgw_replication_sgr_deltas_recv": 0,
    • "sgw_replication_sgr_deltas_requested": 0,
    • "sgw_replication_sgr_deltas_sent": 0,
    • "sgw_replication_sgr_docs_checked_recv": 0,
    • "sgw_replication_sgr_docs_checked_sent": 0,
    • "sgw_replication_sgr_num_attachment_bytes_pulled": 0,
    • "sgw_replication_sgr_num_attachment_bytes_pushed": 0,
    • "sgw_replication_sgr_num_attachments_pulled": 0,
    • "sgw_replication_sgr_num_attachments_pushed": 0,
    • "sgw_replication_sgr_num_connect_attempts_pull": 0,
    • "sgw_replication_sgr_num_connect_attempts_push": 0,
    • "sgw_replication_sgr_num_docs_failed_to_pull": 0,
    • "sgw_replication_sgr_num_docs_failed_to_push": 0,
    • "sgw_replication_sgr_num_docs_pulled": 0,
    • "sgw_replication_sgr_num_docs_purged": 0,
    • "sgw_replication_sgr_num_docs_pushed": 0,
    • "sgw_replication_sgr_num_handlers_panicked": 0,
    • "sgw_replication_sgr_num_reconnects_aborted_pull": 0,
    • "sgw_replication_sgr_num_reconnects_aborted_push": 0,
    • "sgw_replication_sgr_push_conflict_count": 0,
    • "sgw_replication_sgr_push_rejected_count": 0,
    • "sgw_resource_utilization_admin_net_bytes_recv": 0,
    • "sgw_resource_utilization_admin_net_bytes_sent": 0,
    • "sgw_resource_utilization_error_count": 0,
    • "sgw_resource_utilization_go_memstats_heapalloc": 0,
    • "sgw_resource_utilization_go_memstats_heapidle": 0,
    • "sgw_resource_utilization_go_memstats_heapinuse": 0,
    • "sgw_resource_utilization_go_memstats_heapreleased": 0,
    • "sgw_resource_utilization_go_memstats_pausetotalns": 0,
    • "sgw_resource_utilization_go_memstats_stackinuse": 0,
    • "sgw_resource_utilization_go_memstats_stacksys": 0,
    • "sgw_resource_utilization_go_memstats_sys": 0,
    • "sgw_resource_utilization_goroutines_high_watermark": 0,
    • "sgw_resource_utilization_node_cpu_percent_utilization": 0,
    • "sgw_resource_utilization_num_goroutines": 0,
    • "sgw_resource_utilization_process_cpu_percent_utilization": 0,
    • "sgw_resource_utilization_process_memory_resident": 0,
    • "sgw_resource_utilization_pub_net_bytes_recv": 0,
    • "sgw_resource_utilization_pub_net_bytes_sent": 0,
    • "sgw_resource_utilization_system_memory_total": 0,
    • "sgw_resource_utilization_uptime": 0,
    • "sgw_resource_utilization_warn_count": 0,
    • "sgw_security_auth_failed_count": 0,
    • "sgw_security_auth_success_count": 0,
    • "sgw_security_num_access_errors": 0,
    • "sgw_security_num_docs_rejected": 0,
    • "sgw_security_total_auth_time": 0,
    • "sgw_shared_bucket_import_import_cancel_cas": 0,
    • "sgw_shared_bucket_import_import_count": 0,
    • "sgw_shared_bucket_import_import_error_count": 0,
    • "sgw_shared_bucket_import_import_high_seq": 0,
    • "sgw_shared_bucket_import_import_partitions": 0,
    • "sgw_shared_bucket_import_import_processing_time": 0
    }

    JSON

    Response samples

    Content type
    application/json
    {
    • "sgw_audit_num_audits_filtered_by_role": 0,
    • "sgw_audit_num_audits_filtered_by_user": 0,
    • "sgw_audit_num_audits_logged": 0,
    • "sgw_cache_abandoned_seqs": 0,
    • "sgw_cache_chan_cache_active_revs": 0,
    • "sgw_cache_chan_cache_bypass_count": 0,
    • "sgw_cache_chan_cache_channels_added": 0,
    • "sgw_cache_chan_cache_channels_evicted_inactive": 0,
    • "sgw_cache_chan_cache_channels_evicted_nru": 0,
    • "sgw_cache_chan_cache_compact_count": 0,
    • "sgw_cache_chan_cache_compact_time": 0,
    • "sgw_cache_chan_cache_hits": 0,
    • "sgw_cache_chan_cache_max_entries": 0,
    • "sgw_cache_chan_cache_misses": 0,
    • "sgw_cache_chan_cache_num_channels": 0,
    • "sgw_cache_chan_cache_pending_queries": 0,
    • "sgw_cache_chan_cache_removal_revs": 0,
    • "sgw_cache_chan_cache_tombstone_revs": 0,
    • "sgw_cache_current_skipped_seq_count": 0,
    • "sgw_cache_high_seq_cached": 0,
    • "sgw_cache_high_seq_stable": 0,
    • "sgw_cache_non_mobile_ignored_count": 0,
    • "sgw_cache_num_active_channels": 0,
    • "sgw_cache_num_skipped_seqs": 0,
    • "sgw_cache_pending_seq_len": 0,
    • "sgw_cache_rev_cache_bypass": 0,
    • "sgw_cache_rev_cache_hits": 0,
    • "sgw_cache_rev_cache_misses": 0,
    • "sgw_cache_revision_cache_num_items": 0,
    • "sgw_cache_revision_cache_total_memory": 0,
    • "sgw_cache_skipped_seq_cap": 0,
    • "sgw_cache_skipped_seq_len": 0,
    • "sgw_cache_view_queries": 0,
    • "sgw_collection_doc_reads_bytes": 0,
    • "sgw_collection_doc_writes_bytes": 0,
    • "sgw_collection_import_count": 0,
    • "sgw_collection_num_doc_reads": 0,
    • "sgw_collection_num_doc_writes": 0,
    • "sgw_collection_sync_function_count": 0,
    • "sgw_collection_sync_function_exception_count": 0,
    • "sgw_collection_sync_function_reject_access_count": 0,
    • "sgw_collection_sync_function_reject_count": 0,
    • "sgw_collection_sync_function_time": 0,
    • "sgw_config_database_config_bucket_mismatches": 0,
    • "sgw_config_database_config_collection_conflicts": 0,
    • "sgw_database_compaction_attachment_start_time": 0,
    • "sgw_database_compaction_tombstone_start_time": 0,
    • "sgw_database_conflict_write_count": 0,
    • "sgw_database_crc32c_match_count": 0,
    • "sgw_database_dcp_caching_count": 0,
    • "sgw_database_dcp_caching_time": 0,
    • "sgw_database_dcp_received_count": 0,
    • "sgw_database_dcp_received_time": 0,
    • "sgw_database_doc_reads_bytes_blip": 0,
    • "sgw_database_doc_writes_bytes": 0,
    • "sgw_database_doc_writes_bytes_blip": 0,
    • "sgw_database_doc_writes_xattr_bytes": 0,
    • "sgw_database_high_seq_feed": 0,
    • "sgw_database_http_bytes_written": 0,
    • "sgw_database_num_attachments_compacted": 0,
    • "sgw_database_num_doc_reads_blip": 0,
    • "sgw_database_num_doc_reads_rest": 0,
    • "sgw_database_num_doc_writes": 0,
    • "sgw_database_num_idle_kv_ops": 0,
    • "sgw_database_num_public_rest_requests": 0,
    • "sgw_database_num_replications_active": 0,
    • "sgw_database_num_replications_rejected_limit": 0,
    • "sgw_database_num_replications_total": 0,
    • "sgw_database_num_tombstones_compacted": 0,
    • "sgw_database_public_rest_bytes_read": 0,
    • "sgw_database_replication_bytes_received": 0,
    • "sgw_database_replication_bytes_sent": 0,
    • "sgw_database_sequence_assigned_count": 0,
    • "sgw_database_sequence_get_count": 0,
    • "sgw_database_sequence_incr_count": 0,
    • "sgw_database_sequence_released_count": 0,
    • "sgw_database_sequence_reserved_count": 0,
    • "sgw_database_sync_function_count": 0,
    • "sgw_database_sync_function_exception_count": 0,
    • "sgw_database_sync_function_time": 0,
    • "sgw_database_total_sync_time": 0,
    • "sgw_database_warn_channel_name_size_count": 0,
    • "sgw_database_warn_channels_per_doc_count": 0,
    • "sgw_database_warn_grants_per_doc_count": 0,
    • "sgw_database_warn_xattr_size_count": 0,
    • "sgw_delta_sync_delta_cache_hit": 0,
    • "sgw_delta_sync_delta_pull_replication_count": 0,
    • "sgw_delta_sync_delta_push_doc_count": 0,
    • "sgw_delta_sync_delta_sync_miss": 0,
    • "sgw_delta_sync_deltas_requested": 0,
    • "sgw_delta_sync_deltas_sent": 0,
    • "sgw_gsi_views__count": 0,
    • "sgw_gsi_views__error_count": 0,
    • "sgw_gsi_views__time": 0,
    • "sgw_replication_expected_sequence_len": 0,
    • "sgw_replication_expected_sequence_len_post_cleanup": 0,
    • "sgw_replication_processed_sequence_len": 0,
    • "sgw_replication_processed_sequence_len_post_cleanup": 0,
    • "sgw_replication_pull_attachment_pull_bytes": 0,
    • "sgw_replication_pull_attachment_pull_count": 0,
    • "sgw_replication_pull_max_pending": 0,
    • "sgw_replication_pull_norev_send_count": 0,
    • "sgw_replication_pull_num_pull_repl_active_continuous": 0,
    • "sgw_replication_pull_num_pull_repl_active_one_shot": 0,
    • "sgw_replication_pull_num_pull_repl_caught_up": 0,
    • "sgw_replication_pull_num_pull_repl_since_zero": 0,
    • "sgw_replication_pull_num_pull_repl_total_caught_up": 0,
    • "sgw_replication_pull_num_pull_repl_total_continuous": 0,
    • "sgw_replication_pull_num_pull_repl_total_one_shot": 0,
    • "sgw_replication_pull_num_replications_active": 0,
    • "sgw_replication_pull_replacement_rev_send_count": 0,
    • "sgw_replication_pull_request_changes_count": 0,
    • "sgw_replication_pull_request_changes_time": 0,
    • "sgw_replication_pull_rev_error_count": 0,
    • "sgw_replication_pull_rev_processing_time": 0,
    • "sgw_replication_pull_rev_send_count": 0,
    • "sgw_replication_pull_rev_send_latency": 0,
    • "sgw_replication_push_attachment_push_bytes": 0,
    • "sgw_replication_push_attachment_push_count": 0,
    • "sgw_replication_push_doc_push_count": 0,
    • "sgw_replication_push_doc_push_error_count": 0,
    • "sgw_replication_push_propose_change_count": 0,
    • "sgw_replication_push_propose_change_time": 0,
    • "sgw_replication_push_write_processing_time": 0,
    • "sgw_replication_push_write_throttled_count": 0,
    • "sgw_replication_push_write_throttled_time": 0,
    • "sgw_replication_sgr_conflict_resolved_local_count": 0,
    • "sgw_replication_sgr_conflict_resolved_merge_count": 0,
    • "sgw_replication_sgr_conflict_resolved_remote_count": 0,
    • "sgw_replication_sgr_deltas_recv": 0,
    • "sgw_replication_sgr_deltas_requested": 0,
    • "sgw_replication_sgr_deltas_sent": 0,
    • "sgw_replication_sgr_docs_checked_recv": 0,
    • "sgw_replication_sgr_docs_checked_sent": 0,
    • "sgw_replication_sgr_num_attachment_bytes_pulled": 0,
    • "sgw_replication_sgr_num_attachment_bytes_pushed": 0,
    • "sgw_replication_sgr_num_attachments_pulled": 0,
    • "sgw_replication_sgr_num_attachments_pushed": 0,
    • "sgw_replication_sgr_num_connect_attempts_pull": 0,
    • "sgw_replication_sgr_num_connect_attempts_push": 0,
    • "sgw_replication_sgr_num_docs_failed_to_pull": 0,
    • "sgw_replication_sgr_num_docs_failed_to_push": 0,
    • "sgw_replication_sgr_num_docs_pulled": 0,
    • "sgw_replication_sgr_num_docs_purged": 0,
    • "sgw_replication_sgr_num_docs_pushed": 0,
    • "sgw_replication_sgr_num_handlers_panicked": 0,
    • "sgw_replication_sgr_num_reconnects_aborted_pull": 0,
    • "sgw_replication_sgr_num_reconnects_aborted_push": 0,
    • "sgw_replication_sgr_push_conflict_count": 0,
    • "sgw_replication_sgr_push_rejected_count": 0,
    • "sgw_resource_utilization_admin_net_bytes_recv": 0,
    • "sgw_resource_utilization_admin_net_bytes_sent": 0,
    • "sgw_resource_utilization_error_count": 0,
    • "sgw_resource_utilization_go_memstats_heapalloc": 0,
    • "sgw_resource_utilization_go_memstats_heapidle": 0,
    • "sgw_resource_utilization_go_memstats_heapinuse": 0,
    • "sgw_resource_utilization_go_memstats_heapreleased": 0,
    • "sgw_resource_utilization_go_memstats_pausetotalns": 0,
    • "sgw_resource_utilization_go_memstats_stackinuse": 0,
    • "sgw_resource_utilization_go_memstats_stacksys": 0,
    • "sgw_resource_utilization_go_memstats_sys": 0,
    • "sgw_resource_utilization_goroutines_high_watermark": 0,
    • "sgw_resource_utilization_node_cpu_percent_utilization": 0,
    • "sgw_resource_utilization_num_goroutines": 0,
    • "sgw_resource_utilization_process_cpu_percent_utilization": 0,
    • "sgw_resource_utilization_process_memory_resident": 0,
    • "sgw_resource_utilization_pub_net_bytes_recv": 0,
    • "sgw_resource_utilization_pub_net_bytes_sent": 0,
    • "sgw_resource_utilization_system_memory_total": 0,
    • "sgw_resource_utilization_uptime": 0,
    • "sgw_resource_utilization_warn_count": 0,
    • "sgw_security_auth_failed_count": 0,
    • "sgw_security_auth_success_count": 0,
    • "sgw_security_num_access_errors": 0,
    • "sgw_security_num_docs_rejected": 0,
    • "sgw_security_total_auth_time": 0,
    • "sgw_shared_bucket_import_import_cancel_cas": 0,
    • "sgw_shared_bucket_import_import_count": 0,
    • "sgw_shared_bucket_import_import_error_count": 0,
    • "sgw_shared_bucket_import_import_high_seq": 0,
    • "sgw_shared_bucket_import_import_partitions": 0,
    • "sgw_shared_bucket_import_import_processing_time": 0
    }

    JSON

    Endpoints for use with JSON metrics

    -

    Get all Sync Gateway statistics in JSON format

    Get all Sync Gateway statistics in JSON format

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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:

      @@ -361,21 +361,21 @@

    Responses

    Response samples

    Content type
    application/json
    {
    • "cmdline": { },
    • "memstats": { },
    • "cb": { },
    • "mc": { },
    • "syncGateway_changeCache": {
      },
    • "syncGateway_db": {
      },
    • "syncgateway": {
      }
    }

    Server

    Response samples

    Content type
    application/json
    {
    • "cmdline": { },
    • "memstats": { },
    • "cb": { },
    • "mc": { },
    • "syncGateway_changeCache": {
      },
    • "syncGateway_db": {
      },
    • "syncgateway": {
      }
    }

    Server

    Endpoints for managing the REST API

    -

    Check if API is available

    Returns OK status if API is available.

    +

    Check if API is available

    Returns OK status if API is available.

    Responses

    Response samples

    Content type
    text/plain
    OK
    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Returned status

    +

    Response samples

    Content type
    text/plain
    OK
    -

    Sync Gateway Public REST API (4.0)

    Download OpenAPI specification:

    Introduction

    Sync Gateway Public REST API (4.0)

    Download OpenAPI specification:

    Introduction

    Sync Gateway manages access and synchronization between Couchbase Lite and Couchbase Server. The Sync Gateway Public REST API is used for client replication.

    -

    Server

    Server

    Manage server activities

    -

    Get server information

    Returns information about the Sync Gateway node.

    +

    Get server information

    Returns information about the Sync Gateway node.

    Responses

    Response samples

    Content type
    application/json
    {
    • "ADMIN": true,
    • "couchdb": "Welcome",
    • "vendor": {
      },
    • "version": "Couchbase Sync Gateway/3.1.0(1;a765231) EE",
    • "persistent_config": true
    }

    Check if server online

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

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Returned server information

    +

    Response samples

    Content type
    application/json
    {
    • "ADMIN": true,
    • "couchdb": "Welcome",
    • "vendor": {
      },
    • "version": "Couchbase Sync Gateway/3.1.0(1;a765231) EE",
    • "persistent_config": true
    }

    Check if server online

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

    Responses

    Check if API is available

    Returns OK status if API is available.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Server is online

    +

    Check if API is available

    Returns OK status if API is available.

    Responses

    Response samples

    Content type
    text/plain
    OK

    Database Management

    Returned status

    +

    Response samples

    Content type
    text/plain
    OK

    Database Management

    Create and manage Sync Gateway databases

    -

    Get database information

    Retrieve information about the database.

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +

    Get database information

    Retrieve information about the database.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    Responses

    Response samples

    Content type
    application/json
    {
    • "db_name": "db",
    • "update_seq": 123456,
    • "committed_update_seq": 123456,
    • "instance_start_time": 1644600082279583,
    • "compact_running": true,
    • "purge_seq": 0,
    • "disk_format_version": 0,
    • "state": "Online",
    • "server_uuid": "995618a6a6cc9ac79731bd13240e19b5"
    }

    Check if database exists

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "db_name": "db",
    • "update_seq": 123456,
    • "committed_update_seq": 123456,
    • "instance_start_time": 1644600082279583,
    • "compact_running": true,
    • "purge_seq": 0,
    • "disk_format_version": 0,
    • "state": "Online",
    • "server_uuid": "995618a6a6cc9ac79731bd13240e19b5"
    }

    Check if database exists

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Create DB public API stub

    A stub that always returns an error on the Public API, for createTarget/CouchDB compatibility.

    -
    path Parameters
    targetdb
    required
    string

    The database name to target.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Create DB public API stub

    A stub that always returns an error on the Public API, for createTarget/CouchDB compatibility.

    +
    path Parameters
    targetdb
    required
    string

    The database name to target.

    Responses

    Ensure Full Commit Deprecated

    Database exists

    +

    Ensure Full Commit Deprecated

    This endpoint is non-functional but is present for CouchDB compatibility. This was deprecated in CouchDB 3.0.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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
    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    Responses

    Response samples

    Content type
    application/json
    {
    • "instance_start_time": 1644600082279583,
    • "ok": true
    }

    Session

    OK

    +

    Response samples

    Content type
    application/json
    {
    • "instance_start_time": 1644600082279583,
    • "ok": true
    }

    Session

    Manage user sessions

    -

    Get information about the current user

    This will get the information about the current user.

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +

    Get information about the current user

    This will get the information about the current user.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    Responses

    Response samples

    Content type
    application/json
    {
    • "authentication_handlers": [
      ],
    • "ok": true,
    • "userCtx": {
      }
    }

    Create a new user session

    Generates a login session for the user based on the credentials provided in the request body or if that fails (due to invalid credentials or none provided at all), generates the new session for the currently authenticated user instead. On a successful session creation, a session cookie is stored to keep the user authenticated for future API calls.

    -

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    Request Body schema: application/json

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

    -
    name
    string

    User name to generate the session for.

    -
    password
    string

    Password of the user to generate the session for.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Properties associated with a user session

    +

    Response samples

    Content type
    application/json
    {
    • "authentication_handlers": [
      ],
    • "ok": true,
    • "userCtx": {
      }
    }

    Create a new user session

    Generates a login session for the user based on the credentials provided in the request body or if that fails (due to invalid credentials or none provided at all), generates the new session for the currently authenticated user instead. 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.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    one_time
    boolean

    Sets the session to only be valid for a single authentication. This session will expire in 5 minutes if not used.

    +
    Request Body schema: application/json
    optional

    When name and password are included in the request body, the session will be created for the specified user. Otherwise the session will be created for the authenticated user making the request.

    +
    name
    string

    User name to generate the session for. Omit this value to generate a session for the authenticated user.

    +
    password
    string

    Password of the user to generate the session for. Omit this value to generate a session for the authenticated user.

    Responses

    Request samples

    Content type
    application/json
    {
    • "name": "string",
    • "password": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "authentication_handlers": [
      ],
    • "ok": true,
    • "userCtx": {
      }
    }

    Log out

    Invalidates the session for the currently authenticated user and removes their session cookie.

    -

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

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

    +

    Request samples

    Content type
    application/json
    {
    • "name": "string",
    • "password": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "authentication_handlers": [
      ],
    • "ok": true,
    • "userCtx": {
      },
    • "one_time_session_id": "c5af80a039db4ed9d2b6865576b6999935282689"
    }

    Log out

    Invalidates the session for the currently authenticated user and removes their session cookie.

    +

    If Origin header is passed to this endpoint, the Origin header must match both the cors.login_origin and cors.origin configuration options.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Authentication

    Successfully removed session (logged out)

    +

    Response samples

    Content type
    application/json
    {
    • "error": "Bad Request",
    • "reason": "No CORS"
    }

    Authentication

    Manage OpenID Connect Authentication

    -

    OpenID Connect authentication initiation via Location header redirect

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    provider
    string

    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.

    +

    OpenID Connect authentication initiation via Location header redirect

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    provider
    string

    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
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    OpenID Connect authentication initiation via WWW-Authenticate header

    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.

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    provider
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Unable to connect and validate with the OpenID Connect provider requested

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    OpenID Connect authentication initiation via WWW-Authenticate header

    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.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    provider
    string

    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
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    OpenID Connect authentication callback

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    error
    string

    The OpenID Connect error, if any occurred.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Unable to connect and validate with the OpenID Connect provider requested

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    OpenID Connect authentication callback

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    error
    string

    The OpenID Connect error, if any occurred.

    code
    required
    string

    The OpenID Connect authentication code.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The OpenID Connect authentication code.

    provider
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    state
    string

    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).

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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

    Response samples

    Content type
    application/json
    {
    • "id_token": "string",
    • "refresh_token": "string",
    • "session_id": "string",
    • "name": "string",
    • "access_token": "string",
    • "token_type": "string",
    • "expires_in": 0
    }

    OpenID Connect token refresh

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    refresh_token
    required
    string

    The OpenID Connect refresh token.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    A problem occurred in regards to the token

    +

    Response samples

    Content type
    application/json
    {
    • "id_token": "string",
    • "refresh_token": "string",
    • "session_id": "string",
    • "name": "string",
    • "access_token": "string",
    • "token_type": "string",
    • "expires_in": 0
    }

    OpenID Connect token refresh

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    refresh_token
    required
    string

    The OpenID Connect refresh token.

    provider
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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

    Response samples

    Content type
    application/json
    {
    • "id_token": "string",
    • "refresh_token": "string",
    • "session_id": "string",
    • "name": "string",
    • "access_token": "string",
    • "token_type": "string",
    • "expires_in": 0
    }

    Create a new Facebook-based session Deprecated

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

    -

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    Request Body schema: application/json
    access_token
    required
    string

    Facebook access token to base the new session on.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Unable to connect and validate with the OpenID Connect provider requested

    +

    Response samples

    Content type
    application/json
    {
    • "id_token": "string",
    • "refresh_token": "string",
    • "session_id": "string",
    • "name": "string",
    • "access_token": "string",
    • "token_type": "string",
    • "expires_in": 0
    }

    Create a new Facebook-based session Deprecated

    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.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    Request Body schema: application/json
    access_token
    required
    string

    Facebook access token to base the new session on.

    Responses

    Request samples

    Content type
    application/json
    {
    • "access_token": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Create a new Google-based session Deprecated

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

    -

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    Request Body schema: application/json
    id_token
    required
    string

    Google ID token to base the new session on.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Unable to send request to Facebook API

    +

    Request samples

    Content type
    application/json
    {
    • "access_token": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "Bad Request",
    • "reason": "No CORS"
    }

    Create a new Google-based session Deprecated

    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.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    Request Body schema: application/json
    id_token
    required
    string

    Google ID token to base the new session on.

    Responses

    Request samples

    Content type
    application/json
    {
    • "id_token": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Document

    Unable to send request to the Google token verifier

    +

    Request samples

    Content type
    application/json
    {
    • "id_token": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "Bad Request",
    • "reason": "No CORS"
    }

    Document

    Create and manage documents

    -

    Create a new document

    Create a new document

    Create a new document in the keyspace.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    query Parameters
    roundtrip
    boolean

    Block until document has been received by change cache

    -
    Request Body schema: application/json
    _id
    string

    The ID of the document.

    +
    query Parameters
    roundtrip
    boolean

    Block until document has been received by change cache

    +
    Request Body schema: application/json
    _id
    string

    The ID of the document.

    _rev
    string

    The revision of the document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The revision of the document.

    _exp
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    _deleted
    boolean

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

    -
    object
    object
    property name*
    additional property
    any

    Responses

    object
    object
    property name*
    additional property
    any

    Responses

    Request samples

    Content type
    application/json
    {
    • "_id": "string",
    • "_rev": "string",
    • "_exp": "string",
    • "_deleted": true,
    • "_revisions": {
      },
    • "_attachments": {
      }
    }

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Get a document

    Retrieve a document from the database by its doc ID.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    Invalid content type

    +

    Request samples

    Content type
    application/json
    {
    • "_id": "string",
    • "_rev": "string",
    • "_exp": "string",
    • "_deleted": true,
    • "_revisions": {
      },
    • "_attachments": {
      }
    }

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Get a document

    Retrieve a document from the database by its doc ID.

    +
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string
    Example: doc1

    The document ID to run the operation against.

    -
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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.)

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The document ID to run the operation against.

    +
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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
    Array of strings

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    revs_from
    Array of strings

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    Array of strings

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    revs_limit
    integer

    Maximum amount of revisions to return for each document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Maximum amount of revisions to return for each document.

    attachments
    boolean

    Include attachment bodies in response.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Include attachment bodies in response.

    replicator2
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    Responses

    Response samples

    Content type
    application/json
    {
    • "FailedLoginAttempts": 5,
    • "Friends": [
      ],
    • "_id": "AliceSettings",
    • "_rev": "1-64d4a1f179db5c1848fe52967b47c166",
    • "_cv": "1@src"
    }

    Upsert a document

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

    +

    Response samples

    Content type
    application/json
    {
    • "FailedLoginAttempts": 5,
    • "Friends": [
      ],
    • "_id": "AliceSettings",
    • "_rev": "1-64d4a1f179db5c1848fe52967b47c166",
    • "_cv": "1@src"
    }

    Upsert a document

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

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

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

    The maximum size for a document is 20MB.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string
    Example: doc1

    The document ID to run the operation against.

    -
    query Parameters
    roundtrip
    boolean

    Block until document has been received by change cache

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The document ID to run the operation against.

    +
    query Parameters
    roundtrip
    boolean

    Block until document has been received by change cache

    replicator2
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    new_edits
    boolean
    Default: true

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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.)

    -
    header Parameters
    If-Match
    string

    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.

    -
    Request Body schema: application/json
    _id
    string

    The ID of the document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.)

    +
    header Parameters
    If-Match
    string

    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.

    +
    Request Body schema: application/json
    _id
    string

    The ID of the document.

    _rev
    string

    The revision of the document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The revision of the document.

    _exp
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    _deleted
    boolean

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

    -
    object
    object
    property name*
    additional property
    any

    Responses

    object
    object
    property name*
    additional property
    any

    Responses

    Request samples

    Content type
    application/json
    {
    • "_id": "string",
    • "_rev": "string",
    • "_exp": "string",
    • "_deleted": true,
    • "_revisions": {
      },
    • "_attachments": {
      }
    }

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Delete a document

    Invalid content type

    +

    Request samples

    Content type
    application/json
    {
    • "_id": "string",
    • "_rev": "string",
    • "_exp": "string",
    • "_deleted": true,
    • "_revisions": {
      },
    • "_attachments": {
      }
    }

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Delete a document

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string
    Example: doc1

    The document ID to run the operation against.

    -
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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.)

    -
    header Parameters
    If-Match
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The document ID to run the operation against.

    +
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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.)

    +
    header Parameters
    If-Match
    string

    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

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Check if a document exists

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

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Check if a document exists

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

    +
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string
    Example: doc1

    The document ID to run the operation against.

    -
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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.)

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The document ID to run the operation against.

    +
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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
    Array of strings

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    revs_from
    Array of strings

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    Array of strings

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    revs_limit
    integer

    Maximum amount of revisions to return for each document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Maximum amount of revisions to return for each document.

    attachments
    boolean

    Include attachment bodies in response.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Include attachment bodies in response.

    replicator2
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Get changes list

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Get changes list

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    query Parameters
    limit
    integer

    Maximum number of changes to return.

    +
    query Parameters
    limit
    integer

    Maximum number of changes to return.

    since
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    style
    string
    Default: "main_only"
    Enum: "main_only" "all_docs"

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    active_only
    boolean
    Default: false

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    include_docs
    boolean

    Include the body associated with each document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Include the body associated with each document.

    revocations
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    filter
    string
    Enum: "sync_gateway/bychannel" "_doc_ids"

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    channels
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    doc_ids
    Array of strings

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    heartbeat
    integer
    Default: 0

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    timeout
    integer [ 0 .. 900000 ]
    Default: 300000

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    feed
    string
    Default: "normal"
    Enum: "normal" "longpoll" "continuous" "websocket"

    The type of changes feed to use.

    -
    version_type
    string
    Default: "rev"
    Enum Description
    rev

    Revision Tree IDs. For example: 1-293a80ce8f4874724732f27d35b3959a13cd96e0

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The type of changes feed to use.

    +
    version_type
    string
    Default: "rev"
    Enum Description
    rev

    Revision Tree IDs. For example: 1-293a80ce8f4874724732f27d35b3959a13cd96e0

    cv

    Current Version. For example: 1854e4e557cc0000@zTWkmBiYZgNQo7BHVZrB/Q

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Current Version. For example: 1854e4e557cc0000@zTWkmBiYZgNQo7BHVZrB/Q

    The preferred type of document versioning to use for the changes feed.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The preferred type of document versioning to use for the changes feed.

    Responses

    Response samples

    Content type
    application/json
    {
    • "results": [
      ],
    • "last_seq": "string"
    }

    Get changes list

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "results": [
      ],
    • "last_seq": "string"
    }

    Get changes list

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    Request Body schema: application/json
    limit
    string

    Maximum number of changes to return.

    +
    Request Body schema: application/json
    limit
    string

    Maximum number of changes to return.

    style
    string

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    active_only
    string

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    include_docs
    boolean

    Include the body associated with each document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Include the body associated with each document.

    revocations
    string

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    filter
    string

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    channels
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    doc_ids
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    heartbeat
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    timeout
    string

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    feed
    string

    The type of changes feed to use.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The type of changes feed to use.

    Responses

    Request samples

    Content type
    application/json
    {
    • "limit": "string",
    • "style": "string",
    • "active_only": "string",
    • "include_docs": true,
    • "revocations": "string",
    • "filter": "string",
    • "channels": "string",
    • "doc_ids": "string",
    • "heartbeat": "string",
    • "timeout": "string",
    • "feed": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "results": [
      ],
    • "last_seq": "string"
    }

    Gets all the documents in the database with the given parameters

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "limit": "string",
    • "style": "string",
    • "active_only": "string",
    • "include_docs": true,
    • "revocations": "string",
    • "filter": "string",
    • "channels": "string",
    • "doc_ids": "string",
    • "heartbeat": "string",
    • "timeout": "string",
    • "feed": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "results": [
      ],
    • "last_seq": "string"
    }

    Gets all the documents in the database with the given parameters

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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 or POST /{keyspace}/_bulk_get have more efficient implementations and should be used instead.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    query Parameters
    include_docs
    boolean

    Include the body associated with each document.

    +
    query Parameters
    include_docs
    boolean

    Include the body associated with each document.

    channels
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    access
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    revs
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    update_seq
    boolean

    Include the document sequence number update_seq property for each document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Include the document sequence number update_seq property for each document.

    keys
    Array of strings

    An array of document ID strings to filter by.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    An array of document ID strings to filter by.

    startkey
    string

    Return records starting with the specified key.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return records starting with the specified key.

    endkey
    string

    Stop returning records when this key is reached.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Stop returning records when this key is reached.

    limit
    number

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    Responses

    Response samples

    Content type
    application/json
    {
    • "rows": [
      ],
    • "total_rows": 0,
    • "update_seq": 0
    }

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

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "rows": [
      ],
    • "total_rows": 0,
    • "update_seq": 0
    }

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

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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 or POST /{keyspace}/_bulk_get have more efficient implementations and should be used instead.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    query Parameters
    include_docs
    boolean

    Include the body associated with each document.

    +
    query Parameters
    include_docs
    boolean

    Include the body associated with each document.

    channels
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    access
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    revs
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    update_seq
    boolean

    Include the document sequence number update_seq property for each document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Include the document sequence number update_seq property for each document.

    startkey
    string

    Return records starting with the specified key.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return records starting with the specified key.

    endkey
    string

    Stop returning records when this key is reached.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Stop returning records when this key is reached.

    limit
    number

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

    -
    Request Body schema: application/json
    keys
    required
    Array of strings

    List of the documents to retrieve.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    +
    Request Body schema: application/json
    keys
    required
    Array of strings

    List of the documents to retrieve.

    Responses

    Request samples

    Content type
    application/json
    {
    • "keys": [
      ]
    }

    Response samples

    Content type
    application/json
    {
    • "rows": [
      ],
    • "total_rows": 0,
    • "update_seq": 0
    }

    Bulk document operations

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "keys": [
      ]
    }

    Response samples

    Content type
    application/json
    {
    • "rows": [
      ],
    • "total_rows": 0,
    • "update_seq": 0
    }

    Bulk document operations

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    Request Body schema: application/json
    new_edits
    boolean
    Default: true

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

    -
    required
    Array of objects

    Responses

    Request samples

    Content type
    application/json
    {
    • "new_edits": true,
    • "docs": [
      ]
    }

    Response samples

    Content type
    application/json
    Example
    [
    • {
      },
    • {
      },
    • {
      }
    ]

    Get multiple documents in a MIME multipart response

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "new_edits": true,
    • "docs": [
      ]
    }

    Response samples

    Content type
    application/json
    Example
    [
    • {
      },
    • {
      },
    • {
      }
    ]

    Get multiple documents in a MIME multipart response

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    query Parameters
    attachments
    boolean
    Default: false

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

    +
    query Parameters
    attachments
    boolean
    Default: false

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

    revs
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    revs_limit
    integer

    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.

    -
    header Parameters
    X-Accept-Part-Encoding
    string

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    +
    header Parameters
    X-Accept-Part-Encoding
    string

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

    Accept-Encoding
    string

    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.

    -
    Request Body schema: application/json
    required
    Array of objects

    Responses

    Request Body schema: application/json
    required
    Array of objects

    Responses

    Request samples

    Content type
    application/json
    {
    • "docs": [
      ]
    }

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Get local document

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "docs": [
      ]
    }

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Get local document

    This request retrieves a local document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Upsert a local document

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Upsert a local document

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

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

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

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    Request Body schema: application/json

    The body of the document

    -
    _rev
    string

    Revision to replace. Required if updating existing local document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    The body of the document

    +
    _rev
    string

    Revision to replace. Required if updating existing local document.

    Responses

    Request samples

    Content type
    application/json
    {
    • "_rev": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Delete a local document

    A conflict would result from updating this document revision.

    +

    Request samples

    Content type
    application/json
    {
    • "_rev": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Delete a local document

    This request deletes a local document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string

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

    -
    query Parameters
    rev
    required
    string

    The revision ID of the revision to delete.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    +
    query Parameters
    rev
    required
    string

    The revision ID of the revision to delete.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Check if local document exists

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

    +

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Check if local document exists

    This request checks if a local document exists.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Compare revisions to what is in the database

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

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    Compare revisions to what is in the database

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

    +
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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.

    -
    Request Body schema: application/json
    docid
    Array of strings

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

    +
    Request Body schema: application/json
    docid
    Array of strings

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

    Responses

    Request samples

    Content type
    application/json
    {
    • "docid": [
      ]
    }

    Response samples

    Content type
    application/json
    {
    • "docid": {
      }
    }

    Document Attachment

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "docid": [
      ]
    }

    Response samples

    Content type
    application/json
    {
    • "docid": {
      }
    }

    Document Attachment

    Create and manage document attachments

    -

    Get an attachment from a document

    Get an attachment from a document

    This request retrieves a file attachment associated with the document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string
    Example: doc1

    The document ID to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The document ID to run the operation against.

    attach
    required
    string

    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).

    -
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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.)

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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).

    +
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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.)

    content_encoding
    boolean
    Default: true

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    meta
    boolean
    Default: false

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

    -
    header Parameters
    Range
    string
    Example: bytes=123-456

    RFC-2616 bytes range header.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    +
    header Parameters
    Range
    string
    Example: bytes=123-456

    RFC-2616 bytes range header.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Create or update an attachment on a document

    Requested range exceeds content length

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Create or update an attachment on a document

    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.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    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.

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string
    Example: doc1

    The document ID to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The document ID to run the operation against.

    attach
    required
    string

    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).

    -
    query Parameters
    rev
    string

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

    -
    header Parameters
    Content-Type
    string
    Default: application/octet-stream

    The content type of the attachment.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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).

    +
    query Parameters
    rev
    string

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

    +
    header Parameters
    Content-Type
    string
    Default: application/octet-stream

    The content type of the attachment.

    If-Match
    string

    An alternative way of specifying the document revision ID.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    An alternative way of specifying the document revision ID.

    Request Body schema: Attachment content type

    The attachment data

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    The attachment data

    string

    The content to store in the body

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The content to store in the body

    Responses

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Check if attachment exists

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

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    Resource already exists under that name

    +

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Check if attachment exists

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

    +
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string
    Example: doc1

    The document ID to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The document ID to run the operation against.

    attach
    required
    string

    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).

    -
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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.)

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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).

    +
    query Parameters
    rev
    string
    Example: rev=2-5145e1086bb8d1d71a531e9f6b543c58

    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

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Delete an attachment on a document

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Delete an attachment on a document

    This request deletes an attachment associated with the document.

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This request deletes an attachment associated with the document.

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

    -
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection
    path Parameters
    keyspace
    required
    string
    Examples:
    • db1 - Default scope and collection
    • db1.collection1 - Named collection within the default scope
    • db1.scope1.collection1 - Fully-qualified scope and collection

    The keyspace to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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
    required
    string
    Example: doc1

    The document ID to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The document ID to run the operation against.

    attach
    required
    string

    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).

    -
    query Parameters
    rev
    string

    The existing document revision ID to modify.

    -
    header Parameters
    If-Match
    string

    An alternative way of specifying the document revision ID.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    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).

    +
    query Parameters
    rev
    string

    The existing document revision ID to modify.

    +
    header Parameters
    If-Match
    string

    An alternative way of specifying the document revision ID.

    Responses

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Replication

    Resource already exists under that name

    +

    Response samples

    Content type
    application/json
    {
    • "id": "string",
    • "ok": true,
    • "rev": "string",
    • "cv": "string"
    }

    Replication

    Create and manage inter-Sync Gateway replications

    -

    Handle incoming BLIP Sync web socket request

    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.

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    client
    string
    Default: "cbl2"
    Enum: "cbl2" "sgr2"

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

    +

    Handle incoming BLIP Sync web socket request

    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.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    client
    string
    Default: "cbl2"
    Enum: "cbl2" "sgr2"

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

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Unsupported

    Cannot upgrade connection to a web socket connection

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Unsupported

    Endpoints that are not supported by Sync Gateway

    -

    Get views of a design document | Unsupported

    Get views of a design document | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This is unsupported

    Query a design document.

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    ddoc
    required
    string

    The design document name.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The design document name.

    Responses

    Response samples

    Content type
    application/json
    {
    • "language": "string",
    • "views": {
      },
    • "options": {
      }
    }

    Update views of a design document | Unsupported

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "language": "string",
    • "views": {
      },
    • "options": {
      }
    }

    Update views of a design document | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This is unsupported

    Update the views of a design document.

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    ddoc
    required
    string

    The design document name.

    -
    Request Body schema: application/json
    language
    string
    object
    object

    Responses

    Request Body schema: application/json
    language
    string
    object
    object

    Responses

    Request samples

    Content type
    application/json
    {
    • "language": "string",
    • "views": {
      },
    • "options": {
      }
    }

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Delete a design document | Unsupported

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "language": "string",
    • "views": {
      },
    • "options": {
      }
    }

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Delete a design document | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This is unsupported

    Delete a design document.

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    ddoc
    required
    string

    The design document name.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The design document name.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Check if view of design document exists | Unsupported

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Check if view of design document exists | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This is unsupported

    Check if a design document can be queried.

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    ddoc
    required
    string

    The design document name.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The design document name.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Query a view on a design document | Unsupported

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    Query a view on a design document | Unsupported

    This is unsupported

    +" class="sc-eVqvcJ sc-fszimp kIppRw kbZred">

    This is unsupported

    Query a view on a design document.

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    ddoc
    required
    string

    The design document name.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The design document name.

    view
    required
    string

    The view to target.

    -
    query Parameters
    inclusive_end
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The view to target.

    +
    query Parameters
    inclusive_end
    boolean

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

    descending
    boolean

    Return documents in descending order.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return documents in descending order.

    include_docs
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    reduce
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    group
    boolean

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    skip
    integer

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    limit
    integer

    Return only the specified number of documents

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return only the specified number of documents

    group_level
    integer

    Specify the group level to be used.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Specify the group level to be used.

    startkey_docid
    string

    Return documents starting with the specified document identifier.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return documents starting with the specified document identifier.

    endkey_docid
    string

    Stop returning records when the specified document identifier is reached.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Stop returning records when the specified document identifier is reached.

    stale
    string
    Enum: "ok" "update_after"

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

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

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

    startkey
    string

    Return records starting with the specified key.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return records starting with the specified key.

    endkey
    string

    Stop returning records when this key is reached.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Stop returning records when this key is reached.

    key
    string

    Return only the document that matches the specified key.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    Return only the document that matches the specified key.

    keys
    Array of strings

    An array of document ID strings to filter by.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    An array of document ID strings to filter by.

    Responses

    Response samples

    Content type
    application/json
    {
    • "total_rows": 0,
    • "rows": [
      ],
    • "errors": [
      ]
    }

    OpenID Connect mock provider

    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.

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "total_rows": 0,
    • "rows": [
      ],
    • "errors": [
      ]
    }

    OpenID Connect mock provider

    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.

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    Responses

    Response samples

    Content type
    application/json
    {
    • "issuer": "string",
    • "authorization_endpoint": "string",
    • "token_endpoint": "string",
    • "jwks_uri": "string",
    • "userinfo_endpoint": "string",
    • "id_token_signing_alg_values_supported": "string",
    • "response_types_supported": "string",
    • "subject_types_supported": "string",
    • "scopes_supported": "string",
    • "claims_supported": "string",
    • "token_endpoint_auth_methods_supported": "string"
    }

    OpenID Connect mock login page

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    scope
    required
    string

    The OpenID Connect authentication scope.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "issuer": "string",
    • "authorization_endpoint": "string",
    • "token_endpoint": "string",
    • "jwks_uri": "string",
    • "userinfo_endpoint": "string",
    • "id_token_signing_alg_values_supported": "string",
    • "response_types_supported": "string",
    • "subject_types_supported": "string",
    • "scopes_supported": "string",
    • "claims_supported": "string",
    • "token_endpoint_auth_methods_supported": "string"
    }

    OpenID Connect mock login page

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    scope
    required
    string

    The OpenID Connect authentication scope.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    OpenID Connect mock login page

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    scope
    required
    string

    The OpenID Connect authentication scope.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    An error occurred.

    +

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    OpenID Connect mock login page

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    scope
    required
    string

    The OpenID Connect authentication scope.

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    OpenID Connect mock token

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    Request Body schema: application/json
    grant_type
    required
    string

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

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    An error occurred.

    +

    Response samples

    Content type
    application/json
    {
    • "error": "string",
    • "reason": "string"
    }

    OpenID Connect mock token

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    Request Body schema: application/json
    grant_type
    required
    string

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

    code
    string

    grant_type=authorization_code only: The OpenID Connect authentication token.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    grant_type=authorization_code only: The OpenID Connect authentication token.

    refresh_token
    string

    grant_type=refresh_token only: The OpenID Connect refresh token.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    grant_type=refresh_token only: The OpenID Connect refresh token.

    Responses

    Request samples

    Content type
    application/json
    {
    • "grant_type": "string",
    • "code": "string",
    • "refresh_token": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "access_token": "string",
    • "token_type": "string",
    • "refresh_token": "string",
    • "expires_in": "string",
    • "id_token": "string"
    }

    OpenID Connect public certificates for signing keys

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "grant_type": "string",
    • "code": "string",
    • "refresh_token": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "access_token": "string",
    • "token_type": "string",
    • "refresh_token": "string",
    • "expires_in": "string",
    • "id_token": "string"
    }

    OpenID Connect public certificates for signing keys

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    Responses

    Response samples

    Content type
    application/json
    {
    • "keys": [
      ]
    }

    OpenID Connect mock login page handler

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    redirect_uri
    string

    The Sync Gateway OpenID Connect callback URL.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    An error occurred while getting the private RSA key

    +

    Response samples

    Content type
    application/json
    {
    • "keys": [
      ]
    }

    OpenID Connect mock login page handler

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    redirect_uri
    string

    The Sync Gateway OpenID Connect callback URL.

    scope
    required
    string

    The OpenID Connect authentication scope.

    -
    username
    required
    string
    tokenttl
    required
    integer
    identity-token-formats
    required
    string
    authenticated
    required
    string

    Responses

    username
    required
    string
    tokenttl
    required
    integer
    identity-token-formats
    required
    string
    authenticated
    required
    string

    Responses

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    OpenID Connect mock login page handler

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

    -
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    -
    query Parameters
    redirect_uri
    string

    The Sync Gateway OpenID Connect callback URL.

    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Resource could not be found

    +

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }

    OpenID Connect mock login page handler

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

    +
    path Parameters
    db
    required
    string
    Example: db1

    The name of the database to run the operation against.

    +
    query Parameters
    redirect_uri
    string

    The Sync Gateway OpenID Connect callback URL.

    scope
    required
    string

    The OpenID Connect authentication scope.

    +" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr">

    The OpenID Connect authentication scope.

    Request Body schema: application/json

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

    -
    username
    required
    string
    tokenttl
    required
    string
    identity-token-formats
    required
    string
    authenticated
    required
    string

    Responses

    Request samples

    Content type
    application/json
    {
    • "username": "string",
    • "tokenttl": "string",
    • "identity-token-formats": "string",
    • "authenticated": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }
    +" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

    Resource could not be found

    +

    Request samples

    Content type
    application/json
    {
    • "username": "string",
    • "tokenttl": "string",
    • "identity-token-formats": "string",
    • "authenticated": "string"
    }

    Response samples

    Content type
    application/json
    {
    • "error": "not_found",
    • "reason": "no such database \"invalid-db\""
    }