GraphQL
To query forms, edit your GraphQL schema under GraphQL → Schemas and tick Query Basin forms in the Basin section.
Submissions aren’t available through GraphQL, because they contain personal data and GraphQL APIs are often public.
Queries
Section titled “Queries”{ basinForms { uuid name action } basinForm(uuid: "demo00quotes") { name action isStudioForm studioScriptUrl spamProtection { captcha siteKey scriptUrl recaptchaVersion honeypotField } }}basinForm returns null for a form that isn’t in the linked project, and the Control Panel warns you.
Basin Form fields
Section titled “Basin Form fields”A Basin Form field returns a BasinForm, or null:
{ entries(section: "pages") { ... on page_Entry { contactForm { uuid action } } }}This works whether or not the schema has Query Basin forms, because the form is part of the entry.
BasinForm
Section titled “BasinForm”| Field | Type | |
|---|---|---|
uuid |
String! |
The Basin ID. |
name |
String! |
|
action |
String! |
The endpoint URL to post to. |
useAjax |
Boolean! |
Whether Basin’s Enable AJAX setting is on, so the form always responds with JSON. |
redirectUrl |
String |
Where Basin sends visitors after submitting. |
isStudioForm |
Boolean! |
Whether a Form Studio embed code is saved. |
studioScriptUrl |
String |
The Form Studio embed script. Add it as <script src="…" async> where the form should appear. |
spamProtection |
BasinSpamProtection! |
What the page must include for Basin to accept submissions. |
BasinSpamProtection
Section titled “BasinSpamProtection”| Field | Type | |
|---|---|---|
captcha |
String |
recaptcha, hcaptcha, turnstile, or null. |
siteKey |
String |
The site key to render the CAPTCHA with. |
scriptUrl |
String |
The CAPTCHA provider’s script. |
recaptchaVersion |
String |
v3 or v2, for reCAPTCHA. |
honeypotField |
String! |
The name of the hidden honeypot input. Leave it empty. |
Rendering it yourself
Section titled “Rendering it yourself”- Honeypot: a text input named
honeypotField, hidden from people (e.g.style="display:none",tabindex="-1",autocomplete="off"), left empty. - reCAPTCHA v3: when the form is submitted, get a token with
grecaptcha.execute(siteKey, { action: 'submit' })and send it asg-recaptcha-response, plusg-recaptcha-versionset tov3.scriptUrlalready includes?render={siteKey}. - reCAPTCHA v2, hCaptcha, Turnstile: load
scriptUrland render the provider’s widget withsiteKeyinside the form. The widget adds its own response field.