Skip to Content
Forms

Publish a form

POST
/api/v1/forms/{id}/publish

Validate readiness and publish or reopen the form. The authenticated user becomes the sender of future documents and must be allowed to create and send documents without approval. Plan, signing methods, expiry and capacity are checked. Requires forms:write and documents:write.

Authorization

headerAuthorizationBearer <token>

API key, e.g. Authorization: Bearer sajn_svc_.... Not scope-limited: acts with its owner's workspace role.

Path Parameters

id*string

The form ID.

Header Parameters

Sajn-Version?string

API version for this request. Without it, the request uses the organization's default version; an organization without a default is pinned to the latest version by its first request.

Value in"2026-09""2026-10"
Sajn-Workspace?string

ID of the workspace this request acts in, from GET /api/v1/workspaces. Without it, an API key acts in its default workspace. The token's user must be a member of the workspace; an OAuth token only accepts the workspace it was granted for. A workspace that doesn't exist or can't be reached returns 403 WORKSPACE_ACCESS_DENIED.

Idempotency-Key?string

Makes retries safe. A retry with the same key and the same request replays the stored response for 24 hours (header Idempotent-Replayed: true); the same key with a different request returns 400.

Lengthlength <= 255

Response Body

200

application/json
  1. response
id*string

The form ID.

templateId*string

The ID of the template the form owns. Its documents are created from it.

workspaceId*string

The workspace ID.

sender*

The member every document from the form is created and sent as.

respondentPartyId*|

The ID of the template party the respondent becomes. Null on a draft without one.

url*string

The public form link.

enabled*boolean

True if the form is published.

closedReason*|

Why a published form stopped accepting submissions. Null while it's open.

Value in"INCOMPLETE""MAX_SUBMISSIONS""EXPIRED""SENDER_LEFT"null
hasPassword*boolean

True if the link requires a password.

name*|

Name of the form, shown as the heading of the public form page.

description*|

Introduction shown under the heading.

thankYouMessage*|

Message shown after the respondent submits.

redirectUrl*|

URL the respondent goes to after submitting.

documentExpiresInDays*number

Days each document created from a submission stays signable.

expiresAt*|

When the form closes to new submissions. Null keeps it open.

Formatdate-time
maxSubmissions*|

Most submissions the form accepts. Null means no limit.

submissionCount*number

Active starts plus submitted responses, counted against maxSubmissions.

createdAt*string

When the form was created.

Formatdate-time
updatedAt*string

When the form was last updated.

Formatdate-time
questions*array<||||||>
Itemsitems <= 60
slots*array<>

The keyed FORM subfields of the form's document that a FIELD question can fill.

publishIssues*array<>

What stops the form from publishing (BLOCKER) or deserves a look (WARNING). Empty when the form is ready.

statistics*
Example Request
curl -X POST 'https://app.sajn.se/api/v1/forms/cm4k2x9p10023abcd1234efgh/publish'
Example Response
{  "id": "cm4k2x9p10023abcd1234efgh",  "templateId": "cm4k2x9p10008abcd1234efgh",  "workspaceId": "cm4k2x9p10001abcd1234efgh",  "sender": {    "id": "cm4k2x9p10002abcd1234efgh",    "email": "alex@example.com",    "name": "Alex Berg"  },  "respondentPartyId": "cm4k2x9p10035abcd1234efgh",  "url": "https://app.sajn.se/f/Xk9mQ2vR7tLp4wZs8nYb3",  "enabled": true,  "closedReason": null,  "hasPassword": false,  "name": "Intresseanmälan",  "description": "Anmäl ditt intresse för en tjänst hos Exempelbolaget AB.",  "thankYouMessage": "Tack! Vi återkommer inom två arbetsdagar.",  "redirectUrl": null,  "documentExpiresInDays": 30,  "expiresAt": "2026-10-28T22:00:00.000Z",  "maxSubmissions": 100,  "submissionCount": 12,  "createdAt": "2026-09-28T09:12:00.000Z",  "updatedAt": "2026-09-28T09:15:00.000Z",  "questions": [    {      "id": "name",      "kind": "NAME",      "label": "Namn",      "required": true    },    {      "id": "email",      "kind": "EMAIL",      "label": "E-post",      "required": true    },    {      "id": "startdatum",      "kind": "FIELD",      "key": "startdatum",      "label": "Önskat startdatum",      "required": true    }  ],  "slots": [    {      "key": "startdatum",      "label": "Startdatum",      "type": "DATEPICKER",      "required": true,      "options": null    }  ],  "publishIssues": [],  "statistics": {    "started": 14,    "signed": 12  }}

Was this page helpful?