For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

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.

Available in MCP
get
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
organizationIdstringRequired

A unique entity identifier

Pattern: ^[a-zA-Z0-9_-]+$
siteIdstringRequired

The unique id of the site

Query parameters
shareKeystringOptional

For sites published via share-links, the share key is useful to resolve published URLs.

sourcestring · max: 512Required

The source path to redirect from.

Pattern: ^\/(?!\*)(?!.*\*.+)(?:[A-Za-z0-9\-._~+]|%[0-9A-Fa-f]{2})+(?:\/(?:[A-Za-z0-9\-._~+]|%[0-9A-Fa-f]{2})+)*(?:\/\*|\*)?$
Responses
200

The redirect was resolved successfully.

application/json
targetstringRequired

URL of the destination of the redirect.

get/orgs/{organizationId}/sites/{siteId}/redirect
GET /v1/orgs/{organizationId}/sites/{siteId}/redirect?source=text HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "redirect": {
    "object": "site-redirect",
    "id": "text",
    "source": "text",
    "draft": true,
    "captureWildcard": true,
    "permanent": true,
    "destination": {
      "kind": "site-section",
      "siteSectionId": "text"
    },
    "createdAt": "2026-01-01T00:00:00.000Z",
    "updatedAt": "2026-01-01T00:00:00.000Z"
  },
  "target": "text"
}

Last updated

Was this helpful?