Contents
On this page

Submit Lead Form - Plugixa CRM

POST /plugixa-crm/v1/lead-capture/{id}

Submit a lead capture form from your own front end or another site. This is the endpoint the plugin’s own form posts to.

Public: no sign-in. The form must exist and be active, and the Web forms app must be on. Requests are limited to 10 an hour per IP address, across all forms.

Content type decides the answer. With Content-Type: application/json you get JSON. Anything else, such as a plain HTML form post, gets a 303 redirect instead, to the form’s success page or back to source_url.

A duplicate is reported as a success. When the form checks for duplicates and a lead with the same e-mail exists, nothing is created and the response is the normal success.

Note. Every request that passes the honeypot counts toward the rate limit, including ones then refused for missing fields.

Request

POST https://your-site.example/wp-json/plugixa-crm/v1/lead-capture/3

Path parameters

Name Type Description
id integer The lead capture form’s id. See Web-to-Lead for setting up forms

Request body

Content type: application/json, or application/x-www-form-urlencoded for a plain HTML form

Field Type Required Description
first_name string See below First name.
last_name string See below Last name.
account_name string See below The company.
salutation string No Free text.
title string No Job title.
email string No Needed for double opt-in and the duplicate check. A value that is not an address is stored empty.
phone string No Free text.
website string No A URL.
industry string No Free text.
description string No The visitor’s message. Line breaks are kept.
address_street string No Postal address.
address_city string No Postal address.
address_state string No Postal address.
address_postal_code string No Postal address.
address_country string No Postal address.
source_url string No The page the form was on. Only a URL on this site is kept; otherwise the home page is used.
contact_reference_url string No The honeypot. Leave it out or empty: any value rejects the submission.

Only fields the form offers are read; everything else is dropped. Fields the form marks required must be filled, choice fields must hold one of their options, and at least one of first_name, last_name and account_name is needed.

The lead is created with status new, the form’s source and the form’s owner. When the form uses double opt-in, the lead is only created once the visitor clicks the link in the confirmation e-mail, unless the form is set to create it first.

{
  "first_name": "Ada",
  "last_name": "Lovelace",
  "account_name": "Analytical Engines Ltd",
  "email": "ada@analytical.example",
  "description": "We would like a demo.",
  "source_url": "https://your-site.example/contact"
}

Responses

200 OK. The submission was accepted.

{
  "success": true,
  "data": {
    "submitted": true,
    "message": "Thanks, we will be in touch.",
    "redirect_url": "https://your-site.example/thank-you"
  }
}
Field Type Meaning
data.submitted boolean Always true
data.message string The form’s success message, or with double opt-in its confirmation message
data.redirect_url string The form’s success page, empty when none. Absent while waiting for opt-in

A form-encoded request gets 303 See Other instead, with Location set to the form’s success page, else source_url, with plugixa-crm-lead=sent added; on an error, back to source_url with plugixa-crm-lead=error.

Errors

Status Code When
404 plugixa_crm_capture_unavailable No form with that id, or it is deleted or not active.
400 plugixa_crm_rejected The honeypot field holds a value.
429 plugixa_crm_rate_limited More than 10 submissions from this IP address in the last hour.
403 plugixa_crm_captcha_failed A CAPTCHA check added by your own code refused the request.
422 plugixa_crm_missing_fields A required field is empty (listed in data.fields), or no name or company was given.
422 plugixa_crm_invalid_choice A choice field holds a value it does not offer (listed in data.fields).
404 rest_no_route The Web forms app is off.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-crm/v1/lead-capture/3" \
  -H "Content-Type: application/json" \
  -d '{"first_name":"Ada","last_name":"Lovelace","account_name":"Analytical Engines Ltd","email":"ada@analytical.example","description":"We would like a demo.","source_url":"https://your-site.example/contact"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-crm/v1/lead-capture/3');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'first_name'   => 'Ada',
        'last_name'    => 'Lovelace',
        'account_name' => 'Analytical Engines Ltd',
        'email'        => 'ada@analytical.example',
        'description'  => 'We would like a demo.',
        'source_url'   => 'https://your-site.example/contact',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-crm/v1/lead-capture/3', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    first_name: 'Ada',
    last_name: 'Lovelace',
    account_name: 'Analytical Engines Ltd',
    email: 'ada@analytical.example',
    description: 'We would like a demo.',
    source_url: 'https://your-site.example/contact',
  }),
});
const { data } = await response.json();

Quick Links

Share