> 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-external-links/add-an-external-link-to-a-sites-navigation.md).

# Add an external link to a site's navigation

Creates an external navigation link at the site root or in a section group. External links require a section-based site structure and cannot be placed inside a section. The destination must be an absolute HTTP or HTTPS URL. Draft links and links whose adaptive condition does not match are omitted from published structure responses. Use the generic structure sort operation after creation to change sibling order.

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"site-external-links","description":"External links add absolute HTTP or HTTPS destinations alongside sections and groups in a site's navigation.\n\n{% openapi-schemas spec=\"gitbook\" schemas=\"SiteExternalLink\" grouped=\"false\" %}\n    The SiteExternalLink 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.","integration:read":"Read integrations and where they are installed.","integration:installations:read":"Read integration installations and their configuration, which can include credentials for third-party services.","integration:installations:write":"Install and configure integrations on an organization, its spaces and its sites.","integration:publish":"Publish integrations, which can request their own permissions on your content, and route their events to a development tunnel.","integration:delete":"Unpublish integrations, permanently deleting them and every installation of them.","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"},"SiteSectionTitle":{"type":"string","description":"Title of the site section","minLength":2,"maxLength":128},"LocalizedString128":{"type":"object","description":"Localized string value with a 128 character limit, keyed by locale. Contains overrides for non-default languages only.","additionalProperties":{"type":"string","maxLength":128},"propertyNames":{"$ref":"#/components/schemas/TranslationLanguage"}},"TranslationLanguage":{"type":"string","enum":["en","fr","de","es","it","pt","pt-br","ru","ja","zh","zh-tw","yue","ko","ar","hi","nl","pl","tr","sv","no","da","fi","el","cs","hu","ro","th","vi","id","ms","he","uk","sk","bg","hr","lt","lv","et","sl"]},"SiteSectionDescription":{"type":"string","description":"Description of the site section","minLength":0,"maxLength":256},"LocalizedString256":{"type":"object","description":"Localized string value with a 256 character limit, keyed by locale. Contains overrides for non-default languages only.","additionalProperties":{"type":"string","maxLength":256},"propertyNames":{"$ref":"#/components/schemas/TranslationLanguage"}},"Icon":{"type":"string","maxLength":50,"format":"icon","description":"Name of the icon"},"URL":{"type":"string","format":"uri","maxLength":2048},"Expression":{"type":"string","description":"Expression to evaluate","minLength":0,"maxLength":1024},"SiteExternalLink":{"type":"object","properties":{"object":{"type":"string","description":"The object type, which is always \"site-external-link\"","enum":["site-external-link"]},"id":{"type":"string","description":"Unique identifier of the external link"},"title":{"$ref":"#/components/schemas/SiteSectionTitle"},"localizedTitle":{"$ref":"#/components/schemas/LocalizedString128"},"description":{"$ref":"#/components/schemas/SiteSectionDescription"},"localizedDescription":{"$ref":"#/components/schemas/LocalizedString256"},"icon":{"$ref":"#/components/schemas/Icon"},"url":{"$ref":"#/components/schemas/URL","description":"Absolute HTTP or HTTPS URL opened by the external link"},"sectionGroup":{"type":"string","description":"ID of the section group the external link belongs to. Omitted for a root link."},"draft":{"type":"boolean","description":"Whether the external link is draft and not live"},"condition":{"description":"Conditional expression used to evaluate whether the external link should be shown to the site's visitor","$ref":"#/components/schemas/Expression"}},"required":["object","id","title","url","draft"]},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}},"required":["code","message"]}}}},"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"]}}}}}},"UnexpectedError":{"description":"Unexpected Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/orgs/{organizationId}/sites/{siteId}/external-links":{"post":{"operationId":"addExternalLinkToSite","summary":"Add an external link to a site's navigation","description":"Creates an external navigation link at the site root or in a section group. External links require a section-based site structure and cannot be placed inside a section. The destination must be an absolute HTTP or HTTPS URL. Draft links and links whose adaptive condition does not match are omitted from published structure responses. Use the generic structure sort operation after creation to change sibling order.","tags":["site-external-links"],"parameters":[{"$ref":"#/components/parameters/organizationId"},{"$ref":"#/components/parameters/siteId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"$ref":"#/components/schemas/SiteSectionTitle"},"localizedTitle":{"$ref":"#/components/schemas/LocalizedString128"},"description":{"oneOf":[{"$ref":"#/components/schemas/SiteSectionDescription"},{"type":"null"}]},"localizedDescription":{"oneOf":[{"$ref":"#/components/schemas/LocalizedString256"},{"type":"null"}]},"icon":{"oneOf":[{"$ref":"#/components/schemas/Icon"},{"type":"null"}]},"url":{"$ref":"#/components/schemas/URL","description":"Absolute HTTP or HTTPS destination URL"},"parent":{"type":"string","description":"ID of the section group to create the link in. Omit to place it at the site root."},"draft":{"type":"boolean","description":"Whether the external link should be created in draft mode"},"condition":{"oneOf":[{"$ref":"#/components/schemas/Expression"},{"type":"null"}],"description":"Adaptive condition controlling whether visitors see the link"}},"required":["title","url"]}}}},"responses":{"201":{"description":"External link added to the site","headers":{"Location":{"description":"API URL for the newly created external link","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteExternalLink"}}}},"400":{"description":"The site has a simple structure or the parent group is invalid","$ref":"#/components/responses/BadRequestError"},"default":{"$ref":"#/components/responses/UnexpectedError"}}}}}}
```


---

# 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-external-links/add-an-external-link-to-a-sites-navigation.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.
