> 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-auth/update-the-published-content-authentication-configuration-for-a-site.md).

# Update the published content authentication configuration for a site

Modifies the authentication method used to protect a site's published content. Use this to enable, disable, or change the auth method for a published site.

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"site-publishing-auth","description":"Configure the credentials or tokens required to publish documentation externally. This helps ensure your site is consistently kept up to date.\n\n{% openapi-schemas spec=\"gitbook\" schemas=\"SitePublishingAuth\" grouped=\"false\" %}\n    The SitePublishingAuth object\n{% endopenapi-schemas %}\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]},{"oauth":["site:auth: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"},"SitePublishingAuthUpdate":{"allOf":[{"oneOf":[{"$ref":"#/components/schemas/VisitorAuthCustomBackend"},{"$ref":"#/components/schemas/VisitorAuthIntegrationBackend"}]},{"type":"object","properties":{"fallbackURL":{"type":["string","null"],"format":"uri","description":"A fallback URL that will be used if authentication fails. If not provided, the fallback URL will not be changed. If set to null, the fallback URL will be unset."},"logoutURL":{"type":["string","null"],"format":"uri","description":"A logout URL used to log visitors out from the upstream custom auth backend. If not provided, the logout URL will not be changed. If set to null, the logout URL will be unset."}}}]},"VisitorAuthCustomBackend":{"type":"object","title":"Custom backend for authenticated access","properties":{"backend":{"type":"string","description":"Custom backend for authenticated access","enum":["custom"]}},"required":["backend"]},"VisitorAuthIntegrationBackend":{"type":"object","title":"Integration backend for authenticated access","properties":{"backend":{"type":"string","description":"Integration as backend for authenticated access","enum":["integration"]}},"required":["backend"]},"SitePublishingAuth":{"allOf":[{"oneOf":[{"$ref":"#/components/schemas/VisitorAuthCustomBackend"},{"$ref":"#/components/schemas/VisitorAuthIntegrationBackend"}]},{"type":"object","properties":{"object":{"type":"string","description":"Type of Object, always equals to \"publishing-auth\"","enum":["publishing-auth"]},"privateKey":{"type":"string","description":"Private key used to sign JWT tokens."},"fallbackURL":{"type":"string","format":"uri","description":"URL to redirect to when the authenticated access secret is invalid."},"logoutURL":{"type":"string","format":"uri","description":"URL used to log visitors out from the upstream custom auth backend."},"integration":{"type":"string","description":"Name of the authenticated access integration installed on the site (if any).\nIt is also the one being used as VA backend when the published auth settings are configured to use \"integration\" as backend.\n"}},"required":["object","privateKey"]}]}},"responses":{"BadRequestError":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[400]},"message":{"type":"string"}},"required":["code","message"]}}}}}}}},"paths":{"/orgs/{organizationId}/sites/{siteId}/publishing/auth":{"patch":{"operationId":"updateSitePublishingAuthById","summary":"Update the published content authentication configuration for a site","description":"Modifies the authentication method used to protect a site's published content. Use this to enable, disable, or change the auth method for a published site.","tags":["site-publishing-auth"],"parameters":[{"$ref":"#/components/parameters/organizationId"},{"$ref":"#/components/parameters/siteId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SitePublishingAuthUpdate"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SitePublishingAuth"}}}},"400":{"$ref":"#/components/responses/BadRequestError"}}}}}}
```


---

# 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-auth/update-the-published-content-authentication-configuration-for-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.
