Embedding Notebooks

A notebook can be embedded using a standard iframe element. To create the embedding URL, copy the notebook URL (e.g. https://your-sourcegraph-instance.com/notebooks/notebook-id), and add the /embed prefix directly before the /notebooks segment:


Once you have the embedding URL, create an iframe element and use the embedding URL as the src attribute value. See example iframe below:

  sandbox="allow-scripts allow-same-origin allow-popups"


We recommend using the sandbox attribute to apply extra security restrictions to the iframe. Notebooks require three exceptions: allow-scripts allows executing Javascript scripts, allow-same-origin allows access to local storage and cookies, and allow-popups allows opening links in a separate tab.

Enable embedding notebooks on private instances

Embedding is disabled by default on private instances. A site-admin can enable embedding by running the following GraphQL mutation in the API console, located at https://{your-sourcegraph-instance.com}/api/console:

mutation {
  createFeatureFlag(name: "enable-embed-route", value: true) {
    ... on FeatureFlagBoolean {