PPactDocs
Developers

Embed Pact forms in your marketing site

Drop a hosted Pact form into any page, or build a fully custom form against the public API.

Pact forms capture leads straight into your CRM with consent handling built in. You can embed a hosted form with one snippet, or build your own UI against the public submit endpoint. Either way, submissions land as contacts and fire a form.submitted event.

Estimated time: ~15 minutes for the embed; ~45 for a fully custom form.

Option A — Embed the hosted form (fastest)

Build and publish a form in Admin → Forms. Each published form gets a public URL:

code
https://app.pact.place/f/<your-tenant>/<form-slug>

Drop it into any page with an iframe:

html
<iframe
  src="https://app.pact.place/f/acme/contact-us"
  title="Contact us"
  loading="lazy"
  style="width:100%;max-width:560px;height:640px;border:0;"
></iframe>

The hosted form handles validation, consent capture, and the thank-you state for you. You can also point a custom domain at it so the form lives on forms.yourcompany.com.

Option B — Build a custom form against the public API

For full control over markup and styling, render your own fields and POST to the public submit endpoint. No API key is required — these endpoints are public and rate-limited per IP.

Fetch the form definition to know which fields to render:

bash
curl https://app.pact.place/public/forms/<tenant_id>/<form-slug>

Submit the captured values:

ts
async function submit(values: Record<string, unknown>) {
  const res = await fetch("https://app.pact.place/public/forms/<tenant_id>/<form-slug>/submit", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ fields: values }),
  });
  if (!res.ok) throw new Error(`Submit failed: ${res.status}`);
  return res.json();
}

Capture consent honestly

If your form collects marketing consent, include the consent checkbox as a real field — don't pre-check it. Pact records the consent state with the submission, which is what keeps your outreach compliant.

React to submissions with a webhook

Subscribe to form.submitted to trigger downstream work (route the lead, notify Slack, enrich) the moment a form is filled in:

bash
curl -X POST https://app.pact.place/v1/webhooks/subscriptions \
  -H "Authorization: Bearer $PACT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New form lead",
    "url": "https://hooks.example.com/pact/form",
    "event_types": ["form.submitted"]
  }'

See the webhook quickstart for signature verification.

What's next?