> 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/site-redirects.md).

# Site redirects

Keep your site's content fresh without breaking old links. This API allows you to create and manage redirection rules.

## The SiteRedirect object

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"components":{"schemas":{"SiteRedirect":{"type":"object","properties":{"object":{"type":"string","enum":["site-redirect"]},"id":{"type":"string","description":"The unique identifier for the redirect."},"source":{"$ref":"#/components/schemas/SiteRedirectSourcePath"},"draft":{"type":"boolean","description":"Whether the redirect is draft and not live."},"captureWildcard":{"type":"boolean","description":"Capture and append the wildcard-matched suffix to the destination URL."},"destination":{"$ref":"#/components/schemas/SiteRedirectDestination"}},"required":["object","id","source","draft","captureWildcard","destination"]},"SiteRedirectSourcePath":{"type":"string","description":"The source path to redirect from.","maxLength":512,"pattern":"^\\/(?!\\*)(?!.*\\*.+)(?:[A-Za-z0-9\\-._~+]|%[0-9A-Fa-f]{2})+(?:\\/(?:[A-Za-z0-9\\-._~+]|%[0-9A-Fa-f]{2})+)*(?:\\/\\*|\\*)?$"},"SiteRedirectDestination":{"oneOf":[{"$ref":"#/components/schemas/SiteRedirectDestinationSiteSection"},{"$ref":"#/components/schemas/SiteRedirectDestinationSiteSpace"},{"$ref":"#/components/schemas/SiteRedirectDestinationPage"},{"$ref":"#/components/schemas/SiteRedirectDestinationExternal"}]},"SiteRedirectDestinationSiteSection":{"type":"object","properties":{"kind":{"type":"string","enum":["site-section"]},"siteSectionId":{"type":"string","description":"Unique identifier for the site section to redirect to"}},"required":["kind","siteSectionId"]},"SiteRedirectDestinationSiteSpace":{"type":"object","properties":{"kind":{"type":"string","enum":["site-space"]},"siteSpaceId":{"type":"string","description":"Unique identifier for the site space to redirect to"}},"required":["kind","siteSpaceId"]},"SiteRedirectDestinationPage":{"type":"object","properties":{"kind":{"type":"string","enum":["site-page"]},"siteSpaceId":{"type":"string","description":"Unique identifier for the site space of the page"},"pageId":{"type":"string","description":"Unique identifier for the page within the site space to redirect to"}},"required":["kind","siteSpaceId","pageId"]},"SiteRedirectDestinationExternal":{"type":"object","properties":{"kind":{"type":"string","enum":["external"]},"url":{"$ref":"#/components/schemas/URL"}},"required":["kind","url"]},"URL":{"type":"string","format":"uri","maxLength":2048}}}}
```


---

# 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/site-redirects.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.
