Skip to Content
Documents

Send several documents as a bundle

Group draft documents into a bundle, so each party gets one invitation and signs all of their documents with one signature

In this guide, you send several draft documents as one bundle. Each party gets one invitation and signs all of their documents with one signature. Every document keeps its own signature, seal, audit trail, and certificate, so you still get one sealed PDF per document.

A bundle fits when the documents belong together, such as an employment contract and an NDA for a new hire. To send the same template to many people, one document each, see Bulk-create documents from a template instead.

Before you begin

  • Store your API key in the SAJN_API_KEY environment variable. To create a key, go to workspace settings in the sajn app, then Utvecklare (Developer) > API-nycklar (API keys).
  • Use API version 2026-10 or later. Bundles require a Team plan or higher.
  • Have 2 to 100 DRAFT documents with content that aren't in another bundle. For more information, see Create a document.
  • Give every party an email address. A bundle matches parties across documents by email address.

Who owns what

The bundle owns who signs and how the send behaves. It writes its parties and its send settings onto every document in it: subject, message, expiresAt, signingMode, language, reminderIntervalDays, internalRecipients, openVerification, and the redirect. Each document keeps its own content, fields, and document-level settings.

To change a setting the bundle owns, change the bundle. A change to the document itself fails with 409 BUNDLE_OWNS_SETTING.

A field with the same key and kind in several documents is one field for the party. The party's answer in one document fills in the same field in the others, and each document signs its own values. For more information, see Fields.

Send the bundle

Create the bundle

Send a POST request to /api/v1/bundles with the drafts in documentIds. The parties on the drafts become the bundle's parties, one per email address. To set the parties yourself, also pass parties:

curl -X POST https://app.sajn.se/api/v1/bundles \
  -H "Authorization: Bearer $SAJN_API_KEY" \
  -H "Sajn-Version: 2026-10" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: bundle-hr-2026-0142" \
  -d '{
    "name": "Onboarding - Kai Lindqvist",
    "message": "Hi Kai, here are your employment contract and the NDA. Sign both with BankID.",
    "expiresAt": "2026-12-15T22:00:00.000Z",
    "documentIds": ["CONTRACT_ID", "NDA_ID"],
    "parties": [
      {
        "name": "Kai Lindqvist",
        "email": "kai@example.com",
        "signatureMethod": "SE_BANKID"
      }
    ]
  }'

Replace CONTRACT_ID and NDA_ID with the IDs of your drafts. The response is 201 Created with the bundle, in the same shape as Get a bundle. Its status is DRAFT. Save the bundle id for the next steps.

When you pass parties, they replace the parties the documents brought. A party whose email address a document already had keeps that document's fields. A document without parties gets every bundle party.

To add drafts later, send a POST request to /api/v1/bundles/BUNDLE_ID/documents with documentIds. To take one out, send a DELETE request to /api/v1/bundles/BUNDLE_ID/documents/DOCUMENT_ID. The document stays a DRAFT.

Optional: Choose which documents each party is on

By default, every party is on every document. To put a party on some of the documents only, set the parties with a PUT request to /api/v1/bundles/BUNDLE_ID/parties, and list the documents in the party's documentIds:

curl -X PUT https://app.sajn.se/api/v1/bundles/BUNDLE_ID/parties \
  -H "Authorization: Bearer $SAJN_API_KEY" \
  -H "Sajn-Version: 2026-10" \
  -H "Content-Type: application/json" \
  -d '{
    "parties": [
      {
        "name": "Kai Lindqvist",
        "email": "kai@example.com",
        "signatureMethod": "SE_BANKID"
      },
      {
        "name": "Alex Berg",
        "email": "alex@example.com",
        "signatureMethod": "SE_BANKID",
        "documentIds": ["CONTRACT_ID"]
      }
    ]
  }'

The request replaces every party, so include all of them. A party you leave out is removed from every document, along with the signature boxes assigned to it. With "signingMode": "SEQUENTIAL" on the bundle, the parties sign in the order of signingOrder, and that order runs across every document in the bundle. Without signingOrder, a party's step is its position in parties.

To change the send settings, such as message or reminderIntervalDays, send a PATCH request to /api/v1/bundles/BUNDLE_ID. A setting you leave out keeps its value.

Send the bundle

Send a POST request to /api/v1/bundles/BUNDLE_ID/send:

curl -X POST https://app.sajn.se/api/v1/bundles/BUNDLE_ID/send \
  -H "Authorization: Bearer $SAJN_API_KEY" \
  -H "Sajn-Version: 2026-10" \
  -H "Idempotency-Key: send-bundle-hr-2026-0142"

sajn checks every document first. If one document fails a check, sajn sends none of them and returns 409 INVALID_STATE with the reasons in userMessage. For example, a document has a missing signature box, needs approval, or has a party without an email address.

The response is the bundle, with status OPEN. Each party gets one invitation once the PDF of every document is ready, and the bundle fires bundle.sent. Every document in the bundle counts as a sent document.

Share signing links for parties you reach yourself

A party with "delivery": [] gets no invitation. To show the signing page in your app or send the link yourself, get the party's signingUrl. Use the bundle party id from the bundle's parties:

curl https://app.sajn.se/api/v1/bundles/BUNDLE_ID/parties/PARTY_ID \
  -H "Authorization: Bearer $SAJN_API_KEY" \
  -H "Sajn-Version: 2026-10"

The response is the party, including its signingUrl. The following example leaves out some party fields:

{
  "id": "cm4k2x9p10004abcd1234efgh",
  "bundleId": "cm4k2x9p10044abcd1234efgh",
  "name": "Kai Lindqvist",
  "email": "kai@example.com",
  "role": "SIGNER",
  "delivery": [],
  "status": "PENDING",
  "documentIds": ["cm4k2x9p10003abcd1234efgh", "cm4k2x9p10022abcd1234efgh"],
  "signingUrl": "https://app.sajn.se/sign/cm4k2x9p10003abcd1234efgh?token=Xk9mQ2vR7tLp4wZs8nYb3"
}

The URL opens every document the party signs in the bundle. It works without a login, so treat it as a secret. Each request writes an audit entry on every document the party signs, so fetch the URL only when you're about to use it. A DRAFT bundle has no signing URLs yet and returns 409 INVALID_STATE.

Track progress

Track progress with webhooks, not by polling the bundle. Subscribe to the bundle events:

  • bundle.sent fires when sajn sends the invitations.
  • bundle.party.signed fires once per person, when the person has nothing left to sign in the bundle. data.documentIds lists the documents the person signed.
  • bundle.completed fires when no party has a signature left to give on any document. A bundle with a rejected document completes too.
  • bundle.cancelled fires when a sender cancels the bundle.

Each document also fires its own document.* events. For the payloads, see Webhook events and the reference page for each event, such as bundle.completed.

To read the state once, get the bundle:

curl https://app.sajn.se/api/v1/bundles/BUNDLE_ID \
  -H "Authorization: Bearer $SAJN_API_KEY" \
  -H "Sajn-Version: 2026-10"

The bundle's status is OPEN until every document is resolved, and then COMPLETED. Each bundle party has a status of PENDING, SIGNED when the party has signed every one of its documents, or REJECTED when it rejected any of them. Each document in documents lists its parties with their signingStatus. A document party's bundlePartyId points to the bundle party.

Download the sealed PDFs

sajn seals each document separately. bundle.completed can fire before every document is sealed, so download each document's PDF on its own document.completed event.

To list the documents in a bundle with their full details, call GET /api/v1/documents?bundleId=BUNDLE_ID. Then get each sealed PDF with the SIGNED file type:

curl https://app.sajn.se/api/v1/documents/DOCUMENT_ID/files/SIGNED \
  -H "Authorization: Bearer $SAJN_API_KEY" \
  -H "Sajn-Version: 2026-10"

For the response and the other file types, see Download documents.

Correct a party's email address or phone number

To fix a typo after the send, send a PATCH request to /api/v1/bundles/BUNDLE_ID/parties/PARTY_ID with the new email, phone, or both:

curl -X PATCH https://app.sajn.se/api/v1/bundles/BUNDLE_ID/parties/PARTY_ID \
  -H "Authorization: Bearer $SAJN_API_KEY" \
  -H "Sajn-Version: 2026-10" \
  -H "Content-Type: application/json" \
  -d '{ "email": "kai.lindqvist@example.com" }'

sajn updates the party on every document it hasn't signed yet and sends a new invitation. A new email address gets a new link, and the old link stops working. This change is the only one a sent bundle accepts.

Withdraw or cancel a sent bundle

  • To change a sent bundle, withdraw it with a POST request to /api/v1/bundles/BUNDLE_ID/withdraw. The optional reason goes in the email to the parties. The bundle and every document return to DRAFT, and every signature is cleared. Make your changes, and then send the bundle again. A bundle with a completed document can't be withdrawn.
  • To stop a bundle for good, cancel it with a POST request to /api/v1/bundles/BUNDLE_ID/cancel. Every unsigned document returns to DRAFT and leaves the bundle. Signed documents stay signed. When every unsigned document was withdrawn, the bundle's status is CANCELED and bundle.cancelled fires.

Handle errors

Branch on the error code:

  • 409 INVALID_STATE: the bundle or a document isn't in a state that allows the request. On a send, userMessage lists what stops each document. When you add a document, it also means one email address has a different signing method, verification, role, or personal number than in the bundle, or the document's signing mode or party order differs from the bundle's.
  • 409 BUNDLE_OWNS_SETTING: you changed a setting on a document that its bundle owns. Change the bundle instead.
  • 403 LIMIT_EXCEEDED: the organization reached its limit of sends per hour. Every document in the bundle counts toward the limit, so a large bundle can hit it at once. Wait, and then send again.

For the error shape and the full list of codes, see Errors.

Next steps

Send a document for signing

Send a single document to its parties.

Multi-party signing

Control the signing order and the role of each party.

Webhook events

See every event and when it fires.

Create a bundle

See the bundle endpoints in the API reference.

Was this page helpful?

Last updated on