Embed
Embed tokens for public artifact viewers.
Get embed token
Generates a signed embed URL and iframe HTML snippet for a canvas artifact. The embed token is HMAC-SHA256 signed and grants read-only access to the embedded viewer.
Authorization
AuthorizationRequiredBearer <token>NextDocs API key (nxd_xxx format)
In: header
Path Parameters
artifactIdRequiredstringArtifact ID to generate an embed token for.
Response Body
Embed URL and iframe HTML.
TypeScript Definitions
Use the response body type in TypeScript.
document_idRequiredstringembed_urlRequiredstringURL to embed the artifact.
iframe_htmlRequiredstringReady-to-use iframe HTML snippet.
titleRequiredstringtotal_pagesRequirednumber | null | nullRequest validation failed.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectAuthentication required or API key is invalid.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectThe requested resource was not found.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectcurl -X GET "https://api.nextdocs.io/v1/embed/doc_abc123" \
-H "Authorization: Bearer <token>"fetch("https://api.nextdocs.io/v1/embed/doc_abc123", {
headers: {
"Authorization": "Bearer <token>"
}
})package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.nextdocs.io/v1/embed/doc_abc123"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://api.nextdocs.io/v1/embed/doc_abc123"
response = requests.request("GET", url, headers = {
"Authorization": "Bearer <token>"
})
print(response.text){
"document_id": "doc_abc123",
"embed_url": "https://app.example.com/embed/doc_abc123?token=abc...",
"iframe_html": "<iframe src=\"https://app.example.com/embed/doc_abc123?token=abc...\" width=\"800\" height=\"450\" frameborder=\"0\" allowfullscreen style=\"border-radius: 8px; border: 1px solid #e5e7eb;\"></iframe>",
"title": "Q2 Pitch Deck",
"total_pages": 12
}{
"error": {
"code": "NOT_FOUND",
"message": "The requested resource was not found."
}
}{
"error": {
"code": "NOT_FOUND",
"message": "The requested resource was not found."
}
}{
"error": {
"code": "NOT_FOUND",
"message": "The requested resource was not found."
}
}