Skip to content

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:

EndpointPurpose
POST /v1/credentialReturn the signer’s certificate chain and signature format
POST /v1/authorizeGet the signer’s approval for exactly these digests
POST /v1/signReturn one signature per digest, as a raw value or a complete CMS
GET /v1/healthReport 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:

  1. credential. Which certificate will this signer sign with?
  2. authorize. The signer approves signing exactly these digests.
  3. 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 the sign response.

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

One signing session over SWP/1, part 1: the credential, the digest and the approval request
Signer's browser
SignatureAPI
Signing worker
  1. Signer's browser to SignatureAPI: Finish the ceremony
  2. SignatureAPI to Signing worker: POST /v1/credential
  3. Signing worker to SignatureAPI: completed with the credential
  4. SignatureAPI: Compute the digest
  5. SignatureAPI to Signing worker: POST /v1/authorize with the digests
  6. Signing worker to SignatureAPI: pending with an action_url
  7. SignatureAPI to Signer's browser: Redirect to action_url
  1. POST /v1/credential

    Which certificate signs, and in which format.

  2. completed with the credential
    Show 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"
            ]
        }
    }
  3. Compute the digest

    The document stays at SignatureAPI. The worker only ever receives its SHA-256 digest.

  4. POST /v1/authorize with the digests
    Show 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"
            }
        ]
    }
  5. pending with an action_url
    Show the code
    JSON
    {
        "status": "pending",
        "action_url": "https://signer.example.com/consent?ticket=...",
        "expires_at": "2026-08-24T16:45:00Z"
    }
  6. Redirect to action_url

    The ceremony shows **Authorize your signature**, then sends the browser on.

Dashed: a reply, or an asynchronous call such as a webhook.

Approval and signing

One signing session over SWP/1, part 2: the signer approves, then the worker signs
Signer's browser
SignatureAPI
Signing worker
Trust service provider
  1. Signer's browser to Trust service provider: Identify and approve
  2. Trust service provider to Signer's browser: Redirect to callback_url with a single-use code
  3. Signer's browser to SignatureAPI: GET callback_url
  4. SignatureAPI to Signing worker: POST /v1/authorize with callback.code
  5. Signing worker to SignatureAPI: completed with an authorization reference
  6. SignatureAPI to Signing worker: POST /v1/sign
  7. Signing worker to Trust service provider: Sign the digest
  8. Signing worker to SignatureAPI: completed with the signatures
  9. SignatureAPI: Verify, timestamp and embed in the PDF
  1. POST /v1/authorize with callback.code

    Same credential_id and digests as the first call.

  2. completed with an authorization reference
    Show the code
    JSON
    {
        "status": "completed",
        "authorization": {
            "reference": "sad_3Fh...",
            "expires_at": "2026-08-24T16:50:00Z"
        }
    }
  3. completed with the signatures
    Show the code
    JSON
    {
        "status": "completed",
        "signatures": [
            "MEUCIQD..."
        ]
    }
  4. 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.

StateWhat SignatureAPI doesWhat the ceremony shows
Waiting, with an action_urlSends 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 onlyCalls the same operation again with the same body every poll_after secondsWaiting for your confirmation
FailedRecords the failure reasonWe 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.

JSON
{
    "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=..."
}
FieldDescription
protocolAlways swp/1.
session.idThe signing session. Key anything you store by it. A retry from the ceremony starts a new session with a new ID.
session.attemptStarts at 1. Part of the Idempotency-Key.
schemeThe legal framework of the signature. Always eu_eidas today.
signer.idThe recipient ID. The token’s sub claim carries the same value.
signer.nameThe signer’s name, as set on the envelope.
signer.emailThe signer’s email address, or "" when the recipient has none.
callback_urlWhere you send the signer’s browser when an interactive step ends. Treat it as opaque.
callback.codePresent 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:

JSON
{ "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 }
  • completed carries the operation’s result, described on each endpoint page.
  • pending is allowed on credential and authorize only. See Pending steps.
  • failed carries 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 is eu_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/health and refuse tokens for any other account.
  • Single-use codes. Any code you add to callback_url works 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

HTTP
GET {worker URL}/v1/health

No token, no body and no authentication. Don't redirect it.

Responses

HTTP 200status ok

Body
{
  "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

HTTP
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

Body
{
  "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

Body
{
  "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

Body
{
  "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

Body
{
  "status": "failed",
  "error": "access_denied",
  "error_description": "The signer refused in the app",
  "retryable": false
}

HTTP 401status refusedinvalid_token

Body
{
  "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

Body
{
  "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

HTTP
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

Body
{
  "status": "completed",
  "authorization": {
    "reference": "sad_3Fh...",
    "expires_at": "2026-08-24T16:50:00Z"
  }
}

HTTP 200status pending

Body
{
  "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

Body
{
  "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

Body
{
  "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

HTTP
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

Body
{
  "status": "completed",
  "signatures": [
    "MEUCIQD..."
  ]
}

HTTP 200status completedcms

Body
{
  "status": "completed",
  "signatures": [
    "MIIGxwYJKoZIhvcNAQcCoIIGuDCCBrQCAQEx..."
  ],
  "certificates": [
    "-----BEGIN CERTIFICATE-----\n...signer...\n-----END CERTIFICATE-----",
    "-----BEGIN CERTIFICATE-----\n...intermediate...\n-----END CERTIFICATE-----"
  ]
}

HTTP 200status failed

Body
{
  "status": "failed",
  "error": "access_denied",
  "error_description": "The signer refused in the app",
  "retryable": false
}

HTTP 400status refusedinvalid_request

Body
{
  "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

Callback URLs
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

Body
{
  "status": "pending",
  "action_url": "https://signer.example.com/consent?ticket=...",
  "poll_after": 3,
  "expires_at": "2026-08-24T16:45:00Z"
}

HTTP 200status failed

Body
{
  "status": "failed",
  "error": "access_denied",
  "error_description": "The signer refused in the app",
  "retryable": false
}