Skip to content

Build and publish forms from your own system

Forms can be built and published from your own system as well as from the app. Use the Forms Management API when a pipeline should create forms from a template, when a script should keep a form in step with another system, or when an agent is asked to work in Forms. A form’s content is a document, so the API is built for the two things that go wrong when something else writes it: overwriting a person’s edit without anyone noticing, and changing a form that the public is looking at.

To render a form in an application, or to submit one, use @ebitex/forms-sdk and the public submit URL instead. The management API has no submit route, and a management key is never for a browser.

In the Forms app, open Settings and Management keys, and make a key. You choose three things.

A role. The key acts as this role: what it can do is its access level and the role’s permissions together, and it sees only the forms the role may see, exactly as a person with that role would. A role that can administer form access (the Owner role always can) is refused, because that permission skips every form access rule.

An access level, each including the one below:

Level Can
Read Read forms, their versions, the shared fields, steps and choice lists, and themes
Write Everything Read can, and create forms, change forms that are still drafts, restore an earlier version of a draft, and change a theme
Publish Everything Write can, and publish, unpublish and archive a form, change a form that is already live, and change the shared library

Extras, which no level includes: read submissions (respondents’ personal data), attach handlers (existing plugin instances, so future submissions go there) and delete (a form, which also deletes its submissions, or a single submission).

You can only make a key you could use yourself: you need the permission to manage keys, every permission the key would carry, and every permission of the role you choose. A key is shown once, when you make it, and only the Forms app makes this kind of key. It may make 300 requests a minute; a request over the limit answers 429 rate_limited with Retry-After. Send the key as a bearer token to /forms/management/v1.

Describe the calling key answers with the organization, the key’s scopes, the role it acts as and the permissions it effectively holds:

Terminal window
curl https://api.ebitex.io/forms/management/v1/whoami \
-H "Authorization: Bearer $EBITEX_FORMS_MANAGEMENT_KEY"
{
"organizationId": "…",
"organizationName": "Acme",
"organizationSlug": "acme",
"keyId": "…",
"keyName": "Form builder agent",
"scopes": ["forms.management.read", "forms.management.write"],
"roleId": "…",
"roleName": "Forms builder",
"permissions": ["forms.versions.restore", "forms.versions.view"],
"note": "This key acts as the role above, limited to what its scopes admit. Forms that the role's access rules deny are not visible to this key."
}

Describe the grammar of a form lists the node types, field types and step types a form may contain, each with its properties, which are required and the values of an enum. It is the authority for the shape of a form, so read it instead of guessing member names. A write is checked as the app checks it, and a refusal names the failing member.

Create or replace a form by its external id is the call a pipeline uses. The externalId is the form’s public address; send the whole form:

Terminal window
curl -X PUT https://api.ebitex.io/forms/management/v1/forms/by-external-id/contact-us \
-H "Authorization: Bearer $EBITEX_FORMS_MANAGEMENT_KEY" \
-H "Content-Type: application/json" \
-d '{
"externalId": "contact-us",
"name": "Contact us",
"actions": [{ "nodeType": "Field", "fieldType": "Button", "label": "Send", "buttonType": "Submit" }],
"steps": [{
"stepType": "Inline",
"label": "Your message",
"nodes": [{ "nodeType": "Field", "fieldType": "Input", "name": "email", "label": "Email", "required": true, "variant": "Email" }]
}]
}'

The member names are the ones the grammar lists: an Inline step has a label and nodes, and the Submit button is a Button field in the form’s own actions, not in a step. Read the grammar before writing a body of your own.

It creates a draft when no form has that id, so it is safe to repeat. When the form exists it replaces it, and then it needs the rowVersion you got when you last read the form: without one the answer is 428 row_version_required, and a stale one is 409 concurrency_conflict with nothing written. Read the form again, look at what changed, then decide.

A form has one content and no draft copy. So changing the content of a form that is Active or Archived changes what the public sees, and needs the Publish level; a key with Write can only work on drafts. The same applies to restoring a version and to attaching handlers. A form’s externalId is part of its public address (the submit URL), so it can change while the form is a draft and never afterwards: 409 external_id_locked.

Publish, unpublish or archive a form sets the status. Activating a form that cannot render (no steps, or no Submit button) is 409 not_eligible_for_publishing with the reasons. The answer carries what you need to put the form in front of people:

{
"id": "…", "externalId": "contact-us", "status": "Active",
"publicUrls": {
"submit": "https://api.ebitex.io/forms/v1/public/forms/acme/contact-us/submissions",
"sdkIdentifiers": { "organizationSlug": "acme", "formExternalId": "contact-us" }
}
}

Hand sdkIdentifiers to @ebitex/forms-sdk; a respondent’s browser posts to submit. Archive a form to retire it.

List a form’s versions, get one, compare two and restore one. A restore is a write like any other: it needs the form’s rowVersion, and on a form that is not a draft the Publish level.

  • Submissions need their own scope, and only for the forms the role can see. They are personal data. You can list and read them; you cannot create, edit or export one.
  • Handlers. List plugin instances returns references only (never an instance’s configuration or a secret), and replacing a form’s handlers attaches instances a person already set up. Future submissions are sent to them; earlier ones are not replayed. Every change is recorded against the key.
  • Delete. Delete a form also deletes every submission it received, and the answer says how many; it cannot be undone. A key cannot delete a library item, an instance or an access rule.

Submit a form, edit or create a submission, export submissions, change who may see a form, create or change a plugin instance, re-send a delivery, or make keys. Those are decisions for a person in the app.

The @ebitex/mcp server has a Forms module that uses these routes: set EBITEX_FORMS_MANAGEMENT_KEY, and the tools offered are the ones the key’s scopes admit.