Complete reference for the zForms SDK and REST API.
Setup & config
Track forms & events
Server-side API
Real-time events
projectIdstringYesYour project ID from dashboardapiKeystringYesYour API key from dashboardtrackPageViewsbooleanNoAuto-track page views (default: true)anonymizeIPbooleanNoAnonymize IP addresses (default: true)enableAIbooleanNoEnable AI insights (default: true)const tracker = new ZFormsTracker({
projectId: 'proj_abc123',
apiKey: 'zf_sk_xyz789',
trackPageViews: true,
anonymizeIP: true,
enableAI: true
});Start tracking a form element.
selectorCSS selector for the form elementoptions.nameOptional form name for identificationoptions.categoryOptional category (e.g., 'lead-gen', 'checkout')options.multiStepEnable multi-step form trackingtracker.trackForm('#signup-form', {
name: 'User Signup',
category: 'authentication',
multiStep: false
});Track a custom event.
tracker.track('form_submitted', {
formId: 'contact-form',
fields: 5,
timeToComplete: 45
});Associate events with a user.
tracker.identify('user_123', {
email: 'user@example.com',
plan: 'pro'
});Stop tracking a specific form.
tracker.stopTracking('#contact-form');Base URL: https://api.zforms.xyz/v1
Authentication: Include your API key in the X-API-Key header
List all your projects.
curl -X GET https://api.zforms.xyz/v1/projects \ -H "X-API-Key: your_api_key"
{
"projects": [
{
"id": "proj_abc123",
"name": "My Website",
"domain": "example.com",
"createdAt": "2025-01-15T10:00:00Z"
}
]
}Get analytics data for a project.
curl -X GET https://api.zforms.xyz/v1/analytics/proj_abc123 \ -H "X-API-Key: your_api_key" \ -d "startDate=2025-01-01" \ -d "endDate=2025-01-31"
{
"sessions": 1234,
"submissions": 567,
"conversionRate": 45.9,
"avgTimeToComplete": 125,
"topDropoffFields": [
{ "field": "email", "dropoffRate": 12.3 }
]
}Send a custom event (server-side tracking).
curl -X POST https://api.zforms.xyz/v1/events \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"projectId": "proj_abc123",
"event": "form_submitted",
"properties": {
"formId": "contact-form"
}
}'Receive real-time notifications when events occur in your forms. Configure webhooks in your dashboard under Project Settings.
form.submittedWhen a form is successfully submittedform.abandonedWhen a user abandons a forminsight.generatedWhen AI generates a new insight{
"event": "form.submitted",
"timestamp": "2025-01-30T14:23:45Z",
"projectId": "proj_abc123",
"data": {
"formId": "contact-form",
"sessionId": "sess_xyz789",
"timeToComplete": 125,
"fieldsCompleted": 5
}
}All webhook requests include a signature in the X-ZForms-Signature header. Verify this signature to ensure requests are from zForms.
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const hmac = crypto.createHmac('sha256', secret);
const digest = hmac.update(payload).digest('hex');
return digest === signature;
}1,000
events per month
100,000
events per month
Unlimited
custom rate limits
API requests are limited to 100 requests per minute per API key. Exceeding this limit will result in a 429 Too Many Requests response.
npm install @zforms/trackernpm install @zforms/reactpip install zformsnpm install @zforms/nodeNeed an SDK for a different language? Contact us to request support.