> 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/resolve-a-site-redirect-rule-by-its-source-path.md).

# Resolve a site redirect rule by its source path

Looks up a redirect rule by its source URL path and returns both the redirect configuration and the resolved destination URL. Use this to check whether a specific path has a redirect configured, or to resolve where a path currently points before updating or removing the redirect.

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"site-redirects","description":"Keep your site's content fresh without breaking old links. This API allows you to create and manage redirection rules.\n\n{% openapi-schemas spec=\"gitbook\" schemas=\"SiteRedirect\" grouped=\"false\" %}\n    The SiteRedirect object\n{% endopenapi-schemas %}\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]},{"oauth":["site:read"]}],"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"}},"siteShareKey":{"name":"shareKey","in":"query","description":"For sites published via share-links, the share key is useful to resolve published URLs.","schema":{"type":"string"}}},"schemas":{"EntityId":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"A unique entity identifier"},"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})+)*(?:\\/\\*|\\*)?$"},"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"]},"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}},"responses":{"NotFoundError":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[404]},"message":{"type":"string"}},"required":["code","message"]}}}}}}}},"paths":{"/orgs/{organizationId}/sites/{siteId}/redirect":{"get":{"operationId":"getSiteRedirectBySource","summary":"Resolve a site redirect rule by its source path","description":"Looks up a redirect rule by its source URL path and returns both the redirect configuration and the resolved destination URL. Use this to check whether a specific path has a redirect configured, or to resolve where a path currently points before updating or removing the redirect.","tags":["site-redirects"],"parameters":[{"$ref":"#/components/parameters/organizationId"},{"$ref":"#/components/parameters/siteId"},{"$ref":"#/components/parameters/siteShareKey"},{"name":"source","in":"query","required":true,"description":"The source path of the redirect.","schema":{"$ref":"#/components/schemas/SiteRedirectSourcePath"}}],"responses":{"200":{"description":"The redirect was resolved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"redirect":{"$ref":"#/components/schemas/SiteRedirect"},"target":{"type":"string","description":"URL of the destination of the redirect."}},"required":["redirect","target"]}}}},"404":{"$ref":"#/components/responses/NotFoundError"}}}}}}
```


---

# 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/resolve-a-site-redirect-rule-by-its-source-path.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.
