Lead Generation - API Documentation
Full reference for all commands, modes, and form submission endpoints.
In all URLs below, replace XXX with your AI Apps Account ID, found in your account settings.
How Endpoints Work
Two ways to call each endpoint, plus hosted form submissions
App Command (API Call)
POST your request to
Mode / Webhook (Direct URL)
POST directly to the endpoint URL shown in each section. The fields go in the POST body as standard form fields (the same fields you would include in an HTML form POST). Use this method for provider webhooks, website forms, or any third-party system that sends form data. No API key is required, the account ID is part of the URL.
POST your request to
https://api.aiappsapi.com with your API key and account ID in the POST body. The fields described in each section below go inside the jsonData POST field as a JSON-encoded string. Use this method when your server is making the call and you have your API credentials available.Mode / Webhook (Direct URL)
POST directly to the endpoint URL shown in each section. The fields go in the POST body as standard form fields (the same fields you would include in an HTML form POST). Use this method for provider webhooks, website forms, or any third-party system that sends form data. No API key is required, the account ID is part of the URL.
Hosted form submissions: When lead capture forms are served on your hosted domain through the Website App Builder, form submissions POST directly to your domain (not the API). The platform handles the submission internally, stores the lead, and redirects the visitor to the next offer in the path or to a thank-you page. No API call is needed for hosted forms.
Submit Lead
mode: submitlead
The main inbound endpoint for offer form submissions. When an
offerID is provided, validates required fields, stores the lead profile, forwards data to third-party buyers if host-and-post is configured, auto-submits other path offers when all required data is already available, and returns the next offer in the path. When only an offerpathID is provided (no offerID), starts or resumes the path and returns the first available offer.
POST Mode URL (no API key needed)
https://api.aiappsapi.com/XXX/leadgen/submitlead
On hosted websites, lead forms POST directly to your domain URL (e.g.
https://yourdomain.com/forms-5 or https://yourdomain.com/path-2). Use the mode URL above only when submitting leads from external systems.Required Fields
| Field Name | Field Key | Notes |
|---|---|---|
| Offer ID | offerID | The numeric index of the offer to submit against. Required for lead submission. Omit this field and provide only offerpathID to start or resume a path without submitting. |
| Email or Phone | email / phone | At least one is required. Email must be a valid address. Phone must be 10 digits (US format, leading 1 is stripped automatically). |
Optional Fields
| Field Name | Field Key | Notes |
|---|---|---|
| Offer Path ID | offerpathID | Numeric index of the offer path. When included with an offerID, the system updates path session state and returns the next offer. When sent alone (no offerID), starts or resumes the path. |
| First Name | fname | Lead's first name. |
| Last Name | lname | Lead's last name. |
| Address | address | Street address line 1. |
| Address Line 2 | address2 | Apartment, suite, unit, etc. |
| City | city | City name. |
| State | state | State or province. |
| Postal Code | zip | ZIP or postal code. |
| Country | country | Country code. Defaults to US if omitted. |
| Custom Fields | c0 - c19 | Up to 20 custom fields, positional. Each maps to the corresponding entry in the offer's custom fields configuration. |
| Opt-in | optin | Opt-in consent flag. Defaults to 1. |
| Source URL | sourceurl | Where the lead came from. Auto-detected from HTTP referer if omitted. |
Submit Survey
mode: submitsurvey
Accepts completed survey answers and stores them in the lead database. Each submission is stored as a separate record. On hosted websites, surveys are multi-page forms that submit page by page and store the final result automatically. Use this mode endpoint when submitting survey answers from an external system.
POST Mode URL (no API key needed)
https://api.aiappsapi.com/XXX/leadgen/submitsurvey
Required Fields
| Field Name | Field Key | Notes |
|---|---|---|
| Survey ID | surveyID | Numeric index of the survey in your leadgen configuration. |
| Answers | answers | Object keyed by page index, each containing question answers. Example: {"0": {"0": "Yes", "1": "Blue"}, "1": {"0": "5"}} |
Submit Application
mode: submitapplication
Accepts completed application answers and stores them in the lead database. Works identically to the survey submission endpoint but stores records with an application type. On hosted websites, applications are multi-page forms handled automatically. Use this mode endpoint when submitting application answers from an external system.
POST Mode URL (no API key needed)
https://api.aiappsapi.com/XXX/leadgen/submitapplication
Required Fields
| Field Name | Field Key | Notes |
|---|---|---|
| Application ID | applicationID | Numeric index of the application in your leadgen configuration. |
| Answers | answers | Object keyed by page index, each containing question answers. Same format as survey answers. |
Get All Vertical Offers
command: getoffers
Returns all active offers tagged with a given vertical. Use this to retrieve the list of available offers for a specific category or market vertical. Only offers with an active status are returned.
POST App Command URL
https://api.aiappsapi.com app: leadgen command: getoffers
This command is only available as an App Command. It is not available as a direct mode/webhook URL.
Required Fields
| Field Name | Field Key | Notes |
|---|---|---|
| Vertical ID | verticalID | Numeric index of the vertical. Returns all active offers assigned to this vertical. |
Get Lead Record
command: getleadrecord
Returns the full lead profile for a given record ID. The record includes all stored contact fields, custom data, and a history of which offers the lead has completed.
POST App Command URL
https://api.aiappsapi.com app: leadgen command: getleadrecord
This command is only available as an App Command. It is not available as a direct mode/webhook URL.
Required Fields
| Field Name | Field Key | Notes |
|---|---|---|
| Record ID | recordID | The lead's email address (primary key). Must be at least 6 characters. |
Offer Path
command: offerpath
Single command for managing offer path state, used primarily by the AI Chatbot for conversational lead collection. Handles both state retrieval and updates in one call. If a field name and value or skip flag is provided, processes the update first, then always returns the current path state: the next offer to present, which fields are still missing, or a completion flag when all offers are done.
POST App Command URL
https://api.aiappsapi.com app: leadgen command: offerpath
This command is only available as an App Command. On hosted websites, offer paths are managed automatically through the form submission and redirect flow.
Required Fields
| Field Name | Field Key | Notes |
|---|---|---|
| Offer Path ID | offerpathID | Numeric index of the offer path in your leadgen configuration. |
Optional Fields
| Field Name | Field Key | Notes |
|---|---|---|
| Field Name | fieldName | Name of the lead field being submitted (e.g. email, fname, c0). When provided with fieldValue, updates the lead data and checks if the current offer can be auto-submitted. |
| Field Value | fieldValue | Value for the field specified by fieldName. |
| Skip | skip | Set to 1 to skip the current offer and move to the next one in the path. |