Signing worker protocol
Signing Worker Protocol (SWP/1)
How SignatureAPI and a signing worker produce one qualified signature, the shape every request and response shares, and what SignatureAPI checks
Public beta. Qualified signatures are available on request, with any qualified trust service provider you choose and at no extra charge during the beta. See Request access. SWP/1 is in beta and may change.
The Signing Worker Protocol (SWP/1) is the contract between SignatureAPI and a signing worker. A worker serves four endpoints under its base URL:
| Endpoint | Purpose |
|---|---|
POST /v1/credential | Return the signer’s certificate chain and signature format |
POST /v1/authorize | Get the signer’s approval for exactly these digests |
POST /v1/sign | Return one signature per digest, as a raw value or a complete CMS |
GET /v1/health | Report status and list the accounts the worker accepts |
Every POST is authenticated with a token that SignatureAPI signs for that one request.
Lifecycle of a signature
One signer’s turn to sign is a signing session. In a session, SignatureAPI calls the three operations in this order:
credential. Which certificate will this signer sign with?authorize. The signer approves signing exactly these digests.sign. Produce the signature values.
The order follows from how PDF signatures work. A PAdES signature (the standard format for signatures inside a PDF) embeds a hash of the signing certificate. When SignatureAPI builds the signature, it needs the certificate before it can compute the digest. A qualified remote signature binds the signer’s approval to the exact digests, so the digests are final before authorize.
Signature formats
Your worker returns signatures in one of two formats, chosen per credential:
raw, the default. Your provider returns a bare signature value, and SignatureAPI builds the PDF signature around it.cms. Your provider returns a complete CMS (PKCS#7) signature over the PDF’s byte range. The signer certificate can arrive as late as thesignresponse.
Each operation answers completed, pending or failed. A pending answer means the signer must do something at the provider first, such as identify or approve. Your provider decides which calls wait. See Choose your provider’s model and Pending steps.
The diagrams below show a provider that needs the signer once, during authorize. A provider that identifies the signer in a separate step pauses credential too. One whose signer approves in an app answers poll_after instead of an action_url. The recipes have diagrams for each.
A worker that needs nothing from the signer answers completed three times in a row, and the browser never leaves the ceremony. If any step fails, the session fails, and the signer can retry from the ceremony in a new session.
Credential and approval request
- Signer's browser to SignatureAPI: Finish the ceremony
- SignatureAPI to Signing worker:
POST /v1/credential - Signing worker to SignatureAPI:
completedwith the credential - SignatureAPI: Compute the digest
- SignatureAPI to Signing worker:
POST /v1/authorizewith the digests - Signing worker to SignatureAPI:
pendingwith anaction_url - SignatureAPI to Signer's browser: Redirect to
action_url
POST /v1/credentialWhich certificate signs, and in which format.
completedwith the credentialShow the code
JSON{ "status": "completed", "credential": { "id": "cred_7Qk...", "certificates": [ "-----BEGIN CERTIFICATE-----\n...signer...\n-----END CERTIFICATE-----" ], "key_algo_oids": [ "1.2.840.10045.4.3.2" ] } }- Compute the digest
The document stays at SignatureAPI. The worker only ever receives its SHA-256 digest.
POST /v1/authorizewith the digestsShow the code
JSON{ "credential_id": "cred_7Qk...", "digests": [ { "value": "n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=", "hash_algorithm_oid": "2.16.840.1.101.3.4.2.1", "label": "Service Agreement" } ] }pendingwith anaction_urlShow the code
JSON{ "status": "pending", "action_url": "https://signer.example.com/consent?ticket=...", "expires_at": "2026-08-24T16:45:00Z" }- Redirect to
action_urlThe ceremony shows **Authorize your signature**, then sends the browser on.
Dashed: a reply, or an asynchronous call such as a webhook.
Approval and signing
- Signer's browser to Trust service provider: Identify and approve
- Trust service provider to Signer's browser: Redirect to
callback_urlwith a single-usecode - Signer's browser to SignatureAPI:
GET callback_url - SignatureAPI to Signing worker:
POST /v1/authorizewithcallback.code - Signing worker to SignatureAPI:
completedwith an authorization reference - SignatureAPI to Signing worker:
POST /v1/sign - Signing worker to Trust service provider: Sign the digest
- Signing worker to SignatureAPI:
completedwith the signatures - SignatureAPI: Verify, timestamp and embed in the PDF
POST /v1/authorizewithcallback.codeSame
credential_idanddigestsas the first call.completedwith an authorization referenceShow the code
JSON{ "status": "completed", "authorization": { "reference": "sad_3Fh...", "expires_at": "2026-08-24T16:50:00Z" } }completedwith the signaturesShow the code
JSON{ "status": "completed", "signatures": [ "MEUCIQD..." ] }- Verify, timestamp and embed in the PDF
SignatureAPI checks the signature, the chain and the scheme before the signature reaches the PDF.
Dashed: a reply, or an asynchronous call such as a webhook.
A session, step by step
From your worker’s side, a signing session moves through these states. Each arrow is one of your answers, or something the signer does.
stateDiagram-v2
direction LR
[*] --> Credential
Credential --> CredentialWaiting: pending
CredentialWaiting --> Credential: callback code, or poll
Credential --> Authorize: completed
Authorize --> AuthorizeWaiting: pending
AuthorizeWaiting --> Authorize: callback code, or poll
Authorize --> Sign: completed
Sign --> Embedded: completed, checks pass
Embedded --> [*]
CredentialWaiting --> Failed: deadline or callback error
AuthorizeWaiting --> Failed: deadline or callback error
Failed --> [*]
Any call can also end the session by answering failed, and so can a signature that fails SignatureAPI’s checks. Between credential and authorize, SignatureAPI computes the digest.
| State | What SignatureAPI does | What the ceremony shows |
|---|---|---|
Waiting, with an action_url | Sends the browser to action_url, and waits for it at callback_url. Polls too if you sent poll_after. | Confirm your identity to continue for credential, Authorize your signature for authorize |
Waiting, with poll_after only | Calls the same operation again with the same body every poll_after seconds | Waiting for your confirmation |
| Failed | Records the failure reason | We couldn’t complete your signature, the reason and Try again |
Try again starts a new session with a new session.id. Nothing carries over from the failed one. See What the signer sees for each screen.
Common request fields
Every POST body carries these fields, plus the operation’s own. Binary values are standard base64 with padding. Timestamps are RFC 3339.
{
"protocol": "swp/1",
"session": { "id": "sgs_YFobK1NDktAuz0wzplR4OP", "attempt": 1 },
"scheme": "eu_eidas",
"signer": {
"id": "re_00ZeZjRaXCgT30n1eBx53N",
"name": "Jane Doe",
"email": "jane.doe@example.com"
},
"callback_url": "https://api.signatureapi.com/v1/signing-sessions/callback?state=..."
}| Field | Description |
|---|---|
protocol | Always swp/1. |
session.id | The signing session. Key anything you store by it. A retry from the ceremony starts a new session with a new ID. |
session.attempt | Starts at 1. Part of the Idempotency-Key. |
scheme | The legal framework of the signature. Always eu_eidas today. |
signer.id | The recipient ID. The token’s sub claim carries the same value. |
signer.name | The signer’s name, as set on the envelope. |
signer.email | The signer’s email address, or "" when the recipient has none. |
callback_url | Where you send the signer’s browser when an interactive step ends. Treat it as opaque. |
callback.code | Present only when the request resumes after a redirect. The single-use code your worker added to callback_url. |
The signer’s name and email are personal data. Log IDs, not request bodies.
Responses
Answer every operation with HTTP 200 and one of three bodies:
{ "status": "completed", ...result }
{ "status": "pending", "action_url": "https://signer.example.com/consent?ticket=...", "expires_at": "2026-08-24T16:45:00Z" }
{ "status": "failed", "error": "access_denied", "error_description": "The signer refused in the app", "retryable": false }completedcarries the operation’s result, described on each endpoint page.pendingis allowed oncredentialandauthorizeonly. See Pending steps.failedcarries an error code.
Use a non-200 status only when you refuse the request itself.
What SignatureAPI checks
Before a signature reaches the deliverable, SignatureAPI runs three checks. If one fails, the session fails with that check’s name.
signature. The signature verifies over the exact digest SignatureAPI sent, with the public key of the signer certificate.chain. Each certificate in the chain is signed by the next, and every one was valid at the check’s time.scheme. The session’s scheme iseu_eidas.
For raw, SignatureAPI verifies against the chain it saved when it computed the digest: the one from credential, or the connection’s static certificate. The chain check uses the signing time. A raw sign response carries no certificates.
For cms, SignatureAPI checks the chain from the sign response, at the time that response arrived. Then it verifies the CMS itself: its structure, its message digest, its signature and its signer certificate. See Requirements on a CMS signature.
In both formats, SignatureAPI adds its own timestamp and revocation data before it embeds the signature. Each failure reason is listed in Session failure reasons.
SignatureAPI does not check that the certificate is qualified. Making sure your worker signs with qualified certificates from a qualified provider is the worker owner’s responsibility.
Requirements at a glance
- Public HTTPS. Serve the worker on port 443 with a certificate from a public certificate authority. SignatureAPI connects only to public addresses.
- No redirects. Answer on the URL SignatureAPI called. SignatureAPI never follows a redirect.
- Verify every token, including the body hash against the raw bytes. See Authentication.
- Accept only listed accounts. List your accounts’ connection tokens in
/v1/healthand refuse tokens for any other account. - Single-use codes. Any
codeyou add tocallback_urlworks once. - Sign once. Never sign twice for one
Idempotency-Key. - Small responses. SignatureAPI rejects responses larger than 1 MiB.
Every message
Each operation’s request and responses in one place. The endpoint pages explain every field.
Health
GET/v1/health
Reports the worker's status and lists the connection tokens of the accounts it accepts. SignatureAPI calls it during the connection checks, never while signing. Reference
Request
GET {worker URL}/v1/healthNo token, no body and no authentication. Don't redirect it.
Responses
HTTP 200status ok
{
"status": "ok",
"connection_tokens": [
"swpct_xulVJ9y9r1RWzRVwMZSzC4AMxZPCvI7W",
"swpct_mYpxjUwvQpx33z6AT0Os67xaW8ZaLQkg"
]
}Answer within 5 seconds.
Credential
POST/v1/credential
The first call of a signing session: return the signer's certificate chain, and the signature format, raw or cms. Reference
Request
POST /v1/credential HTTP/1.1
Authorization: Bearer <token>
Content-Digest: sha-256=:gH+q4NBd+8ua19c0X58XPQj0/xsHjyCK/u691x0cvwI=:
Idempotency-Key: sgs_YFobK1NDktAuz0wzplR4OP/credential/1
SignatureAPI-Protocol: swp/1
{
"protocol": "swp/1",
"session": {
"id": "sgs_YFobK1NDktAuz0wzplR4OP",
"attempt": 1
},
"scheme": "eu_eidas",
"signer": {
"id": "re_00ZeZjRaXCgT30n1eBx53N",
"name": "Jane Doe",
"email": "jane.doe@example.com"
},
"callback_url": "https://api.signatureapi.com/v1/signing-sessions/callback?state=..."
}The token is a placeholder: see Authentication for how SignatureAPI signs it.
The common request fields, nothing else. A request that resumes after a redirect also carries callback.code.
Responses
HTTP 200status completedraw
{
"status": "completed",
"credential": {
"id": "cred_7Qk...",
"certificates": [
"-----BEGIN CERTIFICATE-----\n...signer...\n-----END CERTIFICATE-----",
"-----BEGIN CERTIFICATE-----\n...intermediate...\n-----END CERTIFICATE-----"
],
"key_algo_oids": [
"1.2.840.10045.4.3.2"
],
"expires_at": "2026-08-24T17:10:00Z"
}
}HTTP 200status completedcms, no certificate yet
{
"status": "completed",
"credential": {
"id": "cred_7Qk...",
"signature_format": "cms",
"expires_at": "2026-08-24T17:10:00Z"
}
}The certificate then arrives in the sign response.
HTTP 200status pending
{
"status": "pending",
"action_url": "https://signer.example.com/consent?ticket=...",
"poll_after": 3,
"expires_at": "2026-08-24T16:45:00Z"
}Only when the provider must identify the signer first. A request that carries callback.code never gets pending.
HTTP 200status failed
{
"status": "failed",
"error": "access_denied",
"error_description": "The signer refused in the app",
"retryable": false
}HTTP 401status refusedinvalid_token
{
"error": "invalid_token",
"error_description": "connection token not allowed"
}The token's connection_token is not on the worker's list.
HTTP 400status refusedinvalid_request
{
"error": "invalid_request",
"error_description": "missing Idempotency-Key"
}Authorize
POST/v1/authorize
The second call: get the signer's approval to sign exactly these digests, and return a reference to it. Reference
Request
POST /v1/authorize HTTP/1.1
Authorization: Bearer <token>
Content-Digest: sha-256=:V0+MEWYMfXG46QApXC+DOQgNhBlTeItoiDsI270mLwI=:
Idempotency-Key: sgs_YFobK1NDktAuz0wzplR4OP/authorize/1
SignatureAPI-Protocol: swp/1
{
"protocol": "swp/1",
"session": {
"id": "sgs_YFobK1NDktAuz0wzplR4OP",
"attempt": 1
},
"scheme": "eu_eidas",
"signer": {
"id": "re_00ZeZjRaXCgT30n1eBx53N",
"name": "Jane Doe",
"email": "jane.doe@example.com"
},
"callback_url": "https://api.signatureapi.com/v1/signing-sessions/callback?state=...",
"credential_id": "cred_7Qk...",
"digests": [
{
"value": "n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=",
"hash_algorithm_oid": "2.16.840.1.101.3.4.2.1",
"label": "Service Agreement"
}
]
}The token is a placeholder: see Authentication for how SignatureAPI signs it.
The common request fields come first, then this operation's own fields.
Responses
HTTP 200status completed
{
"status": "completed",
"authorization": {
"reference": "sad_3Fh...",
"expires_at": "2026-08-24T16:50:00Z"
}
}HTTP 200status pending
{
"status": "pending",
"action_url": "https://signer.example.com/consent?ticket=...",
"poll_after": 3,
"expires_at": "2026-08-24T16:45:00Z"
}While the signer approves on a page (action_url) or in an app (poll_after).
HTTP 200status failed
{
"status": "failed",
"error": "access_denied",
"error_description": "The signer refused in the app",
"retryable": false
}The signer refused. They can retry from the ceremony.
HTTP 401status refusedinvalid_token
{
"error": "invalid_token",
"error_description": "connection token not allowed"
}Sign
POST/v1/sign
The last call: use the approval and return one signature per digest, as a raw value or a complete CMS. It never answers pending. Reference
Request
POST /v1/sign HTTP/1.1
Authorization: Bearer <token>
Content-Digest: sha-256=:gdiuq+7s6GI3xu9idsRSsYWi5a2egnq9w7pFcHJQbKw=:
Idempotency-Key: sgs_YFobK1NDktAuz0wzplR4OP/sign/1
SignatureAPI-Protocol: swp/1
{
"protocol": "swp/1",
"session": {
"id": "sgs_YFobK1NDktAuz0wzplR4OP",
"attempt": 1
},
"scheme": "eu_eidas",
"signer": {
"id": "re_00ZeZjRaXCgT30n1eBx53N",
"name": "Jane Doe",
"email": "jane.doe@example.com"
},
"callback_url": "https://api.signatureapi.com/v1/signing-sessions/callback?state=...",
"credential_id": "cred_7Qk...",
"authorization": {
"reference": "sad_3Fh..."
},
"digests": [
{
"value": "n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=",
"hash_algorithm_oid": "2.16.840.1.101.3.4.2.1"
}
],
"sign_algo_oid": "1.2.840.10045.4.3.2"
}The token is a placeholder: see Authentication for how SignatureAPI signs it.
The common request fields come first, then this operation's own fields.
Responses
HTTP 200status completedraw
{
"status": "completed",
"signatures": [
"MEUCIQD..."
]
}HTTP 200status completedcms
{
"status": "completed",
"signatures": [
"MIIGxwYJKoZIhvcNAQcCoIIGuDCCBrQCAQEx..."
],
"certificates": [
"-----BEGIN CERTIFICATE-----\n...signer...\n-----END CERTIFICATE-----",
"-----BEGIN CERTIFICATE-----\n...intermediate...\n-----END CERTIFICATE-----"
]
}HTTP 200status failed
{
"status": "failed",
"error": "access_denied",
"error_description": "The signer refused in the app",
"retryable": false
}HTTP 400status refusedinvalid_request
{
"error": "invalid_request",
"error_description": "missing Idempotency-Key"
}Pending steps
POST/v1/credential, /v1/authorize
credential and authorize can answer pending while the signer identifies or approves at the provider: with an action_url (redirect), poll_after (poll), or both. Reference
Callback
https://api.signatureapi.com/v1/signing-sessions/callback?state=NQ...&code=c_8f2e...
https://api.signatureapi.com/v1/signing-sessions/callback?state=NQ...&error=access_denied&error_description=You%20cancelled%20the%20signature.Where your worker sends the signer's browser when the step ends: callback_url with a single-use code, or with an error.
Responses
HTTP 200status pending
{
"status": "pending",
"action_url": "https://signer.example.com/consent?ticket=...",
"poll_after": 3,
"expires_at": "2026-08-24T16:45:00Z"
}HTTP 200status failed
{
"status": "failed",
"error": "access_denied",
"error_description": "The signer refused in the app",
"retryable": false
}