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.

GET
/v1/embed/{artifactId}

Authorization

AuthorizationRequiredBearer <token>

NextDocs API key (nxd_xxx format)

In: header

Path Parameters

artifactIdRequiredstring

Artifact ID to generate an embed token for.

Response Body

Embed URL and iframe HTML.

TypeScript Definitions

Use the response body type in TypeScript.

document_idRequiredstring
embed_urlRequiredstring

URL to embed the artifact.

iframe_htmlRequiredstring

Ready-to-use iframe HTML snippet.

titleRequiredstring
total_pagesRequirednumber | null | null

Request validation failed.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject

Authentication required or API key is invalid.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject

The requested resource was not found.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject
curl -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."
  }
}