> 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/urls/resolve-a-url-of-a-published-content-1.md).

# Resolve a URL of a published content.

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"urls","description":"Manage official endpoints, direct deep links, or short links for your content. This allows you to keep track of multiple custom URLs or vanity links under one system.\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]},{"user-internal":[]},{"user-staff":[]},{"integration":[]},{"integration-installation":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"},"user-internal":{"type":"http","scheme":"bearer"},"user-staff":{"type":"http","scheme":"bearer"},"integration":{"type":"http","scheme":"bearer"},"integration-installation":{"type":"http","scheme":"bearer"}},"schemas":{"URL":{"type":"string","format":"uri","maxLength":2048},"SiteVisitorPayload":{"type":"object","description":"An object that describes the payload of site visitor info. It can include a jwt token with signed claims and/or a record of its unsigned claims.","properties":{"type":{"type":"string","enum":["human","agent"],"description":"Whether the visitor is a human or an AI agent. Defaults to human when omitted."},"jwtToken":{"type":"string","description":"JWT token generated for a authenticated access session."},"country":{"type":"string","description":"ISO 3166-1 alpha-2 code of the country the visitor is browsing from, as detected by the renderer."},"unsignedClaims":{"$ref":"#/components/schemas/PlainObject"}}},"PlainObject":{"properties":{},"additionalProperties":{"oneOf":[{"$ref":"#/components/schemas/PlainObject"},{"type":"string"},{"type":"boolean"},{"type":"number"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"boolean"},{"type":"number"},{"$ref":"#/components/schemas/PlainObject"}]}}]}},"PublishedSiteContentLookup":{"oneOf":[{"$ref":"#/components/schemas/PublishedContentRedirect"},{"$ref":"#/components/schemas/PublishedSiteContent"}]},"PublishedContentRedirect":{"oneOf":[{"type":"object","title":"Redirect to the application or a different content in the site","properties":{"target":{"type":"string","description":"Type of target for the redirect","enum":["application","content"]},"redirect":{"$ref":"#/components/schemas/URL"}},"required":["target","redirect"]},{"type":"object","title":"Redirect to an external resource from the site","properties":{"target":{"type":"string","description":"Type of target for the redirect","enum":["external"]},"site":{"type":"string","description":"ID of the resolved site."},"redirect":{"$ref":"#/components/schemas/URL"}},"required":["target","site","redirect"]}],"discriminator":{"propertyName":"target"}},"PublishedSiteContent":{"type":"object","title":"Site Content","properties":{"site":{"type":"string","description":"ID of the site matching."},"siteSection":{"type":"string","description":"ID of the site-section matching."},"siteSpace":{"type":"string","description":"ID of the site-space matching."},"space":{"type":"string","description":"ID of the space matching."},"changeRequest":{"type":"string","description":"Identifier of the change request being previewed in this URL."},"revision":{"type":"string","description":"Identifier of the revision being previewed in this URL."},"pathname":{"type":"string","description":"Path of the content relative to the input URL being resolved"},"basePath":{"type":"string","description":"Prefix of the path in the input URL being resolved"},"siteBasePath":{"type":"string","description":"Prefix of the site path in the input URL being resolved"},"apiToken":{"type":"string","description":"Short-lived API token to fetch content related to the space in the context of the URL."},"organization":{"type":"string","description":"ID of the organization."},"shareKey":{"type":"string","description":"Share link key of the site in case the site was published with share-links."},"complete":{"type":"boolean","description":"Whether the resolved site URL is complete and at it's terminal point, meaning no more site path segments can be further expected before any page path segments."},"contextId":{"type":"string","description":"Context returned only for a authenticated access session to track changes in the visitor session context that affect content rendering (used for cache invalidation)."},"canonicalUrl":{"type":"string","description":"The canonical URL of the resolution."},"preview":{"type":"boolean","description":"Whether the URL is a preview URL"}},"required":["site","siteSpace","space","pathname","basePath","siteBasePath","apiToken","organization","complete","canonicalUrl"]}},"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":{"/urls/published":{"post":{"operationId":"resolvePublishedContentByUrl","summary":"Resolve a URL of a published content.","tags":["urls"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"description":"URL to resolve","$ref":"#/components/schemas/URL"},"redirectOnError":{"type":"boolean","description":"When true redirects the user to the authentication/fallback URL if the access token is invalid","default":false},"visitor":{"$ref":"#/components/schemas/SiteVisitorPayload"}},"required":["url"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishedSiteContentLookup"}}}},"404":{"description":"No content found for the URL.","$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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/developers/gitbook-api/api-reference/urls/resolve-a-url-of-a-published-content-1.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
