Embedded Signing
Embedded signing lets a recipient sign an ERPDocs document inside your own product — in an iframe on your page, or through a short redirect and back again. The signer never opens an email and never sees an ERPDocs login.
Use it when your application already knows who the user is. A customer portal, a supplier onboarding wizard, an internal HR tool: the user is logged in, you know their identity, and sending them to their inbox to find a link is friction you do not need.
If your recipients are outside parties who are not logged into anything you control, keep using the normal email flow. Embedded signing depends on your application authenticating the signer.
What you need before you start
| Item | Where it comes from |
|---|---|
An API key with the signpack.embed scope |
Admin → API & Webhooks |
| The exact origin that will frame the signing page | Registered on that same API key |
| A sent envelope with a recipient to sign | Created from a template or a raw PDF |
| A developer | Token minting is a server-to-server call |
Note: Embedded signing is blocked for sandbox keys. A sandbox key returns
403 sandbox_write_blocked. You need a live key to mint a handoff token.
How it works
Three steps, and only the middle one is a server call.
- Register the framing origin once, on the API key, in Admin → API & Webhooks.
- Mint a handoff token from your backend, at the moment you are about to show the document.
- Frame or redirect to the returned URL.
The token is single-use and short-lived. It is the handoff: it proves to ERPDocs that your application authenticated this signer and is putting them into this specific document right now.
Step 1 — Register your origin
The origin that frames the signing page has to be registered in advance. ERPDocs uses it as the sole frame-ancestors value in the Content-Security-Policy header for that signing session, so a page on any unregistered origin simply cannot frame the document.
- Go to Admin → API & Webhooks and open the API key you will use.
- Add the origin under Embed Origins.
It must be an exact scheme-plus-host-plus-port origin:
| Value | Valid | Why |
|---|---|---|
https://app.yourcompany.com |
Yes | Exact origin |
https://app.yourcompany.com:8443 |
Yes | Explicit port is part of the origin |
https://app.yourcompany.com/sign |
No | Paths are not part of an origin |
https://*.yourcompany.com |
No | Wildcards are not accepted |
http://localhost:3000 |
Yes | Useful during development |
Register every origin you will actually frame from, including staging hosts.
Step 2 — Mint a handoff token
Call this from your backend once you have authenticated the user and are ready to display the document:
curl -X POST \
https://www.erpdocs.com/api/v1/signpacks/9012/recipients/4567/embed-token \
-H "Authorization: Bearer $ERPDOCS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"origin": "https://app.yourcompany.com",
"ttl_seconds": 300,
"require_verification": "email_otp",
"signer_authenticated": {
"method": "sso",
"identifier": "jane@customer.example",
"authenticated_at": "2026-09-05T10:14:00Z"
}
}'
| Field | Required | Notes |
|---|---|---|
origin |
Yes | Must exactly match one of the registered origins on the key. |
ttl_seconds |
No | 30–900. Defaults to 300 (5 minutes). |
require_verification |
No | email_otp or none. Defaults to the key's setting. See below. |
redirect_url |
No | Where to send the signer afterwards. Must be on the same origin. |
suppress_completion_email |
No | Set true if your product delivers the signed copy itself. |
signer_authenticated |
No | Your identity assertion. Strongly recommended — see below. |
The response:
{
"sign_url": "https://www.erpdocs.com/signpack/embed/abc123...",
"signpack_id": 9012,
"recipient_id": 4567,
"origin": "https://app.yourcompany.com",
"require_verification": "email_otp",
"expires_at": "2026-09-05T10:19:00Z",
"expires_in": 300,
"single_use": true
}
Read require_verification back from the response rather than assuming your requested value was applied — the key's setting may have raised it.
Mint late, not early. The token is single-use and expires in minutes. Request it when the user is about to see the document — not when you create the envelope. Only a SHA-256 hash of each token is stored, so a database disclosure yields no usable signing URLs.
Who verifies the signer
Two models, chosen per API key.
email_otp — ERPDocs verifies too (default for new keys)
The iframe first shows a short verification step: the signer clicks Send verification code, ERPDocs emails a 6-digit code to the recipient address, and the document loads once the code is accepted. The whole step happens inside your iframe — the signer never leaves your product.
This proves the signer controls the invitation mailbox, on top of whatever your application already checked.
none — your application vouches for the signer
The document loads immediately. ERPDocs performs no check of its own, and attribution rests entirely on the signer_authenticated object you send.
Use this only when your own authentication is genuinely strong — a password or SSO login against an account whose email address you already control. If your app collected the email from a form the user typed in, none proves very little about who actually signed.
Which one applies
The level on the API key is a floor, set by an org admin under Admin → API & Webhooks → Signer Verification. A mint request may ask for something stronger, but a request for something weaker is rejected:
{
"error": "'require_verification' cannot be weaker than this API key's policy ('email_otp').",
"code": "verification_downgrade_blocked",
"policy_minimum": "email_otp"
}
That floor exists so that a leaked API key is not by itself enough to produce a signature attributed to someone else. A thief holding the key still cannot turn verification off.
| Keys created before this feature | Keys created after | |
|---|---|---|
| Default floor | none — unchanged, nothing breaks |
email_otp |
Events your frame receives during verification
| Message | When |
|---|---|
{"type": "ready", "stage": "identity_verification"} |
Verification step rendered |
{"type": "identity_verified", "method": "email_otp"} |
Code accepted, document about to load |
These exist so you can manage your own spinner. They are not proof of anything — the authoritative signal is still the signpack.completed webhook.
If a signer gets stuck
Codes are limited to one per 60 seconds and 3 per 15 minutes per recipient, 10 per hour per IP, and 10 per day per recipient. A blocked request returns 429 with retry_after seconds. Embedded recipients receive no invitation or reminder emails, so there is no email link to fall back on — mint a fresh token and put them back in. Each new handoff resets the signer's daily code allowance.
Step 3 — Frame it or redirect to it
<iframe
src="https://www.erpdocs.com/signpack/embed/abc123..."
width="100%"
height="820"
style="border:0;"
allow="clipboard-write"
></iframe>
Give it at least 540px of height so the action bar stays visible. 820px is comfortable.
To redirect instead, send the browser to sign_url and set redirect_url when minting so the signer comes back to you. ERPDocs appends ?event=signing_complete or ?event=decline to your redirect_url, so your landing page can tell the two outcomes apart without making an API call.
Reacting to what the signer does
Inside an iframe, the signing page posts messages to your parent window, restricted to your registered origin. Every message has a type, plus signpack_id and recipient_id.
type |
When | Extra payload |
|---|---|---|
ready |
Signing page finished loading | — |
complete |
Signer submitted their signature | — |
decline |
Signer declined | reason |
redirect |
About to redirect, if redirect_url was set |
redirect_url, event |
error |
Token invalid or expired before the signer got in | event (ttl_expired or already_redeemed), reason |
window.addEventListener('message', (e) => {
if (e.origin !== 'https://www.erpdocs.com') return;
const msg = e.data || {};
if (msg.type === 'ready') hideSpinner();
if (msg.type === 'complete') showThankYou();
if (msg.type === 'decline') showDeclined(msg.reason);
if (msg.type === 'error') mintFreshTokenAndReload();
});
Always check e.origin before trusting a message.
These events are UX hints, not proof. A signer can close the tab before the message fires. The authoritative completion signal is the
signpack.completedwebhook. Never record a deal as signed on the strength of acompletepostMessage — see Setting Up Webhooks.
On an error event, mint a fresh token and reload the frame. Do not navigate the user away.
Telling ERPDocs who you authenticated
Send the signer_authenticated object so the audit trail records how you established identity. This matters in both models: with none it is the only evidence of attribution, and with email_otp it sits alongside our result as provenance.
"signer_authenticated": {
"method": "sso",
"identifier": "jane@customer.example",
"authenticated_at": "2026-09-05T10:14:00Z"
}
method is free text describing your mechanism — sso, password, portal_link, mfa. identifier is who you authenticated, normally their email. authenticated_at is when.
This matters for the certificate. See below.
What the Certificate of Completion says
The certificate records two independent facts and never collapses them into one. Which is which depends on your verification level:
require_verification |
Security Level | What the provenance block says |
|---|---|---|
email_otp |
Email OTP Verified (Embedded) | You authenticated the signer and ERPDocs then independently verified mailbox control. Both timestamps appear: when you authenticated, and when we verified. |
none |
Host Application Authentication | States plainly that ERPDocs did not independently verify the signer's mailbox, and reproduces your assertion — origin, method, identifier, timestamp — as the sole evidence of attribution. |
In both cases the block names the host application origin and the single-use handoff session. If you do not send signer_authenticated, the certificate can only show the framing origin, which is much weaker evidence.
Electronic Record and Signature Disclosure consent is still collected from embedded signers exactly as it is from everyone else.
With none you take on identity assurance in exchange for keeping the signer inside your product — make sure your own authentication is strong enough to carry that weight. With email_otp you keep the seamless experience and an ERPDocs-verified signer, at the cost of one extra step. See Certificate of Completion and Signer Identity Verification.
Which emails an embedded signer receives
The rule: anything carrying a signing link is suppressed, because such a link would let the signer bypass your application's authentication. Everything else still goes out.
| Sent to an embedded signer? | |
|---|---|
| Invitation / "please sign" | No — suppressed |
| Reminder, automatic and manual | No — suppressed |
| Your-turn notification in a sequential envelope | No — suppressed |
| CC notification | No — suppressed |
| Completion notification | Yes, by default |
| Final signed copy | Yes, by default |
The last two are on by default because sending signers a copy of what they signed is expected practice under ESIGN and eIDAS, and your application may never provide one. To take over that delivery yourself, set suppress_completion_email: true — either on the embed-token request or on the recipient at send time.
Note: the completion and signed-copy emails are ERPDocs-branded. If you are building a fully white-labelled flow, either suppress them and deliver the document yourself, or apply a brand profile.
Mark the recipient embedded at send time
Calling the embed-token endpoint marks the recipient as embedded automatically. But that is often too late.
The invitation email fires the moment the envelope is sent. If you send the envelope at 09:00 and mint a token at 09:05, that invitation already went out at 09:00 with a working standalone link in it.
So set the flag when you send:
{
"sender_email": "ops@yourcompany.com",
"recipients": {
"Signer 1": {
"name": "Jane",
"email": "jane@customer.example",
"embedded": true,
"suppress_completion_email": true
}
}
}
This works on both POST /api/v1/templates/{id}/send and raw-PDF sending.
Reminders do not apply
Embedded signers are never reminded by email, automatically or manually, because a reminder carries a signing link. Chasing an embedded signer is your application's job — you know when they last logged in; ERPDocs does not.
If every pending recipient on an envelope is an embedded signer, POST /api/v1/signpacks/{id}/remind returns 409 no_remindable_recipients and explains why, rather than reporting success and sending nothing. In the app, the reminder dialog shows those recipients with an EMBED badge and the checkbox disabled.
Errors
| Code | HTTP | Meaning |
|---|---|---|
origin_required |
400 | No origin in the request body. |
invalid_origin |
400 | Not a well-formed origin, or it has a path. |
origin_not_allowed |
403 | Well-formed, but not registered on this API key. |
invalid_ttl |
400 | ttl_seconds outside 30–900. |
not_embeddable |
409 | Envelope is not in a signable state — draft, expired, cancelled or completed. |
already_signed |
409 | That recipient has already signed. |
already_declined |
409 | That recipient declined. |
sandbox_write_blocked |
403 | Sandbox key. Use a live key. |
embed_token_failed |
500 | Server could not persist the session. Retry. |
See Troubleshooting API Errors.
Troubleshooting
The iframe is blank, and the browser console mentions frame-ancestors.
The origin framing the page is not registered on the API key, or does not match exactly. https://app.example.com and https://www.app.example.com are different origins. Check for a stray path or trailing slash.
403 origin_not_allowed even though I registered it.
Confirm you registered it on the same API key you are minting with, and that you are calling the same environment — a key registered on staging is not a key on production.
The signer got an invitation email anyway.
The envelope was sent before the recipient was marked embedded. Set "embedded": true at send time.
409 not_embeddable.
The envelope has to be sent and still open. Check its status first with GET /api/v1/signpacks/{id} — see SignPack Statuses Explained.
The token expired before the signer clicked.
Mint it later, immediately before display. Raising ttl_seconds works but widens the window in which a leaked URL is usable.
The signer refreshed and now sees an error.
Tokens are single-use. Handle the error event with already_redeemed by minting a fresh one.