@gitbook/api 0.207.0 → 0.208.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/spec/openapi.yaml CHANGED
@@ -2489,6 +2489,7 @@ paths:
2489
2489
  **Moving a page** — `update_page` can also change a page's parent and/or its position among siblings with `into`/`at`. Set `into` to the new parent's page ID, or `null` to move the page to the root of the tree; omit `into` to leave the parent unchanged. Set `at` to place the page at a specific zero-based index among its new siblings; omit it to leave the position unchanged (when the parent isn't changing) or append at the end (when it is). A page cannot be moved under itself or one of its own descendants. `insert_page`'s `into`/`at` remain the way to place a **new** page at creation time.
2490
2490
  To put an image or attachment in a page, upload it with an `insert_files` change. Give the file a `ref` and a page inserted in the same batch can reference it as `![Alt](./<ref>)` or `[File](./<ref>)`, which resolves to the file's ID at apply time regardless of operation order. Uploaded files are also listed as `insertedFiles` when `compat=false`, and a file already in the change request can be referenced directly as `/files/<fileId>`. Inline `data:` URIs in markdown are not ingested and large image blocks are dropped, so upload the bytes with `insert_files` instead.
2491
2491
  **Reusable content** (snippets shared by several pages, Git Sync's `.gitbook/includes/`) is created with `insert_reusable_contents`, changed with `update_reusable_content` and removed with `delete_reusable_content`. A page includes one in markdown as `{% include "/reusable-content/<reusableContentId>" %}`; give a new one a `ref` and a page in the same batch can include it as `{% include "./<ref>" %}`, regardless of operation order. Created reusable contents are listed as `insertedReusableContents` when `compat=false`. An update keeps the ID, so every page including it shows the change. Deleting one leaves the includes in pages unresolved, as in the editor: remove them from those pages too. Reusable content cannot include other reusable content, so an include in its document is dropped. Unlike a link, an include that matches no reusable content of the change request (or of the batch) rejects the batch, since dropping it would remove it from the page silently.
2492
+ **Variables** (space variables, Git Sync's `.gitbook/vars.yaml`) are created with `insert_variables` and changed with `update_variable`. A variable is identified by its name, which content references as an expression: `<code class="expression">space.vars.<name></code>` in markdown. Inserting a name the change request already uses, or updating one it does not, rejects the batch.
2492
2493
  **Publishing an OpenAPI spec** — an OpenAPI spec belongs to the organization (see `createOpenAPISpec`) and appears in a space only through a page that renders it. Insert that page with an `insert_computed_page` change: `{ "operation": "insert_computed_page", "title": "API reference", "computed": { "type": "builtin:openapi", "props": { "models": true }, "dependencies": { "spec": { "ref": { "kind": "openapi", "spec": "<spec slug>" } } } } }`. GitBook replaces that page, at its position, with the API reference: one page per tag (or per operation with `"grouping": "by-operation"` in `props`), plus a models page when `models` is true, regenerated whenever the spec changes. Use `into` to nest the reference under an existing page. Do not recreate a spec with `insert_page`: `openapi-operation` blocks in a document only render the operations they name.
2493
2494
  When page content is provided as markdown, links to other pages are resolved against the change request's current page tree. You can link a page by:
2494
2495
  - Page ID — `/pages/<pageId>` (also `/pages/<pageId>#anchor`).
@@ -5096,6 +5097,27 @@ paths:
5096
5097
  description: Filter by an exact stable target identifier.
5097
5098
  schema:
5098
5099
  type: string
5100
+ - name: includeFacets
5101
+ in: query
5102
+ description: Include matching counts for action and actor options, excluding the option's own filter.
5103
+ schema:
5104
+ type: boolean
5105
+ - name: actions
5106
+ in: query
5107
+ description: Include any of these action names. Combined with other filters using AND.
5108
+ schema:
5109
+ type: array
5110
+ maxItems: 100
5111
+ items:
5112
+ type: string
5113
+ - name: actors
5114
+ in: query
5115
+ description: Include any of these stable actor identifiers, including system actors. Combined with other filters using AND.
5116
+ schema:
5117
+ type: array
5118
+ maxItems: 100
5119
+ items:
5120
+ type: string
5099
5121
  responses:
5100
5122
  "200":
5101
5123
  description: Paginated audit events.
@@ -5106,6 +5128,20 @@ paths:
5106
5128
  - $ref: "#/components/schemas/List"
5107
5129
  - type: object
5108
5130
  properties:
5131
+ facets:
5132
+ type: object
5133
+ required:
5134
+ - actions
5135
+ - actors
5136
+ properties:
5137
+ actions:
5138
+ type: object
5139
+ additionalProperties:
5140
+ type: integer
5141
+ actors:
5142
+ type: object
5143
+ additionalProperties:
5144
+ type: integer
5109
5145
  items:
5110
5146
  type: array
5111
5147
  items:
@@ -5202,6 +5238,7 @@ paths:
5202
5238
  operationId: listMembersInOrganizationById
5203
5239
  x-gitbook-mcp: true
5204
5240
  summary: List all organization members
5241
+ description: Lists the members of the organization. Guests can list members too, but the list they get leaves out every guest, themselves included, and filtering by the `guest` role returns no one.
5205
5242
  tags:
5206
5243
  - organization-members
5207
5244
  security:
@@ -5237,6 +5274,7 @@ paths:
5237
5274
  operationId: getMemberInOrganizationById
5238
5275
  x-gitbook-mcp: true
5239
5276
  summary: Get an organization member by its ID
5277
+ description: Returns a member of the organization. Guests can get any member who isn't a guest, and themselves. Another guest is reported as not found.
5240
5278
  tags:
5241
5279
  - organization-members
5242
5280
  - critical
@@ -10425,7 +10463,7 @@ paths:
10425
10463
  post:
10426
10464
  operationId: applySiteFindingAction
10427
10465
  summary: Apply an action to a finding
10428
- description: "Applies one of the `actions` a finding lists, with the site permission it gives: resolve, dismiss or reopen it, or act on a broken link's redirect. Returns 409 when the finding doesn't allow the action now."
10466
+ description: "Applies one of the `actions` a finding lists, with the site permission it gives: resolve, dismiss or reopen it, act on a broken link's redirect, or reject the change request GitBook drafted for an outbound link. Returns 409 when the finding doesn't allow the action now."
10429
10467
  x-gitbook-mcp:
10430
10468
  destructive: true
10431
10469
  tags:
@@ -11136,6 +11174,75 @@ paths:
11136
11174
  application/json:
11137
11175
  schema:
11138
11176
  $ref: "#/components/schemas/SiteQuestionStats"
11177
+ /orgs/{organizationId}/sites/{siteId}/question-timeline:
11178
+ get:
11179
+ operationId: getSiteQuestionTimeline
11180
+ summary: Get Ask AI answers over time for a site
11181
+ description: Returns how many answers the site's Ask AI assistant gave, and to how many visitors, in each UTC bucket of the interval between `from` and `to`, optionally filtered by topic, relevance, channel, visitor type or resolution. Buckets without answers are omitted.
11182
+ x-gitbook-mcp: true
11183
+ tags:
11184
+ - site-questions
11185
+ security:
11186
+ - user: []
11187
+ - oauth:
11188
+ - site:insights:read
11189
+ parameters:
11190
+ - $ref: "#/components/parameters/organizationId"
11191
+ - $ref: "#/components/parameters/siteId"
11192
+ - name: from
11193
+ in: query
11194
+ required: true
11195
+ description: Count answers created at or after this timestamp.
11196
+ schema:
11197
+ $ref: "#/components/schemas/Timestamp"
11198
+ - name: to
11199
+ in: query
11200
+ required: true
11201
+ description: Count answers created at or before this timestamp.
11202
+ schema:
11203
+ $ref: "#/components/schemas/Timestamp"
11204
+ - name: interval
11205
+ in: query
11206
+ required: true
11207
+ description: Size of each bucket. An hourly timeline covers at most 31 days.
11208
+ schema:
11209
+ $ref: "#/components/schemas/SiteQuestionTimelineInterval"
11210
+ - name: topic
11211
+ in: query
11212
+ description: Filter answers by associated site topic IDs.
11213
+ schema:
11214
+ type: array
11215
+ items:
11216
+ type: string
11217
+ - name: relevance
11218
+ in: query
11219
+ description: Filter answers by question relevance.
11220
+ schema:
11221
+ type: array
11222
+ items:
11223
+ $ref: "#/components/schemas/SiteQuestionAnswerRelevance"
11224
+ - name: channelType
11225
+ in: query
11226
+ description: Filter answers by channel type.
11227
+ schema:
11228
+ type: array
11229
+ items:
11230
+ $ref: "#/components/schemas/SiteChannelType"
11231
+ - $ref: "#/components/parameters/siteQuestionVisitorType"
11232
+ - name: answered
11233
+ in: query
11234
+ description: Filter answers by resolution.
11235
+ schema:
11236
+ type: array
11237
+ items:
11238
+ $ref: "#/components/schemas/SiteQuestionAnswerResolution"
11239
+ responses:
11240
+ "200":
11241
+ description: OK
11242
+ content:
11243
+ application/json:
11244
+ schema:
11245
+ $ref: "#/components/schemas/SiteQuestionTimeline"
11139
11246
  /orgs/{organizationId}/sites/{siteId}/answers:
11140
11247
  get:
11141
11248
  operationId: listSiteQuestionAnswers
@@ -11502,6 +11609,11 @@ paths:
11502
11609
  oneOf:
11503
11610
  - $ref: "#/components/schemas/CustomizationThemedColor"
11504
11611
  - type: "null"
11612
+ secondaryColor:
11613
+ description: The secondary brand color used for secondary buttons and content colored with `$secondary`. Set to null to reset the override.
11614
+ oneOf:
11615
+ - $ref: "#/components/schemas/CustomizationThemedColor"
11616
+ - type: "null"
11505
11617
  infoColor:
11506
11618
  description: Used for informational messages and neutral alerts. Set to null to reset the override.
11507
11619
  oneOf:
@@ -16072,6 +16184,7 @@ components:
16072
16184
  - violet
16073
16185
  - cyan
16074
16186
  - $primary
16187
+ - $secondary
16075
16188
  - $info
16076
16189
  - $success
16077
16190
  - $warning
@@ -19414,7 +19527,7 @@ components:
19414
19527
  required:
19415
19528
  - yPos
19416
19529
  VariableValue:
19417
- oneOf:
19530
+ anyOf:
19418
19531
  - type: string
19419
19532
  maxLength: 256
19420
19533
  - type: number
@@ -21028,6 +21141,66 @@ components:
21028
21141
  example:
21029
21142
  operation: delete_reusable_content
21030
21143
  reusableContent: reusable_content_id
21144
+ VariableName:
21145
+ type: string
21146
+ description: Name of a variable, referenced in content as `space.vars.<name>`. It starts with a letter, `_` or `$` and contains only letters, digits, `_` and `$`.
21147
+ minLength: 1
21148
+ maxLength: 64
21149
+ pattern: ^[a-zA-Z_$][a-zA-Z0-9_$]*$
21150
+ ChangeRequestContentChangeInsertVariables:
21151
+ type: object
21152
+ description: Create space variables in the change request (Git Sync's `.gitbook/vars.yaml`). Content references one as an expression, `<code class="expression">space.vars.<name></code>` in markdown, which renders the variable's value.
21153
+ required:
21154
+ - operation
21155
+ - variables
21156
+ properties:
21157
+ operation:
21158
+ type: string
21159
+ enum:
21160
+ - insert_variables
21161
+ variables:
21162
+ type: array
21163
+ minItems: 1
21164
+ maxItems: 50
21165
+ items:
21166
+ type: object
21167
+ description: A variable to create. Its name must not already be used by a space variable of the change request.
21168
+ required:
21169
+ - name
21170
+ - value
21171
+ properties:
21172
+ name:
21173
+ $ref: "#/components/schemas/VariableName"
21174
+ value:
21175
+ description: Value of the variable.
21176
+ $ref: "#/components/schemas/VariableValue"
21177
+ example:
21178
+ operation: insert_variables
21179
+ variables:
21180
+ - name: version
21181
+ value: "2.0"
21182
+ ChangeRequestContentChangeUpdateVariable:
21183
+ type: object
21184
+ description: Change the value of an existing space variable. Every expression referencing it shows the new value.
21185
+ required:
21186
+ - operation
21187
+ - variable
21188
+ - value
21189
+ properties:
21190
+ operation:
21191
+ type: string
21192
+ enum:
21193
+ - update_variable
21194
+ variable:
21195
+ description: Name of the variable to update.
21196
+ $ref: "#/components/schemas/VariableName"
21197
+ value:
21198
+ description: New value of the variable.
21199
+ $ref: "#/components/schemas/VariableValue"
21200
+ example:
21201
+ operation: update_variable
21202
+ variable: version
21203
+ value: "2.1"
21031
21204
  ChangeRequestContentChange:
21032
21205
  oneOf:
21033
21206
  - $ref: "#/components/schemas/ChangeRequestContentChangeUpdatePage"
@@ -21039,6 +21212,8 @@ components:
21039
21212
  - $ref: "#/components/schemas/ChangeRequestContentChangeInsertReusableContents"
21040
21213
  - $ref: "#/components/schemas/ChangeRequestContentChangeUpdateReusableContent"
21041
21214
  - $ref: "#/components/schemas/ChangeRequestContentChangeDeleteReusableContent"
21215
+ - $ref: "#/components/schemas/ChangeRequestContentChangeInsertVariables"
21216
+ - $ref: "#/components/schemas/ChangeRequestContentChangeUpdateVariable"
21042
21217
  discriminator:
21043
21218
  propertyName: operation
21044
21219
  mapping:
@@ -21051,6 +21226,8 @@ components:
21051
21226
  insert_reusable_contents: "#/components/schemas/ChangeRequestContentChangeInsertReusableContents"
21052
21227
  update_reusable_content: "#/components/schemas/ChangeRequestContentChangeUpdateReusableContent"
21053
21228
  delete_reusable_content: "#/components/schemas/ChangeRequestContentChangeDeleteReusableContent"
21229
+ insert_variables: "#/components/schemas/ChangeRequestContentChangeInsertVariables"
21230
+ update_variable: "#/components/schemas/ChangeRequestContentChangeUpdateVariable"
21054
21231
  ChangeRequestContentUpdatePageRef:
21055
21232
  type: object
21056
21233
  required:
@@ -29123,6 +29300,9 @@ components:
29123
29300
  $ref: "#/components/schemas/CustomizationTheme"
29124
29301
  primaryColor:
29125
29302
  $ref: "#/components/schemas/CustomizationThemedColor"
29303
+ secondaryColor:
29304
+ description: Secondary brand color, used for secondary buttons and for content colored with `$secondary`. When not set, these elements use the neutral colors of the site.
29305
+ $ref: "#/components/schemas/CustomizationThemedColor"
29126
29306
  tint:
29127
29307
  $ref: "#/components/schemas/CustomizationTint"
29128
29308
  infoColor:
@@ -30356,7 +30536,7 @@ components:
30356
30536
  description: |
30357
30537
  Where a link finding stands, from its status and what GitBook did with it.
30358
30538
  - `open` needs a fix.
30359
- - `awaiting-approval` has a redirect GitBook drafted at its path, waiting to be approved or rejected.
30539
+ - `awaiting-approval` has a fix GitBook drafted, waiting to be approved or rejected: a redirect at a `broken-link` finding's path, or an unmerged change request for an `outbound-link-error` finding (`awaitingChangeRequest`).
30360
30540
  - `resolved` was fixed or closed: `servingRedirect` says whether a live redirect serves its path.
30361
30541
  - `ignored` was dismissed.
30362
30542
  enum:
@@ -30407,12 +30587,30 @@ components:
30407
30587
  - redirect
30408
30588
  - wildcard
30409
30589
  - createdByAgent
30590
+ SiteFindingAwaitingChangeRequest:
30591
+ type: object
30592
+ title: Awaiting change request
30593
+ description: The change request GitBook drafted to fix an `outbound-link-error` finding, waiting to be approved or rejected. Approving it means merging it. Reject it with `applySiteFindingAction`.
30594
+ properties:
30595
+ space:
30596
+ type: string
30597
+ description: ID of the space the change request is in.
30598
+ changeRequest:
30599
+ type: string
30600
+ description: ID of the change request.
30601
+ findings:
30602
+ type: number
30603
+ description: Number of open outbound links on the site the change request fixes.
30604
+ required:
30605
+ - space
30606
+ - changeRequest
30607
+ - findings
30410
30608
  SiteFindingAction:
30411
30609
  type: string
30412
30610
  description: |
30413
30611
  An action that moves a finding to another state. A finding's `actions` lists the ones it allows.
30414
- - `approve` makes the redirect GitBook drafted for a broken link live, which resolves the finding.
30415
- - `reject` deletes the redirect GitBook drafted for a broken link; the finding stays open and GitBook won't draft a fix for it again.
30612
+ - `approve` makes the redirect GitBook drafted for a broken link live, which resolves the finding. A change request GitBook drafted for an outbound link is approved by merging it.
30613
+ - `reject` deletes the redirect GitBook drafted for a broken link; the finding stays open and GitBook won't draft a fix for it again. For an outbound link, it archives the change request GitBook drafted (`awaitingChangeRequest`) and unlinks every link it fixes. They are open again, marked `undone`, and GitBook won't draft a fix for them again.
30416
30614
  - `create-redirect` creates a redirect for a broken link's path with `createSiteRedirect`, prefilled with the suggestion; it resolves the finding.
30417
30615
  - `mark-resolved` resolves it. A broken link resolved this way has no redirect: visitors still get a 404.
30418
30616
  - `reopen` reopens a resolved finding. For a broken link, it deletes the live redirect at its path; for a fix GitBook applied, this undoes the fix and GitBook won't fix the link again.
@@ -30567,6 +30765,8 @@ components:
30567
30765
  $ref: "#/components/schemas/SiteFindingState"
30568
30766
  servingRedirect:
30569
30767
  $ref: "#/components/schemas/SiteFindingServingRedirect"
30768
+ awaitingChangeRequest:
30769
+ $ref: "#/components/schemas/SiteFindingAwaitingChangeRequest"
30570
30770
  actions:
30571
30771
  type: array
30572
30772
  description: Actions the finding allows now, applied with `applySiteFindingAction`.
@@ -31619,6 +31819,40 @@ components:
31619
31819
  - $ref: "#/components/schemas/SiteQuestionAnswerSourceRecord"
31620
31820
  discriminator:
31621
31821
  propertyName: type
31822
+ SiteQuestionTimelineInterval:
31823
+ type: string
31824
+ description: Size of a timeline bucket. Weeks start on Sunday, and every bucket is in UTC.
31825
+ enum:
31826
+ - hour
31827
+ - day
31828
+ - week
31829
+ - month
31830
+ SiteQuestionTimelineBucket:
31831
+ type: object
31832
+ properties:
31833
+ time:
31834
+ description: Start of the bucket.
31835
+ $ref: "#/components/schemas/Timestamp"
31836
+ answers:
31837
+ type: number
31838
+ description: Count of answers given during the bucket.
31839
+ visitors:
31840
+ type: number
31841
+ description: Count of distinct visitors who received those answers.
31842
+ required:
31843
+ - time
31844
+ - answers
31845
+ - visitors
31846
+ SiteQuestionTimeline:
31847
+ type: object
31848
+ description: Ask AI answers counted per bucket, oldest first.
31849
+ properties:
31850
+ items:
31851
+ type: array
31852
+ items:
31853
+ $ref: "#/components/schemas/SiteQuestionTimelineBucket"
31854
+ required:
31855
+ - items
31622
31856
  SiteQuestionAnswerHelpfulness:
31623
31857
  type: string
31624
31858
  description: Helpfulness of the response for the end user need.