> 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/create-update-delete-or-publish-site-redirect-rules-in-bulk.md).

# Create, update, delete, or publish site redirect rules in bulk

Processes up to 500 redirect operations in a single request. Each redirect in the array is processed independently and the response includes per-item status. Prefer this over individual create/update calls when managing large sets of redirects.

```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:write"]}],"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"}}},"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})+)*(?:\\/\\*|\\*)?$"},"SiteRedirectInputDestination":{"oneOf":[{"$ref":"#/components/schemas/SiteRedirectDestination"},{"$ref":"#/components/schemas/SiteRedirectInputDestinationPath"}]},"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},"SiteRedirectInputDestinationPath":{"type":"object","properties":{"kind":{"type":"string","enum":["path"]},"spaceId":{"type":"string","description":"Unique identifier for the space containing the page referenced by the path."},"path":{"type":"string","description":"Path to the page within the space revision to resolve."}},"required":["kind","spaceId","path"]}}},"paths":{"/orgs/{organizationId}/sites/{siteId}/redirects":{"put":{"operationId":"bulkUpsertSiteRedirects","summary":"Create, update, delete, or publish site redirect rules in bulk","description":"Processes up to 500 redirect operations in a single request. Each redirect in the array is processed independently and the response includes per-item status. Prefer this over individual create/update calls when managing large sets of redirects.","tags":["site-redirects"],"parameters":[{"$ref":"#/components/parameters/organizationId"},{"$ref":"#/components/parameters/siteId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"redirects":{"type":"array","minItems":1,"maxItems":500,"items":{"oneOf":[{"type":"object","properties":{"source":{"$ref":"#/components/schemas/SiteRedirectSourcePath"},"intent":{"type":"string","enum":["publish"],"description":"Publish a draft redirect to live and remove the draft redirect.\n"}},"required":["source","intent"]},{"type":"object","properties":{"source":{"$ref":"#/components/schemas/SiteRedirectSourcePath"},"intent":{"type":"string","enum":["live","draft"],"default":"live","description":"Redirect operation intent.\n- live: upsert/delete a live redirect (draft=false)\n- draft: upsert/delete a draft redirect (draft=true)\n"},"captureWildcard":{"type":"boolean","default":false,"description":"Capture and append the wildcard-matched suffix to the destination URL."},"destination":{"description":"If set to null, the redirect matching the source+intent target will be deleted.","oneOf":[{"$ref":"#/components/schemas/SiteRedirectInputDestination"},{"type":"null"}]}},"required":["source","destination"]}]}}},"required":["redirects"]}}}},"responses":{"200":{"description":"List of results for each redirect processed.","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["created"],"description":"The redirect was created."},"source":{"$ref":"#/components/schemas/SiteRedirectSourcePath"},"draft":{"type":"boolean","description":"Whether the redirect is draft and not live."},"id":{"type":"string","description":"The ID of the created redirect."}},"required":["status","source","draft","id"]},{"type":"object","properties":{"status":{"type":"string","enum":["updated"],"description":"The redirect was updated."},"source":{"$ref":"#/components/schemas/SiteRedirectSourcePath"},"draft":{"type":"boolean","description":"Whether the redirect is draft and not live."},"id":{"type":"string","description":"The ID of the updated redirect."}},"required":["status","source","draft","id"]},{"type":"object","properties":{"status":{"type":"string","enum":["deleted"],"description":"The redirect was deleted."},"source":{"$ref":"#/components/schemas/SiteRedirectSourcePath"},"draft":{"type":"boolean","description":"Whether the deleted redirect was draft."}},"required":["status","source","draft"]},{"type":"object","properties":{"status":{"type":"string","enum":["published"],"description":"The draft redirect was published to live and removed from draft."},"source":{"$ref":"#/components/schemas/SiteRedirectSourcePath"},"draft":{"type":"boolean","description":"Always false for published redirects."},"id":{"type":"string","description":"The ID of the resulting live redirect."}},"required":["status","source","draft","id"]},{"type":"object","properties":{"status":{"type":"string","enum":["error"],"description":"There was an error processing the redirect."},"source":{"$ref":"#/components/schemas/SiteRedirectSourcePath"},"draft":{"type":"boolean","description":"Whether the redirect is draft and not live."},"error":{"type":"string","description":"The error message."}},"required":["status","source","draft","error"]}]}}},"required":["results"]}}}}}}}}}
```


---

# 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/create-update-delete-or-publish-site-redirect-rules-in-bulk.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.
