# Site preview

Quickly generate a preview of how your site's content and layout will appear once published, allowing for final checks and refinement prior to going live.

## Get a site preview URL

> Generate a URL to preview the published content of a site. The URL will be valid for 1 hour.

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"site-preview","description":"Quickly generate a preview of how your site's content and layout will appear once published, allowing for final checks and refinement prior to going live.\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"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"},"URL":{"type":"string","format":"uri","maxLength":2048}},"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/preview":{"get":{"operationId":"getSitePublishingPreviewById","summary":"Get a site preview URL","description":"Generate a URL to preview the published content of a site. The URL will be valid for 1 hour.","tags":["site-preview"],"parameters":[{"$ref":"#/components/parameters/organizationId"},{"$ref":"#/components/parameters/siteId"},{"name":"siteSpace","in":"query","description":"ID of the site-space to preview. If not provided, the default site-space will be used.","schema":{"type":"string"}},{"name":"claims","in":"query","description":"Rison encoded string of attributes/assertions about the visitor for which we want to preview the site.","schema":{"type":"string"}},{"name":"draft","in":"query","description":"Whether to include draft content in the preview. Defaults to true","schema":{"type":"boolean","default":true}},{"name":"target","in":"query","description":"Target URL of the preview. If not provided, the default site preview URL will be used.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"$ref":"#/components/schemas/URL"}},"required":["url"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"}}}}}}
```


---

# Agent Instructions: 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:

```
GET https://gitbook.com/docs/developers/gitbook-api/api-reference/docs-sites/site-preview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
