---
title: "Signing Worker Protocol (SWP/1)"
description: "How SignatureAPI and a signing worker produce one qualified signature, the shape every request and response shares, and what SignatureAPI checks"
canonical: "https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol"
source: "https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol.md"
last_verified_api_version: "1.18.1"
last_modified: "2026-11-18T16:06:16Z"
---

# 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

_Last verified against API version 1.18.1._

> **Note:** **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](https://signatureapi.com/docs/qualified-signatures#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](https://signatureapi.com/docs/qualified-signatures/signing-workers). A worker serves four endpoints under its base URL:

| Endpoint                                                                                                       | Purpose                                                           |
| -------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| [`POST /v1/credential`](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/credential) | Return the signer's certificate chain and signature format        |
| [`POST /v1/authorize`](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/authorize)   | Get the signer's approval for exactly these digests               |
| [`POST /v1/sign`](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/sign)             | Return one signature per digest, as a raw value or a complete CMS |
| [`GET /v1/health`](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/health)          | Report status and list the accounts the worker accepts            |

Every `POST` is [authenticated](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/authentication) 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](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/signature-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](https://signatureapi.com/docs/qualified-signatures/worker-models) and [Pending steps](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/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](https://signatureapi.com/docs/qualified-signatures/worker-models#4-put-it-together) 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**

Participants: Signer's browser, SignatureAPI, Signing worker.

1. **Signer's browser** to **SignatureAPI**: Finish the ceremony
2. **SignatureAPI** to **Signing worker**: `POST /v1/credential`
   Which certificate signs, and in which format.
3. **Signing worker** to **SignatureAPI**: `completed` with the credential

   ```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"
           ]
       }
   }
   ```
4. **SignatureAPI**: Compute the digest
   The document stays at SignatureAPI. The worker only ever receives its SHA-256 digest.
5. **SignatureAPI** to **Signing worker**: `POST /v1/authorize` with the digests

   ```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"
           }
       ]
   }
   ```
6. **Signing worker** to **SignatureAPI**: `pending` with an `action_url`

   ```json
   {
       "status": "pending",
       "action_url": "https://signer.example.com/consent?ticket=...",
       "expires_at": "2026-08-24T16:45:00Z"
   }
   ```
7. **SignatureAPI** to **Signer's browser**: Redirect to `action_url`
   The ceremony shows **Authorize your signature**, then sends the browser on.

### Approval and signing

**One signing session over SWP/1, part 2: the signer approves, then the worker signs**

Participants: 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`
   Same `credential_id` and `digests` as the first call.
5. **Signing worker** to **SignatureAPI**: `completed` with an authorization reference

   ```json
   {
       "status": "completed",
       "authorization": {
           "reference": "sad_3Fh...",
           "expires_at": "2026-08-24T16:50:00Z"
       }
   }
   ```
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

   ```json
   {
       "status": "completed",
       "signatures": [
           "MEUCIQD..."
       ]
   }
   ```
9. **SignatureAPI**: Verify, timestamp and embed in the PDF
   SignatureAPI checks the signature, the chain and the scheme before the signature reaches the PDF.

## 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.

```mermaid
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](https://signatureapi.com/docs/qualified-signatures/worker-models#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=..."
}
```

| 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`](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/errors#idempotency). |
| `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:

```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](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/pending-steps).
- **`failed`** carries an [error code](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/errors#error-codes).

Use a non-`200` status only when you [refuse the request itself](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/errors#refusing-a-request).

## 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](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/signature-formats#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](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/errors#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](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/authentication).
- **Accept only listed accounts.** List your accounts' connection tokens in [`/v1/health`](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/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`](https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/errors#idempotency).
- **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: https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/health

Request:

```text
GET {worker URL}/v1/health
```

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

Responses:

HTTP 200, `ok`:

```json
{
  "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: https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/credential

Request:

```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=..."
}
```

The common request fields, nothing else. A request that resumes after a redirect also carries callback.code.

Responses:

HTTP 200, `completed` (raw):

```json
{
  "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 200, `completed` (cms, no certificate yet):

```json
{
  "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 200, `pending`:

```json
{
  "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 200, `failed`:

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

HTTP 401, `refused` (`invalid_token`):

```json
{
  "error": "invalid_token",
  "error_description": "connection token not allowed"
}
```

The token's connection_token is not on the worker's list.

HTTP 400, `refused` (`invalid_request`):

```json
{
  "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: https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/authorize

Request:

```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=...",
  "credential_id": "cred_7Qk...",
  "digests": [
    {
      "value": "n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=",
      "hash_algorithm_oid": "2.16.840.1.101.3.4.2.1",
      "label": "Service Agreement"
    }
  ]
}
```

Responses:

HTTP 200, `completed`:

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

HTTP 200, `pending`:

```json
{
  "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 200, `failed`:

```json
{
  "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 401, `refused` (`invalid_token`):

```json
{
  "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: https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/sign

Request:

```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=...",
  "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"
}
```

Responses:

HTTP 200, `completed` (raw):

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

HTTP 200, `completed` (cms):

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

HTTP 200, `failed`:

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

HTTP 400, `refused` (`invalid_request`):

```json
{
  "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: https://signatureapi.com/docs/qualified-signatures/signing-worker-protocol/pending-steps

Callback:

```text
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 200, `pending`:

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

HTTP 200, `failed`:

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