squiggli Get a free API key
Guides

Embed signing and the editor

Put the signing page, the template editor or an envelope view inside your own app with one script.

Embedded signing

Send with delivery: "link", then show the signer's signing_url inside your page:

html
<div id="sign" style="height: 800px"></div>
<script src="https://squiggli.billy-965.workers.dev/embed.js"></script>
<script>
  Squiggli.sign(document.getElementById('sign'), {
    url: signingUrlFromYourServer,
    onEvent: (e) => { if (e.type === 'signed') showThanks() },
  })
</script>

Inside the frame the signing page drops its own header and footer.

The template editor

Mint a short-lived embed token on your server, never in the browser:

bash
curl https://squiggli.billy-965.workers.dev/v1/embed-tokens \
  -H "Authorization: Bearer $SQUIGGLI_API_KEY" -H "Content-Type: application/json" \
  -d '{ "scope": "editor", "template_id": "tpl_...", "ttl_seconds": 3600 }'
js
Squiggli.editor(document.getElementById('editor'), {
  token: embedToken,
  templateId: 'tpl_...', // leave out to start a new template
  onEvent: (e) => { if (e.type === 'saved') console.log('template', e.id) },
})

One envelope

An embed token with scope: "envelope" and envelope_id lets the page review, send, remind and void that envelope only.

js
Squiggli.envelope(document.getElementById('envelope'), { token, envelopeId: 'env_...' })

Events

EventFromMeans
readyAllLoaded.
viewedSigningThe signer opened the document.
signedSigningThey signed. complete is true when they were the last.
declinedSigningThey declined.
savedEditorThe template was saved; id is its id.
sentEnvelopeThe envelope was sent.
errorAllSomething went wrong; code says what.

Embed tokens only reach what they were made for: the editor's templates, or the one envelope. Anything else answers 403.