# Space embeds

Automatically fetch metadata or previews for embedded resources such as videos, images, or external docs, enabling richer content experiences in your space.

## GET /spaces/{spaceId}/embed

> Resolve a URL to an embed in a given space

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"space-embeds","description":"Automatically fetch metadata or previews for embedded resources such as videos, images, or external docs, enabling richer content experiences in your space.\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"parameters":{"spaceId":{"name":"spaceId","in":"path","required":true,"description":"The unique id of the space","schema":{"$ref":"#/components/schemas/EntityId"}}},"schemas":{"EntityId":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"A unique entity identifier"},"Embed":{"allOf":[{"type":"object","properties":{"title":{"type":"string"},"site":{"type":"string"},"icon":{"type":"string"}},"required":["title","site"]},{"oneOf":[{"type":"object","title":"Link","properties":{"type":{"type":"string","enum":["link"]}},"required":["type"]},{"type":"object","title":"HTML","properties":{"type":{"type":"string","enum":["rich"]},"html":{"type":"string"}},"required":["type","html"]},{"type":"object","title":"Integration","properties":{"type":{"type":"string","enum":["integration"]},"integration":{"description":"The identifier of the integration performing the rendering","type":"string"},"block":{"$ref":"#/components/schemas/IntegrationBlock"}},"required":["type","integration","block"]}]}]},"IntegrationBlock":{"type":"object","properties":{"id":{"type":"string","description":"Unique ID in the integration for the block. It also represents the UI component used."},"title":{"type":"string","description":"Short descriptive title for the block.","minLength":2,"maxLength":40},"description":{"type":"string","description":"Long descriptive text for the block.","minLength":0,"maxLength":150},"icon":{"type":"string","description":"URL of the icon to represent this block."},"urlUnfurl":{"type":"array","description":"URLs patterns to convert as this block.","items":{"type":"string"}},"markdown":{"$ref":"#/components/schemas/IntegrationBlockMarkdown"}},"required":["id","title"]},"IntegrationBlockMarkdown":{"oneOf":[{"type":"object","description":"Format the custom block as a codeblock","properties":{"codeblock":{"description":"Code block syntax to use to identify the block.","type":"string"},"body":{"description":"Key of the property to use as body of the codeblock.","type":"string"}},"required":["codeblock","body"]}]}}},"paths":{"/spaces/{spaceId}/embed":{"get":{"operationId":"getEmbedByUrlInSpace","summary":"Resolve a URL to an embed in a given space","tags":["space-embeds"],"parameters":[{"$ref":"#/components/parameters/spaceId"},{"name":"url","in":"query","required":true,"description":"URL to resolve","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Embed"}}}}}}}}}
```


---

# 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/spaces/space-embeds.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.
