Endpoints#
The endpoints are the machine-readable HTTP interfaces of the SurveyJS integration: JSON APIs, submission handling, downloads and management actions. User-facing pages are documented separately in Views.
Conventions#
- URL pattern
Endpoints live on the survey object unless noted otherwise:
https://example.org/demo/my-survey/@@<endpoint-name>Site-root endpoints (
@@forms-settings,@@ai-test,@@llm-models,@@survey-monitor) are called on the site root.- HTTP methods
Mutating endpoints are invoked with POST, read-only endpoints with GET. Parameters are sent as form data (
application/x-www-form-urlencoded) or as JSON body, as noted per endpoint.- Permissions
zope2.View— publicly callable (subject to the survey’s access mode and authenticity-token settings).cmf.ModifyPortalContent— requires the Editor role or Manager.cmf.ManagePortal— requires the Manager role.
- JSON responses
Successful endpoints answer with JSON, usually
{"isSuccess": true}or a data object. Errors use a JSON body witherrorand optionalmessagefields plus a matching HTTP status:{"isSuccess": false, "error": "invalid_json", "message": "..."}- Survey access protection
Public submission endpoints (
@@save-poll,@@get-form-json) enforce the survey’s configuration:Access mode: for
trusted/trusted-tokenssurveys, a valid token must be supplied asaccess_token(query/form) ortt(form) parameter, unless the caller has thecmf.ModifyPortalContentpermission.Authenticity token: when enabled globally (default), submissions must carry the token issued by
@@viewerin theauth_tokenform field. Direct DOM embed submissions bypass both checks when they present a validOriginheader andX-Embed-Token.
Submission & form API#
@@get-form-jsonGET ·
zope2.View· returns the latest form schema as JSON — the data the SurveyJS renderer needs. Enforces the access mode (see above).Example:
curl "https://example.org/demo/my-survey/@@get-form-json"@@save-pollPOST ·
zope2.View· stores a survey submission. The form fieldpollResultcarries the submission payload as a JSON string. Enforces access mode, authenticity token (auth_tokenfield) and, when enabled, the external server-side validation.Example:
curl -X POST "https://example.org/demo/my-survey/@@save-poll" \ --data-urlencode 'auth_token=…' \ --data-urlencode 'pollResult={"question1":"answer"}'
Errors
400—missing_poll_result,invalid_payload,invalid_json,missing_form_schema403—invalid_origin,invalid_token,token_already_used,feature_disabled(direct embed only)413—request_too_large/json_too_large(payload exceeds the survey’s “Max size payload” setting)
Success response:
{"isSuccess": true}; when thestoreaction is disabled the response additionally containsstored: false.@@save-form-jsonPOST ·
zope2.View· saves the form JSON from the visual editor. Form fieldsurveyTextcarries the complete SurveyJS form schema as a JSON string. Creates a new (unlocked) form version. Response:{"isSuccess": true}.
Results API#
@@get-polls-jsonGET ·
cmf.ModifyPortalContent· all stored submissions, each with metadata (poll_id,created,user,form_version) and the result payload.@@get-polls-json2GET ·
cmf.ModifyPortalContent· like@@get-polls-json, but returns only the submission payloads (without metadata).@@view-result-jsonGET ·
cmf.ModifyPortalContent· JSON of a single submission. Parameter:poll_id. Returns{"error": "Poll result not found"}for unknown ids.@@results-dataGET ·
cmf.ModifyPortalContent· paginated, filterable results payload for the results table UI (Tabulator).@@delete-resultsPOST ·
cmf.ModifyPortalContent(Manager-only check inside) · deletes one or more submissions. Accepts a JSON body{"poll_ids": [...]}or the form fieldspoll_id/poll_ids. Response: the deletion result as JSON.@@clear-resultsPOST ·
cmf.ModifyPortalContent· clears all stored submissions of the survey, then redirects to the survey view.
Download endpoints#
All download endpoints answer with a Content-Disposition: attachment
header and a descriptive filename.
@@download-form-jsonGET ·
cmf.ModifyPortalContent· current form schema as<id>-survey-form.json.@@download-polls-jsonGET ·
cmf.ModifyPortalContent· all submissions (with metadata) as<id>-survey-data.json. Optional date-range filtersfrom/to(flexible date parsing, e.g.2026-08-01).@@download-polls-csvGET ·
cmf.ModifyPortalContent· all submissions as CSV (samefrom/todate filters). Columns:poll_id,user,created,form_versionfollowed by one column per discovered answer field.@@download-resultGET ·
cmf.ModifyPortalContent· a single submission in a selected export format. Parameters:poll_idandformat(text,md,html,pdf,csv,xlsx,xml,docx,json).@@mail-resultPOST ·
cmf.ModifyPortalContent· e-mails a single submission in the selected format. Parameters:poll_idandformat.@@post-resultPOST ·
cmf.ModifyPortalContent· forwards a single submission to the survey’s configured POST endpoint. Parameter:poll_id.
Form version API#
Form versions are snapshots of the survey schema; the latest version is the
active form. All endpoints require cmf.ModifyPortalContent.
@@view-version-jsonGET · JSON of a specific version. Parameter:
version_id.@@download-versionGET · download a specific version as
survey-form-<id8>.json. Parameter:version_id.@@upload-versionPOST · imports a JSON file as a new version. File field:
json_file. Redirects to@@form-versions.@@restore-versionPOST · creates a new version from the content of an older version (the old version itself is preserved). Parameter:
version_id. Redirects to@@form-versions.@@toggle-version-lockPOST · toggles the locked state of a version (locked versions cannot be edited). Parameter:
version_id. Redirects to@@form-versions.@@delete-versionPOST · deletes a version. Parameter:
version_id. Redirects to@@form-versions.@@create-template-from-versionPOST · creates a survey template from a version. Parameter:
version_id.
AI generator API#
All AI endpoints require cmf.ModifyPortalContent. They operate on the
survey’s temporary form storage (the AI working copy), which is a
separate buffer next to the version history.
@@ai-uploadPOST · converts an uploaded document into a form draft. File field:
document_file(e.g. a PDF). Stores the draft in the temp storage and redirects to@@ai.@@ai-store-temp-versionPOST · promotes the temp form draft to a real form version. Redirects to
@@ai.@@ai-copy-latest-to-tempPOST · copies the latest form version into the temp storage (starting point for AI edits). Redirects to
@@ai.@@ai-clear-temp-storagePOST · discards the temp form draft and its history. Redirects to
@@ai.@@ai-chat-refinePOST · chat-based refinement of the temp form. Form field:
chat_prompt(the instruction). The result replaces the temp draft; redirects to@@ai.@@ai-restore-history-stepPOST · restores a previous temp-draft state. Parameter:
history_index(0-based). Redirects to@@ai.@@ai-delete-history-stepPOST · deletes a temp-draft history entry. Parameter:
history_index. Redirects to@@ai.@@ai-testPOST · site root ·
cmf.ManagePortal· connection test for the configured AI provider (used by the forms-settings AI panels). Sends a small probe request to the configured model and returns the result as JSON.
Chatbot API#
@@chat-apiPOST ·
cmf.ModifyPortalContent· the chatbot conversation endpoint. Accepts a JSON body with the keysmessage,current_view,survey_title,user_role,stream,history,survey_json,top_k(form-encoded keys also accepted). Returns the chatbot answer as JSON;stream: trueenables streaming.@@chatbot-statsGET ·
cmf.ModifyPortalContent· chatbot usage statistics.@@chatbot-mgmtPOST ·
cmf.ManagePortal· chatbot management actions.@@chatbot-index-localPOST ·
cmf.ManagePortal· (re)builds the local documentation index used by the chatbot.@@chatbot-index-remotePOST ·
cmf.ManagePortal· fetches the remote documentation and rebuilds the index.@@chatbot-resetPOST ·
cmf.ManagePortal· resets the chatbot state/index.
Fillable PDF API#
@@fillable-pdf-uploadPOST ·
cmf.ModifyPortalContent· stores a fillable PDF template. File field:pdf_file. Redirects to@@fillable-pdf.@@fillable-pdf-downloadGET ·
cmf.ModifyPortalContent· downloads the stored PDF template.@@fillable-pdf-deletePOST ·
cmf.ModifyPortalContent· removes the PDF template. Redirects to@@fillable-pdf.@@fillable-pdf-fillPOST ·
zope2.View· fills the PDF template with submitted form data (request form fields) and returns the filled PDF as a download. Requires PyMuPDF; returns an error message when no template is configured.
Access tokens#
@@trusted-access-tokenPOST ·
cmf.ModifyPortalContent· issues a trusted access token for this survey. Response:{ "isSuccess": true, "token": "…", "url": "https://example.org/demo/my-survey/@@viewer?access_token=…", "expires_at": "…" }
The token is bound to the current form version and expires after the survey’s “Trusted access token TTL” setting. Single-use tokens (
trusted-tokensaccess mode) are consumed by the first successful submission.
Direct DOM embedding API#
@@embed-configGET ·
zope2.View· public configuration JSON for the embed loader (used by external pages to obtain an embed token).@@embed-tokenPOST ·
cmf.ModifyPortalContent· issues a short-lived embed token for a specific origin. The token is single-use for submissions (replay is rejected) and expires after the survey’s “Embed token TTL”.@@embed-loaderGET ·
zope2.View· the JavaScript loader that external pages include to embed the survey via Direct DOM.@@embed-surveyjsGET ·
zope2.View(any context) · serves the SurveyJS assets for embedded surveys.
Template endpoints#
@@get-template-jsonGET ·
zope2.View· returns the form JSON of a survey template (called on the template object). Used to start a new survey from a template.