GET /api/websites/{website}/forms
Everything a content management system needs to place forms in its pages: the address of
the website's script, and the active forms linked to the website. This is what the
Rikochey WordPress plugin calls to list forms and generate their shortcodes, through
the PHP library — websites()->forms().
| Check | Value |
|---|---|
| Authentication | Authorization: Bearer …, or an Origin matching the website's host |
| Cache | none: the script address follows the website's serving domain |
curl https://api.example.com/api/websites/019f0000-0000-7000-8000-00000000000a/forms \
-H 'Authorization: Bearer 42|pQ7d…'
Response 200
{
"script_url": "https://api.example.com/api/script-019f0000-0000-7000-8000-00000000000a.js",
"data": [
{
"slug": "contact",
"name": "Contact form",
"css_selector": null,
"locale": "en",
"locales": ["en", "fr"],
"fields": [
{ "name": "name", "label": "Name", "type": "text", "is_required": true, "placeholder": null, "help_text": null },
{ "name": "email", "label": "Email", "type": "email", "is_required": true, "placeholder": "[email protected]", "help_text": "We never share your address." },
{ "name": "privacy", "label": "I accept the [privacy policy].", "type": "consent", "is_required": true, "placeholder": null, "help_text": null }
]
}
]
}
Forms are sorted by name. A form that is inactive, or not linked to this website, is not listed: the script would not handle it either.
| Field | Purpose |
|---|---|
script_url |
The tag to load on every page — see Embed the script |
slug |
The value of data-rikochey-form — see Automatic rendering or attached mode |
css_selector |
When set, the script already places the form at that selector: no tag is needed |
locale |
The form's source language: name and the field texts are written in it |
locales |
The languages the form offers, source first — the values worth passing in data-rikochey-lang; see Languages |
fields[].name |
The name attribute expected in attached mode |
fields[].type |
Among them consent, a single checkbox sent as 1 whose label keeps the square brackets around the link text; see What the script publishes |
fields[].placeholder |
The text shown in the empty field: the one set by the client, otherwise the label when it is hidden (followed by * for a required field); null when neither applies, and always for checkboxes, radio buttons, hidden and consent fields |
fields[].help_text |
The hint shown under the field, null when none |
Texts are in the source language only: the website's script loads each form already translated into the page's language — see How forms are loaded.
Errors
| Code | Body | Cause |
|---|---|---|
401 |
{"message": "Invalid or expired token."} |
Unknown or expired token |
403 |
{"message": "This token does not grant access to this website."} |
Token from another organization |
403 |
{"error": "origin_not_allowed"} |
Call without a token, from an origin foreign to the website |
404 |
{"message": "Website not found."} |
Unknown UUID |
403 |
{"message": "This website is disabled."} |
Website disabled by its owner |
API