Developers & TemplatesBUSINESS & SCALEDevelopersMarketing / Web TeamsOperations Admins
API & Document Template Tokens
Connect any website contact form directly to your OpenField CRM Leads pipeline, and inspect all 18 dynamic merge tokens supported by the Word (.docx) & PDF Template Studio.
1. Public Website Lead Intake API
#Capture leads straight from your marketing site into Customers → Leads & Enquiries.
Copy your workspace's unique endpoint from Customers → Leads & Enquiries. Because the key in the URL scopes incoming submissions to your workspace, no user bearer token is needed on your public website form.
| Field | Required | Notes |
|---|---|---|
displayName | Yes | Full name of the prospect or contact person. |
email | Email or Phone | At least one of email or phone must be provided. |
phone | Email or Phone | Prospect contact phone number. |
companyName | Optional | Company or organization name. |
requirement | Optional | Products, services, or enquiry message. |
bash• cURL Webhook Test
curl -X POST "https://api.business.openfield.in/api/v1/leads/public/<YOUR_INTAKE_KEY>" \
-H "Content-Type: application/json" \
-d '{
"displayName": "Avery Chen",
"email": "avery@northwind.example",
"phone": "+971501234567",
"companyName": "Northwind Trading LLC",
"requirement": "Looking for multi-warehouse inventory and invoicing software"
}'typescript• Browser / Next.js Form Handler
async function submitWebsiteEnquiry(formValues: {
name: string;
email?: string;
phone?: string;
company?: string;
message?: string;
}) {
const res = await fetch(
"https://api.business.openfield.in/api/v1/leads/public/<YOUR_INTAKE_KEY>",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
displayName: formValues.name,
email: formValues.email,
phone: formValues.phone,
companyName: formValues.company,
requirement: formValues.message,
}),
}
);
if (!res.ok) throw new Error("Failed to submit lead");
return res.json();
}- The public intake route is rate-limited per client IP to block form spam.
- Use the Rotate Key button in Customers → Leads if an endpoint key is leaked or needs replacing—the previous URL stops working immediately.
Authenticated Workspace API Routes
All internal CRM, Document, Money, Purchase, Inventory, Project, and Payroll routes require
Authorization: Bearer <token> and an x-company-id header matching an active membership.4. Word (.docx) & PDF Document Merge Tokens
#Automatically detected when uploading templates in Documents → Settings.
Place any of these 18 tokens inside your .docx template or custom PDF Studio layout—they populate automatically when previewing, printing, or exporting a document:
| Token | Populated Value | Token | Populated Value |
|---|---|---|---|
{{companyName}} | Active company / branch name | {{documentTitle}} | Quotation, Invoice, etc. |
{{documentNumber}} | Sequential number (e.g. INV-00042) | {{issueDate}} | Document issue date |
{{dueDate}} | Payment due date | {{customerName}} | Customer display name |
{{customerAddress}} | Snapshot billing/delivery address | {{subject}} | Document subject / title |
{{linesTable}} | Full line-items table | {{subtotal}} | Pre-tax / pre-discount subtotal |
{{discountTotal}} | Total line discounts | {{taxTotal}} | Total VAT / GST / Sales Tax |
{{grandTotal}} | Final payable total | {{currency}} | Document currency code |
{{referenceNumber}} | External / PO reference | {{paymentTerms}} | e.g. NET 30, DUE ON RECEIPT |
{{termsAndConditions}} | Document terms block | {{notes}} | Customer-visible notes |