> For the complete documentation index, see [llms.txt](https://docs.premsoft.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.premsoft.de/en/plugins/form-toolkit/store-api.md).

# Store API

The Form Toolkit is fully headless-compatible. Every storefront feature — submission, confirmation logic, validation — is reachable through the Shopware Store API.

{% hint style="info" %}
This page is aimed at developers building their own front-ends, mobile apps or integrating third-party systems.
{% endhint %}

## Base URL & headers

| Header             | Value                                                                           |
| ------------------ | ------------------------------------------------------------------------------- |
| `Content-Type`     | `multipart/form-data` (with file upload) or `application/x-www-form-urlencoded` |
| `sw-access-key`    | Storefront access key of the sales channel                                      |
| `sw-language-id`   | Optional, language UUID-hex                                                     |
| `sw-context-token` | Optional, for logged-in customers                                               |

Base URL: `https://<shop>/store-api`

## Endpoint: submit form

```
POST /store-api/prems/form/submit
```

### Body fields

| Field                            |      Required      | Description                                               |
| -------------------------------- | :----------------: | --------------------------------------------------------- |
| `form_id`                        |         yes        | UUID of the form                                          |
| `<identifier>`                   |   per definition   | per form field the submitted value (key = technical name) |
| `<identifier>[]`                 |   per definition   | Checkbox groups send an array                             |
| `shopware_basic_captcha_confirm` | per captcha config | Basic Captcha response                                    |
| `g-recaptcha-response`           | per captcha config | reCAPTCHA token                                           |

Hidden inputs for the product inquiry:

| Field                    | Meaning         |
| ------------------------ | --------------- |
| `__prems_product_id`     | Product UUID    |
| `__prems_product_number` | Product number  |
| `__prems_product_name`   | Display name    |
| `__prems_product_price`  | Formatted price |
| `__prems_product_url`    | Canonical URL   |

### Response

On success (HTTP 200) the endpoint returns a JSON `FormSubmitRouteResponse` with the result:

```json
{
    "result": {
        "entryId": "01H...HEX",
        "responseType": "success-notice",
        "responseMessage": "Thank you! Your message has been submitted.",
        "redirectUrl": null,
        "redirectDelay": null
    }
}
```

On validation errors (HTTP 400) you receive a Shopware-standard `ConstraintViolationException`:

```json
{
    "errors": [
        {
            "code": "VIOLATION::IS_BLANK_ERROR",
            "status": "400",
            "title": "Constraint violation error",
            "detail": "This value should not be blank.",
            "source": { "pointer": "/firstName" },
            "meta": { "parameters": [] }
        }
    ]
}
```

On captcha failure (HTTP 403) Shopware Core returns a `CaptchaException`.

If the plugin is disabled (HTTP 403) or the form id is unknown (HTTP 404) a `FormSubmitException` is returned.

## Loading a form definition

To build your own front-end you need the form definition (fields, order, required flags, options). Load it via the DAL search endpoint:

```
POST /store-api/search/prems-form
```

Body:

```json
{
    "filter": [
        { "type": "equals", "field": "id", "value": "<formId>" },
        { "type": "equals", "field": "active", "value": true }
    ],
    "associations": {
        "fields": { "sort": [{ "field": "sortOrder" }] }
    }
}
```

The response contains the form with all fields, their translations and visibility conditions.

## Entity aliases

| Alias                          | Content                              |
| ------------------------------ | ------------------------------------ |
| `prems_form`                   | Form                                 |
| `prems_form_field`             | Single field / structure element     |
| `prems_form_field_translation` | Translatable properties per language |
| `prems_form_entry`             | Submission                           |
| `prems_form_mail_route`        | Mail route                           |

## Events (for custom backend extensions)

| Event                  | Class                                                       | Triggered                                          |
| ---------------------- | ----------------------------------------------------------- | -------------------------------------------------- |
| `prems_form.submitted` | `Prems\Plugin\PremsForm\Core\Event\PremsFormSubmittedEvent` | after a successful submission (Store API included) |

Hook into this event to trigger custom actions or forward data to external systems.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.premsoft.de/en/plugins/form-toolkit/store-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
