Before you begin
- Store your API key in the
SAJN_API_KEYenvironment variable. To create a key, go to workspace settings in the sajn app, then Utvecklare (Developer) > API-nycklar (API keys). - Have a document. For more information, see Create a document.
How reminders and expiration work
expiresAtis the signing deadline. If you don’t set it, the document gets the workspace’s default expiration, if the workspace has one.documentMeta.reminderIntervalDaysis the number of days between automatic reminders, as an integer.nulluses the default of 3 days, and0turns off the recurring reminders. The sajn app offers1,2,3, and5.- Automatic reminders need a deadline. A document without
expiresAtgets no automatic reminders. - Each party’s first reminder comes
reminderIntervalDaysdays after the party is invited. In a sequential document, that’s when it becomes the party’s turn. If the deadline is more than 90 days away, the reminders start 90 days before it. - A final reminder goes out the day before the deadline. It’s sent even when
reminderIntervalDaysis0. - A party gets at most five recurring reminders. Reminders stop when the party signs, when an address bounces, and at the deadline.
- Automatic reminders go out between 08:00 and 10:00 Swedish time.
Set the deadline and the reminders
1
Set them when you create the document
Send Replace
expiresAt and documentMeta.reminderIntervalDays in the create request:TEMPLATE_ID with the ID of a template. The response is the document, with the deadline in expiresAt and the interval in documentMeta.reminderIntervalDays.expiresAt is an ISO 8601 date-time. Without an offset, it’s UTC.2
Change them on a draft
To change the deadline or the interval before you send, send a Replace
PATCH request:DOCUMENT_ID with the document ID. You can also change reminderIntervalDays after sending, until the document is completed. sajn reschedules the reminders of every party who can still be reminded.Remind parties on demand
To remind parties who haven’t signed, send aPOST request to /api/v1/documents/DOCUMENT_ID/reminders. Without a body, every eligible party is reminded. To remind specific parties, list them in partyIds:
DOCUMENT_ID: the ID of aPENDINGdocument.PARTY_ID: the ID of a party who hasn’t signed.
status is SENT, SKIPPED, or FAILED. A party can get one reminder per 24 hours, so a second reminder within that window is SKIPPED with a reason. A skipped party doesn’t fail the request.
Each reminder goes out on the party’s delivery method. To choose the channel, set channel to EMAIL or SMS. A party without an address for the channel is skipped with the reason MISSING_EMAIL or MISSING_PHONE. SMS reminders are billed like SMS invitations.
Move the deadline of a sent document
To change the deadline of aPENDING or EXPIRED document, send a POST request to /api/v1/documents/DOCUMENT_ID/extend-expiration:
expiresAt, records the change in the audit log, and emails every party who can still be notified that the deadline moved. An EXPIRED document returns to PENDING. The response is the document, and the request needs the EDIT_DOCUMENT workspace permission.
What happens at the deadline
When the deadline passes, the document’s status changes fromPENDING to EXPIRED, parties can no longer sign, and the document.expired webhook event fires.
To keep a document signable after its deadline, set documentMeta.signableAfterExpired to true. The document then stays PENDING, and document.expired still fires. Automatic reminders stop at the deadline either way.
To react to an expired document, handle the document.expired event. Its data.object is the document, so you can find the parties who didn’t sign:
Handle errors
400 VALIDATION_FAILEDonextend-expiration: the new date is less than 24 hours away, or the document isn’tPENDINGorEXPIRED. For aDRAFT, usePATCHinstead.403 PERMISSION_DENIEDonextend-expiration: you lack theEDIT_DOCUMENTpermission.
Next steps
Multi-party signing
Keep a signing sequence moving.
Webhooks
Get notified when a document expires.
Send reminders
See the reminders endpoint in the API reference.
Change the expiration date
See the expiration endpoint in the API reference.

