Skip to content

Headless API

For frontends that are not Twig (Next.js, Nuxt, apps). All three endpoints are public, under /pimkit/forms/api. The typed client @pimkit/forms-client (in clients/forms-client/) wraps them.

Method + path Answer
GET /forms/{name}?locale=de The published form in one language, see below. 404 when unknown, unpublished or archived. Cache: public, 60 s
GET /token?form={name} {token, issuedAt}. Get it when the form is shown
POST /forms/{name}/submit JSON or multipart/form-data. 201 {uuid, successMode, message, redirect} or 422 {errors, formErrors}
{
"name": "contact", "version": 3, "locale": "de", "submitLabel": "Senden",
"submitUrl": "/pimkit/forms/api/forms/contact/submit",
"tokenUrl": "/pimkit/forms/api/token?form=contact",
"fieldNames": {"token": "_pk_token", "locale": "_pk_locale", "honeypot": "_pk_website"},
"timeTrapSeconds": 3,
"captcha": null,
"rows": [["first_name", "email"], ["message"]],
"fields": [
{"name": "first_name", "type": "text", "label": "Vorname", "placeholder": "", "help": "",
"required": true, "width": "half", "attributes": {"maxlength": 80}, "conditions": []}
]
}
  • Labels, help texts and choices are in the asked language. Choice fields have choices: [{value, label}], html and consent fields have sanitized html, hidden fields their value.
  • attributes are the HTML5 checks the site also uses (maxlength, min, pattern, accept, …).
  • conditions use the same rules as the Logic tab. The client’s fieldStates() evaluates them.
  • Never in the answer: actions, webhook URLs, secrets, retention and other server settings.
  • captcha: {provider, siteKey, field} when the form uses one and keys are set. Render the provider’s widget and send its answer in field (or the X-PimKit-Captcha header).

Send the values by field name plus _pk_token, _pk_locale and an empty _pk_website. Answers sent within timeTrapSeconds of the token’s issuedAt count as a bot and get a fake success. Files need multipart/form-data.

Cross-origin frontends need CORS for /pimkit/forms/api/* on the Pimcore side, for example with nelmio/cors-bundle.

Code: Controller\Frontend\HeadlessController, Controller\Frontend\SubmitController.