> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/developers/gitbook-api/api-reference/docs-sites/full-text-search-across-all-content-in-a-site.md).

# Full-text search across all content in a site

Performs a full-text search across all published spaces in the site and returns matching pages with relevant excerpts. Use the scope parameter to restrict the search to specific site spaces or sections. Prefer this over the space-level search when you need to search across a multi-section site in one call.

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"sites","description":"The Docs Sites API lets you programmatically manage published documentation sites within your organization. You can list and update all sites created under a specific organization, making it easy to audit or interact with site metadata at scale.\n\n{% openapi-schemas spec=\"gitbook\" schemas=\"Site\" grouped=\"false\" %}\n    The Site object\n{% endopenapi-schemas %}\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]},{"oauth":["site:search"]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"},"oauth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://oauth.gitbook.com/authorize","tokenUrl":"https://oauth.gitbook.com/token","scopes":{"user:read":"Read your GitBook user profile.","organization:read":"Read organization settings and metadata.","organization:write":"Create and update organization settings.","organization:members:read":"Read organization members, invites and link invites.","organization:members:write":"Manage organization members, invites and link invites.","organization:ask":"Ask AI questions across an organization's content.","organization:search":"Search across an organization's content.","space:read":"Read spaces and their content.","space:write":"Create, update and delete spaces and their content, including imports.","space:permissions:read":"Read space permissions.","space:permissions:write":"Manage space permissions.","change-request:merge":"Merge change requests, publishing their changes to the space.","site:read":"Read sites and their settings.","site:write":"Create, update and delete sites, sections and their settings.","site:publish":"Publish and unpublish sites, controlling their public exposure.","site:permissions:read":"Read site permissions.","site:permissions:write":"Manage site permissions.","site:auth:read":"Read site authentication and security configuration.","site:auth:write":"Manage site authentication and security configuration.","site:insights:read":"Read site analytics and insights.","site:ask":"Ask AI questions across a site's content.","site:search":"Search across a site's content.","openapi:read":"Read OpenAPI specifications.","openapi:write":"Create, update and delete OpenAPI specifications."}}}}},"parameters":{"organizationId":{"name":"organizationId","in":"path","required":true,"description":"The unique id of the organization","schema":{"$ref":"#/components/schemas/EntityId"}},"siteId":{"name":"siteId","in":"path","required":true,"description":"The unique id of the site","schema":{"type":"string"}},"listPage":{"name":"page","in":"query","description":"Identifier of the page results to fetch.","schema":{"type":"string"}},"listLimit":{"name":"limit","in":"query","description":"The number of results per page","schema":{"type":"number","minimum":0,"maximum":1000}}},"schemas":{"EntityId":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"A unique entity identifier"},"SiteSearchScope":{"oneOf":[{"type":"object","required":["mode"],"properties":{"mode":{"description":"Search across all sections of a site, only including the default content of each section. This scope is wide and shallow. You may optionally specify a list of additional site spaces to search in alongside the default content.\n","type":"string","enum":["default"]},"currentSiteSpace":{"type":"string","description":"The ID of the site space that must always be included in the search results. The language of this site space will be used to match other site spaces with the same language, if applicable.\n"},"restrictTo":{"description":"Must not be provided when searching the entire default scope. To restrict the search to a subset of the default scope, provide `restrictTo` along with `currentSiteSpace`.\n","type":"string","minLength":2,"maxLength":1}}},{"type":"object","required":["mode","currentSiteSpace","restrictTo"],"properties":{"mode":{"description":"Search a subset of the default scope of the site, relative to the current site space.\n","type":"string","enum":["default"]},"currentSiteSpace":{"type":"string","description":"The ID of the site space the search is made from. The language of this site space will be used to match other site spaces with the same language, if applicable.\n"},"restrictTo":{"type":"string","enum":["currentSiteSpace","otherSiteSpaces"],"description":"Restrict the search to a subset of the default scope. With `currentSiteSpace`, only the current site space is searched. With `otherSiteSpaces`, the current site space is excluded and only the other site spaces in the default scope are searched.\n"}}},{"type":"object","required":["mode","siteSpaceIds"],"properties":{"mode":{"description":"Only search in the provided site spaces.","type":"string","enum":["specific"]},"siteSpaceIds":{"type":"array","minLength":1,"items":{"type":"string"}}}},{"type":"object","required":["mode"],"properties":{"mode":{"description":"Search in all sections and site spaces. This scope is wide and deep.","type":"string","enum":["all"]}}}]},"List":{"type":"object","properties":{"next":{"type":"object","properties":{"page":{"type":"string","description":"Unique identifier to query the next results page"}},"required":["page"]},"count":{"type":"number","description":"Total count of objects in the list"}}},"SearchSpaceResult":{"type":"object","description":"Search result representing a space.","properties":{"type":{"type":"string","enum":["space"]},"id":{"type":"string"},"title":{"type":"string"},"score":{"$ref":"#/components/schemas/SearchResultScore"},"pages":{"type":"array","items":{"$ref":"#/components/schemas/SearchPageResult"}}},"required":["type","id","title","score","pages"]},"SearchResultScore":{"type":"number","minimum":0,"description":"Relevance score for a search result. Higher is better and the score is unbounded."},"SearchPageResult":{"type":"object","description":"Search result representing a page in a space.","properties":{"id":{"type":"string"},"title":{"type":"string"},"path":{"type":"string"},"score":{"$ref":"#/components/schemas/SearchResultScore"},"sections":{"type":"array","items":{"$ref":"#/components/schemas/SearchSectionResult"}},"ancestors":{"type":"array","description":"Data about the ancestors of the current page, from top-level to direct parent.","items":{"type":"object","properties":{"title":{"type":"string"}},"required":["title"]}},"urls":{"type":"object","description":"URLs associated with the object","properties":{"app":{"type":"string","description":"URL of the page in the application","format":"uri"}},"required":["app"]}},"required":["id","title","path","score","ancestors","urls"]},"SearchSectionResult":{"type":"object","description":"Search result representing a section in a page.","properties":{"id":{"type":"string"},"title":{"type":"string"},"path":{"type":"string"},"score":{"$ref":"#/components/schemas/SearchResultScore"},"body":{"type":"string"},"urls":{"type":"object","description":"URLs associated with the object","properties":{"app":{"type":"string","description":"URL of the section in the application","format":"uri"}},"required":["app"]}},"required":["id","title","path","score","body","urls"]},"SearchRecordResult":{"type":"object","description":"Search result representing a site context record.","properties":{"type":{"type":"string","enum":["record"]},"id":{"type":"string","description":"The ID of the context record."},"title":{"type":"string","description":"The title of the record."},"score":{"$ref":"#/components/schemas/SearchResultScore"},"description":{"type":"string","description":"The description of the record."},"url":{"type":"string","format":"uri","description":"URL of the record in the source system."}},"required":["type","id","title","score","url"]}}},"paths":{"/orgs/{organizationId}/sites/{siteId}/search":{"post":{"operationId":"searchSiteContent","summary":"Full-text search across all content in a site","description":"Performs a full-text search across all published spaces in the site and returns matching pages with relevant excerpts. Use the scope parameter to restrict the search to specific site spaces or sections. Prefer this over the space-level search when you need to search across a multi-section site in one call.","tags":["sites"],"parameters":[{"$ref":"#/components/parameters/organizationId"},{"$ref":"#/components/parameters/siteId"},{"$ref":"#/components/parameters/listPage"},{"$ref":"#/components/parameters/listLimit"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"type":"object","required":["query"],"properties":{"query":{"type":"string","maxLength":512}}},{"oneOf":[{"type":"object","required":["scope"],"properties":{"scope":{"description":"Define the scope of the search.","$ref":"#/components/schemas/SiteSearchScope"}}},{"type":"object","properties":{"mode":{"description":"Search only in the site spaces provided. Deprecated, use scope instead.","deprecated":true,"type":"string","enum":["specific"]},"siteSpaceIds":{"type":"array","minLength":1,"items":{"type":"string"}}},"required":["siteSpaceIds"]},{"type":"object","properties":{"mode":{"description":"Search in the current site space and all section's defaults. Deprecated, use scope instead.","deprecated":true,"type":"string","enum":["current"]},"siteSpaceId":{"type":"string"}},"required":["mode","siteSpaceId"]},{"type":"object","properties":{"mode":{"description":"Search in all site-spaces. Deprecated, use scope instead.","deprecated":true,"type":"string","enum":["all"]}},"required":["mode"]}]}]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/List"},{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/SearchSpaceResult"},{"$ref":"#/components/schemas/SearchRecordResult"}],"discriminator":{"propertyName":"type"}}}}}]}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gitbook.com/docs/developers/gitbook-api/api-reference/docs-sites/full-text-search-across-all-content-in-a-site.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
