Documentation
POST /api/v1/verify,
POST /api/v1/track,
GET /api/v1/widget/config,
POST /api/v1/widget/click and
GET /api/v1/threat/stats — no cookies and no secret key.
Server methods: POST /api/v1/validate and
POST /api/v1/threat/check — secret key required.
Never put the secret key in HTML or client-side JavaScript.
1. How it works
A project is created in the dashboard. A project has a public
site_key for the browser and a secret secret_key for your
server only. One project — one verification key. Domains are checked per project:
the primary domain and mirrors configured in the project settings. If a project has no
domains, the key is allowed on all domains.
The browser obtains a one-time token via client.js. Your backend verifies
that token with POST /api/v1/validate using the secret key. The secret
key must never be embedded in HTML, JavaScript or a mobile application.
Contact widgets are separate entities. They have no keys: the embed code uses only a
public id/hash such as w_.... Forms and review projects work the same way:
a public identifier cf_... or rv_..., with no secret key in the browser.
If a project's monthly verification limit is exhausted, checks over the limit are paid from the user's balance under the plan terms. The balance and transaction history are available in the dashboard. Balance top-ups are performed by the administrator; in the history such an operation is shown as “Top-up by administration” with a comment.
2. Quick start
- Register with an invitation and sign in to the dashboard.
- In the “Projects” section, create a project — the verification key is created automatically and domains are taken from the project.
- Copy
site_keyinto the embed code and storesecret_keyin the server environment variables. - Add
client.jsto the page with the form. - On the server, verify the
gf_tokenfield via/api/v1/validate. - If needed, create a form, review project or contact widget and embed its code.
3. Form protection: client.js
The script collects only behavioural counters, does not send field values and
adds a hidden gf_token field to the form.
<form data-gateform action="/send" method="post">
<input name="email" type="email" required>
<textarea name="message"></textarea>
<button type="submit">Send</button>
</form>
<script src="https://gateform.ru/client.js"
data-site-key="gf_site_..."
data-form="form[data-gateform]"
data-consent-position="before-submit"
defer></script>
Optional attributes: data-token-name (default
gf_token), data-api (another API origin),
data-timeout (ms) and data-block-message.
The form always gets an “I am not a robot” checkbox with the GateForm brand.
Small links to the personal data processing and privacy policies are shown below it.
If the check is confident that the visitor is human, the checkbox is set automatically;
otherwise it must be set manually. You can override the links with
data-privacy-url and data-agreement-url, and the checkbox text with
data-consent-label. The position is set by data-consent-position:
before-submit (default), after-submit, start,
end or a CSS selector. The attribute can be set on the script tag or on the form
itself. For precise placement use data-consent-target="#selector".
If the site already has its own visible consent checkbox, add
data-consent="off". Consent is passed in the token and returned in the
/api/v1/validate response as consent: true.
On a network error or 5xx response, the script submits the form without a token (fail-open). Your backend decides whether to accept such a lead.
4. Server-side validation in PHP
Keep the secret key in an environment variable. Never pass it to HTML or client-side JavaScript.
<?php
$token = $_POST['gf_token'] ?? '';
$secret = getenv('GATEFORM_SECRET_KEY');
$siteKey = getenv('GATEFORM_SITE_KEY');
if ($token === '' || $secret === false) {
http_response_code(400);
exit('Could not verify the form.');
}
$payload = json_encode([
'secret_key' => $secret,
'site_key' => $siteKey,
'token' => $token,
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://gateform.ru/api/v1/validate');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 3,
CURLOPT_TIMEOUT => 5,
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$result = json_decode((string) $body, true);
if ($status !== 200 || empty($result['valid'])) {
http_response_code(400);
exit('Verification failed.');
}
// The token is valid: process the lead.
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
$message = trim((string) ($_POST['message'] ?? ''));
The token is one-time. Re-validating the same token returns
TOKEN_ALREADY_USED, so keep the validation result while processing a
single lead.
5. Server-side validation in Node.js
const secretKey = process.env.GATEFORM_SECRET_KEY;
const siteKey = process.env.GATEFORM_SITE_KEY;
async function validateCaptcha(token) {
if (!token || !secretKey) return false;
const response = await fetch('https://gateform.ru/api/v1/validate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
secret_key: secretKey,
site_key: siteKey,
token
})
});
const result = await response.json().catch(() => ({}));
return response.ok && result.valid === true;
}
// Express/Fastify: the token comes from the gf_token field
app.post('/send', async (req, res) => {
const ok = await validateCaptcha(req.body.gf_token);
if (!ok) return res.status(400).send('Verification failed');
// ... process the lead
});
For Python, Go, Ruby and other languages, send JSON with the fields
secret_key, site_key and token to
/api/v1/validate and check valid === true.
6. Public API
POST /api/v1/verify
Called by the browser via client.js. The public site_key
is not a secret. The domain is checked against the Origin or
Referer headers and the project domain list.
{
"site_key": "gf_site_...",
"form_id": "contact",
"page_url": "https://example.ru/contacts",
"consent": true,
"telemetry": {
"elapsed_ms": 4200,
"mouse_moves": 12,
"pointer_distance": 380,
"key_events": 8,
"focus_events": 2,
"form_interactions": 4,
"form_fields_filled": 2,
"touch": false,
"honeypot": false,
"webdriver": false,
"plugins": 3
}
}
Response when allowed:
{
"success": true,
"action": "allow",
"score": 0.95,
"token": "<signed token>",
"expires_in": 600,
"fail_open": false
}
Response when blocked: { "success": false, "action": "block", "score": 0, "reason": "honeypot" }.
Honeypot and navigator.webdriver cause a hard block. Other signals
affect the score. The allow threshold depends on the plan protection level:
basic — 0.35, enhanced — 0.5, maximum — 0.65.
POST /api/v1/validate
Called only from the client server. The secret key is required. The token lives for 10 minutes and is one-time.
{
"secret_key": "gf_sec_...",
"site_key": "gf_site_...",
"token": "<token from the form>"
}
Successful response:
{
"success": true,
"valid": true,
"action": "allow",
"score": 0.95,
"fail_open": false,
"consent": true,
"expires_at": "2026-10-20T12:10:00.000Z"
}
An invalid or reused token returns HTTP 200 with
{ "success": false, "valid": false, "code": "..." }. An invalid
secret key returns 401 INVALID_CREDENTIALS.
7. Contact widget: widget.js
The widget is isolated in Shadow DOM and uses no external fonts or images. It has no keys: only a public id/hash. The dashboard configures the theme, accent colour, background and icon colour, “icon only” or “icon with text” button, border radius, maximum width, offsets, links and display mode. The widget has no title. The settings form has a live preview.
The widget is not bound to a domain: the same code can be embedded on any site, and statistics are shared per widget. For each link, the URL at the time of the click is saved, so statistics do not mix after an address change.
<script src="https://gateform.ru/widget.js"
data-widget-id="w_..."
defer></script>
Floating button
The floating mode (default) shows the button in the selected corner.
Clicking it reveals a column of link icons without a title or panel: upwards for
bottom corners and downwards for top corners. The button can be a round icon or a
button with text; offsets are configured separately for desktop, tablet and mobile.
Inline block
The inline mode renders a row of link icons immediately, without a floating
button or modal window. Place the script where needed. If you need a specific
container, add the optional data-target:
<div id="contacts-widget"></div>
<script src="https://gateform.ru/widget.js"
data-widget-id="w_..."
data-target="#contacts-widget"
defer></script>
Without data-target, the inline block is added right after the script.
If the script is loaded in <head>, select a container in
<body> via data-target.
Configuration is loaded via GET /api/v1/widget/config?id=w_....
The endpoint returns only safe fields: mode, theme, colours, button, offsets and
links. The widget comment is internal and is not exposed publicly.
{
"success": true,
"name": "Site support",
"widget": {
"position": "bottom-right",
"color": "#4A6CF7",
"theme": "light",
"panel_color": null,
"text_color": null,
"button_style": "pill",
"button_text": "Contact us",
"border_radius": 16,
"max_width": 360,
"display_mode": "floating",
"offsets": {
"desktop": { "x": 20, "y": 20 },
"tablet": { "x": 16, "y": 16 },
"mobile": { "x": 12, "y": 12 }
},
"links": [
{ "id": "telegram", "type": "telegram", "label": "Telegram", "value": "https://t.me/example" }
]
}
}
panel_color and text_color may be
null — the selected theme colours are used then. Clicks on each link are
tracked automatically and visible in the dashboard. An account can create up to
10 widgets; the plan does not affect widgets.
You can add forms from the “Forms” section to the widget. In the editor, choose a form and an icon — on the site such a button opens the form in a modal window over the page. In the configuration, a form link looks like this:
{
"id": "f_5e27dbccf41eed96",
"type": "form",
"label": "Callback",
"value": "cf_5e27dbccf41eed969a79c48230758e42",
"icon": "chat"
}
The public endpoint returns only forms of the widget owner that are enabled and
available on the plan, and label is always replaced with the current form
name. The form opens at /f/<hash>?gf_embed=modal; the page allows
embedding in an iframe, and the widget adjusts height and border radius based on the
form messages.
8. Forms and reviews
A form is a standalone page with captcha, consent and a Telegram notification. The builder supports custom fields: text, email, phone, multiline text, number, date, select, checkbox and hidden field. A review project is one site and a set of products; a review is linked to the product name, SKU and authenticated user. In both cases a public identifier is used, not a secret key.
<!-- Inline form -->
<script src="https://gateform.ru/callback-embed.js"
data-callback-form="cf_..."
defer></script>
<!-- Modal form by button -->
<button type="button" id="open-form">Request a callback</button>
<script src="https://gateform.ru/callback-embed.js"
data-callback-form="cf_..."
data-mode="modal"
data-trigger="#open-form"
defer></script>
<!-- Reviews -->
<script src="https://gateform.ru/review-embed.js"
data-gateform-reviews="rv_..."
defer></script>
In the form settings you can choose inline mode or a modal window and set the button
CSS selector (#open-form, .open-form). The data-mode
and data-trigger attributes in the embed code override the settings for a
specific site.
On paid plans, fields can automatically capture page data: a URL parameter, page URL,
title, Referrer, UTM tags, product ID and name. Values are inserted into the form on
load and saved in the lead. On the free plan, a request with page data is rejected with
403 PAGE_DATA_REQUIRES_SUBSCRIPTION.
Captcha is enabled for all forms: leads, reviews, sign-in and password recovery. It can only be disabled globally in the platform settings. For each form you can see captcha analytics for 30 days: views, successful passes, blocks and conversion to submitted leads.
Direct URLs: https://gateform.ru/f/cf_... and
https://gateform.ru/r/rv_.... For CSP, allow
script-src https://gateform.ru and
frame-src https://gateform.ru.
GateForm branding is shown only as a footer caption. It can be removed on a paid plan
of the account or any project with a price above 0; on the free plan a request with
show_branding=false is rejected, and the public output keeps the caption enabled.
In the form and review project settings you can provide your own link to the personal data processing policy and the link text. If no link is set, the GateForm policy is used.
Sending leads to Bitrix24
In Bitrix24 open Applications → Developer resources → Other → Inbound webhook.
On the Permissions tab enable the CRM permission
(at minimum, adding leads, method crm.lead.add), save the webhook and
copy its address:
https://company.bitrix24.ru/rest/1/xxxxxxxxxxxxxxxx/
In the GateForm dashboard open the form, enable “Send leads to CRM”,
select Bitrix24 and paste the webhook base address. You do not need to
append crm.lead.add.json — GateForm adds the method itself. The CRM receives
the name, phone, email, comment, submission page and form name. If the CRM is
unavailable, the lead stays in the dashboard and the error appears in the lead log.
Custom form fields can be mapped to Bitrix24 fields. Enter the field code, for example
UF_CRM_1234567890, in the “Form fields → CRM” block. Unmapped
fields go into the lead comment, so no data is lost. For testing, use the request
generator in the webhook settings: method crm.lead.add, parameter
fields[TITLE].
Sending leads to amoCRM
In amoCRM create a private integration: Settings → Integrations →
Create integration. Set the Redirect URI
https://gateform.ru/ (or your dashboard domain — it must match the field
in GateForm) and enable the Deals and Contacts
permissions. After saving, open the Keys tab: you will need the
Integration ID (Client ID), Secret key (Client secret) and authorization code.
The authorization code is valid for 20 minutes. Exchange it for tokens:
curl -X POST "https://SUBDOMAIN.amocrm.ru/oauth2/access_token" \
-H "Content-Type: application/json" \
-d '{
"client_id": "CLIENT_ID",
"client_secret": "CLIENT_SECRET",
"grant_type": "authorization_code",
"code": "AUTHORIZATION_CODE",
"redirect_uri": "https://gateform.ru/"
}'
The response contains access_token and refresh_token. Fill in
the subdomain in GateForm (for example company for
company.amocrm.ru), access token, refresh token, Client ID, Client secret and
Redirect URI. The pipeline and stage IDs are optional. The access token lives for about
24 hours, the refresh token for 3 months; GateForm refreshes the token pair
automatically, so keep the refresh token and Client secret.
Custom form fields are mapped to amoCRM fields: enter the numeric deal field ID, and
for a contact field use contact:ID. Unmapped fields and the comment go into
a note on the created deal. If the integration is not configured or the token has
expired, the lead stays in GateForm and the reason is visible in the log.
9. IP reputation database
The shared database receives form and captcha events, as well as bots from traffic
analytics. Bots keep a “bot” label and bot name (Googlebot, YandexBot, GPTBot,
AhrefsBot, etc.); known search bots get a low score and are not blocked automatically.
Verification logs store the IP as an HMAC hash; for API diagnostics the IP may be
stored openly for a limited time and is available only to the administrator. The
reputation database may store the IP address itself so the administrator can check and
find it in the admin panel. Request bodies, cookies and Authorization are
not stored.
IP reputation lookup is performed only from the server and only with a secret key:
POST /api/v1/threat/check with the secret_key,
site_key and ip fields. Never call this method from a
browser and never put the secret key in HTML. The public
GET /api/v1/threat/stats returns only a summary without IP addresses.
POST /api/v1/threat/check
Content-Type: application/json
{
"secret_key": "gf_sec_...",
"site_key": "gf_site_...",
"ip": "203.0.113.10"
}
Automatic blocking in the shared database is enabled only with a high score and several independent sources; a manual administrator block takes priority.
The public IP reputation page shows only aggregated statistics and risk categories — without an IP check form or a list of raw addresses.
10. Traffic analytics
Add tracker.js to all site pages. It collects visits, sources and visitor
behaviour without storing IP addresses.
<script src="https://gateform.ru/tracker.js"
data-site-key="gf_proj_..."
defer></script>
The analytics code is bound to the project: it contains a unique
tracker_key and works on the primary domain and all mirrors. Old snippets
with a verification key gf_site_... are still accepted.
What is included in analytics:
- page path and title;
- entry domain: primary site and mirrors;
- visitor country, region and city (from the built-in GeoLite2 database);
- referrer, search engine and search query;
- UTM tags: source, medium, campaign, term, content;
- source: search, direct, social, referrals, ads, email;
- new or returning visitor;
- device, browser, OS, language and screen resolution;
- time on page and visit depth.
A visitor is identified by a random visitor_id in
localStorage and a first-party cookie. A session lives for 30 minutes without
activity. The IP address is not sent or stored. The tracker respects
Do Not Track, does not run for known bots and keeps raw events for 180 days.
Repeated visits lasting 0–1 second with one page are marked as suspicious after 3 cases in 24 hours. This is a soft “possible parser” signal, not an automatic block; such visits are visible in the “Suspicious” filter and go into IP reputation with the name “Short visits / parser”.
For SPAs, pushState and replaceState transitions are tracked
automatically. If needed, call window.GateFormTracker.pageview() manually.
In the admin panel you can set a Yandex Metrica counter number. It is loaded only on public site pages and does not affect embedded forms and widgets.
The tracker and form verification are allowed on the project primary domain and its mirrors. A mirror added in the project is accepted immediately without editing the key. Old domains previously set on the key are used only while the project has no domains.
Dashboard data:
GET /api/traffic/summary?days=30&project_id=1&key_id=1
with the user cookie session. Without filters, statistics are summed across all
projects; with project_id — for the selected project.
11. Ready-made modules, Composer packages and snippets
The modules use public keys and support captcha, forms, reviews and the contact widget. The secret key is never embedded in templates. Website: gateform.ru.
- Universal HTML/JS — for any site without PHP: form, form protection, reviews, widget.
- Site builders — Tilda, Wix, Webflow, Squarespace, Craftum, uKit, Nethouse, Flexbe, LPgenerator, Readymag.
- 1C-Bitrix — module with settings, widget and server-side token validation.
- Joomla 4/5 — system plugin with shortcodes and server-side token validation.
- WordPress / WooCommerce / Contact Form 7 — CF7 captcha, WordPress/WooCommerce forms, contact widgets and reviews plugin.
- OpenCart 3 — contact widget in the site footer.
- OpenCart 4 — namespace contact widget module in the site footer.
- Yii2 — component, validator, filter and widgets.
- Yii3 — widgets,
TokenValidatorand PSR-15 middleware. - Laravel — validation rule, middleware and Blade components.
- PHP SDK — server-side token validation without a framework.
- Node.js SDK — token validation for Node.js 18+.
1C-Bitrix
The module adds GateForm captcha, the contact widget and ready-made form and review embeds. Module settings are available at Settings → Product settings → Module settings → GateForm.
Enter the public and secret keys, the form CSS selector and, if needed, the contact
widget ID. Scripts are added before </body> only on public HTML pages;
the admin panel, AJAX, JSON and XML are not affected. The secret key is stored on the
server and is never printed in HTML.
<?php
require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
$result = GateFormIntegration::validateToken(
GateFormIntegration::tokenFromRequest()
);
if (!$result['valid']) {
http_response_code(400);
echo htmlspecialchars($result['message'], ENT_QUOTES, 'UTF-8');
exit;
}
// The form data can now be saved.
Ready-made form, widget and review embeds from a template:
<?php
echo GateFormIntegration::renderForm('cf_0123456789abcdef0123456789abcdef');
echo GateFormIntegration::renderWidget('w_0123456789abcdef0123456789abcdef');
echo GateFormIntegration::renderReviews('rv_0123456789abcdef0123456789abcdef');
Joomla 4/5
Enable the System - GateForm plugin in System → Plugins and enter the keys, form selector and widget ID.
The plugin adds scripts to the footer of public HTML pages, validates identifier formats, escapes output and never prints the secret key. For third-party component forms, call validation before saving data:
use GateForm\Plugin\System\Gateform\Extension\Gateform;
$result = Gateform::validateToken(Gateform::tokenFromRequest());
if (!$result['valid']) {
throw new \RuntimeException($result['message']);
}
Shortcodes are available in articles and HTML modules:
{gateform_form id="cf_0123456789abcdef0123456789abcdef" mode="inline"}
{gateform_form id="cf_0123456789abcdef0123456789abcdef" mode="modal" trigger="#callback"}
{gateform_widget id="w_0123456789abcdef0123456789abcdef"}
{gateform_reviews id="rv_0123456789abcdef0123456789abcdef" product_name="Product"}
Composer and npm
The PHP packages gateform/sdk, gateform/yii2,
gateform/yii3 and gateform/laravel are published on
Packagist. The Node.js SDK is @gateform/sdk on npm.
composer require gateform/sdk
composer require gateform/yii2
composer require gateform/yii3
composer require gateform/laravel
npm install @gateform/sdk
Source code on GitHub: PHP SDK, Yii2, Yii3, Laravel, Node.js SDK.
Contact Form 7
Enable “Contact Form 7” in the plugin settings and add the [gateform] tag
to the form. The tag outputs a hidden token field and a “Protected by GateForm” caption
with a site link and logo. Without the tag, the script attaches to the form automatically.
[text* your-name]
[email* your-email]
[textarea your-message]
[gateform]
[submit "Send"]
Validation runs through the wpcf7_validate filter before the email is sent.
The caption can be disabled with the gateform_cf7_branding filter.
For builders without a server-side hook, a GateForm form in an iframe provides full
protection. Connecting client.js to a native form filters simple bots but
does not replace server-side token validation.
A modal form can be opened programmatically with
window.GateFormCallback.open() and closed with
window.GateFormCallback.close(). A button can be added to the page later —
event delegation will find it automatically. Forms added after page load are attached to
client.js automatically; you can call window.GateForm.attach()
manually.
After connecting, check the forms on mobile and desktop, iframe behaviour and CSP, and make sure no secrets are exposed in HTML.
12. Public API errors
403 INVALID_SITE_KEY— the public key was not found, is disabled or not approved;403 DOMAIN_NOT_ALLOWED— the request came from a domain that is not in the project;403 ACCOUNT_BLOCKED— the key owner account is blocked;429 QUOTA_EXCEEDED— the key monthly verification limit is exhausted;402 BALANCE_INSUFFICIENT— the limit is exhausted and the balance has insufficient funds for overage;401 INVALID_CREDENTIALS— invalid secret key in validate or threat/check;403 THREAT_INTEL_BLOCKED— the address is blocked by the shared reputation database;TOKEN_EXPIRED,INVALID_TOKEN,TOKEN_ALREADY_USED— the token was not accepted;THREAT_INTEL_DISABLED,THREAT_INTEL_UNAVAILABLE— the IP reputation database is disabled or unavailable;403 BRANDING_REQUIRES_SUBSCRIPTION— removing branding is not available on the free plan;503 VERIFICATION_UNAVAILABLE— temporary error; client.js works fail-open;- an internal score calculation error — the token is still issued with
fail_open: true.