POST
/smart-forms/:id/unpublishUnpublish Smart Form
Stop accepting new sessions on a published smart form
Scope: SMART_FORMS_WRITE
Overview
Stops new sessions from being started on a published smart form. Supports two modes: soft (blocks new sessions but keeps the form published) and hard (reverts to DRAFT, expires all active sessions, and refunds reserved credits).
Request
POST
/smart-forms/:id/unpublishHeaders
| Header | Value |
|---|---|
Authorization | Bearer fxk_live_<your-api-key> |
Content-Type | application/json |
Path Parameters
Request Body
Unpublish Modes
| Mode | Effect |
|---|---|
soft | Sets allowNewSessions = false. The form remains PUBLISHED — existing active sessions continue. No session expiration or credit refunds. |
hard | Sets publishStatus = DRAFT and allowNewSessions = false. Immediately expires all active sessions and refunds any reserved credits. |
Hard Mode is Destructive
The hard mode expires all in-progress sessions permanently. Respondents who are mid-interview will lose their progress and will not be able to continue.
Example Request
curl -X POST "https://api.formfex.com/api/v1/public/smart-forms/SMART_FORM_ID/unpublish" \
-H "Authorization: Bearer $FORMFEX_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "mode": "soft" }'Response
Error Cases
| Status | Description |
|---|---|
400 | Form is not in PUBLISHED status, or mode is not soft or hard |
401 | Invalid or missing API key |
404 | Smart form not found or not owned by this API key |
n8n
In n8n, this operation is available as Unpublish under the Smart Form resource in the Formfex node.