Lead Gen API Docs | 1ClickWebsite.ai
Docs

Lead Gen API Docs

Batch API reference for creating and processing Lead Gen V2 mini-sites.

API Documentation V2

Lead Gen V2 Batch API

Lead Gen V2 is batch-first. Use the batch endpoints to create and process lead-gen mini sites.

Base URL:

https://1clickwebsite.ai

Authentication

Use an API key from your 1ClickWebsite account in the Authorization header.

Authorization: Bearer YOUR_API_KEY

API keys are the existing account API keys. The raw key is shown once when created, then stored as a SHA-256 hash in the API keys table.

Available Template Keys

Use the top-level templateKey field to choose the Lead Gen V2 template for the whole batch.

Template keyTemplateStatus
lightningLightningAvailable

lightning is the current production Lead Gen V2 template. More template keys can be added later as new templates are converted.

Create A Batch

POST /api/lead-gen/batches

Creates a Lead Gen V2 batch and reserves credits.

Credit Rules

Lead Gen V2 has a five-credit minimum per batch.

Rows submittedCredits reserved
15
55
2020

If the batch cannot be created, credits are not kept. If processing fails for a row, the batch item records the error status.

Request Body

Top-level fields:

FieldTypeRequiredNotes
industrystringNoShared industry/category for the whole batch. If omitted, the first row industry is used, then Home Services.
rowsarrayYes1 to 500 business rows.
templateKey or template_keystringNoTop-level template key for every row in the batch. Use lightning for the current template.
templateName or template_namestringNoDeprecated alias for templateKey. Prefer templateKey.
primaryColor or primary_colorstringNoHex color, for example #0B1F3A. Used as the batch default.
backgroundTheme or background_themestringNolight or dark.
contactMode or contact_modestringNoform or scheduler. schedule, booking, and survey are accepted as aliases for scheduler.

Row fields:

FieldTypeRequiredNotes
businessName or business_namestringYes for new requestsBusiness name for the generated mini site. Existing integrations may temporarily send a deprecated Google identifier instead.
phonestringNoPhone number to show on the generated site.
emailstringNoEmail to show on the generated site. This is saved as text and may be blank.
addressstringNoFull street address, city/state, or broad area like London.
industrystringNoRow-specific industry. Falls back to the batch industry.
logoUrl or logo_urlstringNoRow-specific logo image URL. Empty values use the default placeholder logo.
primaryColor or primary_colorstringNoRow-specific hex color. Overrides the batch default.
backgroundTheme or background_themestringNoRow-specific background theme.
contactMode or contact_modestringNoRow-specific contact mode.

Template selection is batch-level only. Do not send templateKey, template_key, templateName, or template_name inside individual rows.

Each row should include businessName or business_name. The older Google identifier format is still accepted temporarily; see the deprecated section below.

Example Request

curl -X POST "https://1clickwebsite.ai/api/lead-gen/batches" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "industry": "Roofing",
    "templateKey": "lightning",
    "primaryColor": "#0B1F3A",
    "backgroundTheme": "light",
    "rows": [
      {
        "businessName": "RidgeLine Roofing",
        "phone": "(555) 010-0199",
        "address": "1480 Main St, Denver, CO 80202",
        "primaryColor": "#0B1F3A",
        "logoUrl": "https://placehold.co/360x120/0B1F3A/FFFFFF.png?text=RidgeLine+Roofing"
      },
      {
        "businessName": "Summit Shield Roofing",
        "email": "hello@summitshieldroofing.com",
        "address": "Austin, TX",
        "primaryColor": "#5B1117",
        "logoUrl": "https://placehold.co/360x120/5B1117/FFFFFF.png?text=Summit+Shield"
      },
      {
        "businessName": "Northstar Roofing",
        "phone": "(555) 010-0164",
        "email": "hello@northstarroofing.com",
        "address": "London",
        "primaryColor": "#0F3B2E"
      }
    ]
  }'

Example Response

{
  "ok": true,
  "batchId": "24fc4b0b-d1e2-4320-b822-5bb39c4437bf",
  "batch": {
    "id": "24fc4b0b-d1e2-4320-b822-5bb39c4437bf",
    "status": "pending",
    "industry": "Roofing",
    "template_key": "lightning",
    "total_count": 3,
    "credits_reserved": 5
  },
  "creditsReserved": 5,
  "creditsRemaining": 42
}

Deprecated Google Identifier Row Format

The older google_cid and google_place_id row format is still accepted for existing integrations, but it is deprecated and scheduled for removal on July 7, 2026.

Prefer the businessName / business_name format shown above for all new integrations.

Deprecated row fields:

FieldTypeRequiredNotes
googleCid or google_cidstringRequired if no business name or place ID is sentGoogle CID. Send only one Google identifier per row.
googlePlaceId or google_place_idstringRequired if no business name or CID is sentGoogle Place ID. Send only one Google identifier per row.

Deprecated example:

{
  "industry": "Roofing",
  "templateKey": "lightning",
  "rows": [
    {
      "google_cid": "12345678901234567890"
    },
    {
      "google_place_id": "ChIJN1t_tDeuEmsRUsoyG83frY4"
    }
  ]
}

If a row includes both a business name and a Google identifier, the Google identifier is still stored and may be used for enrichment. Do not send both google_cid and google_place_id on the same row.

Process A Batch

POST /api/lead-gen/batches/{batchId}/process

Processes queued rows for a batch.

Request body:

{
  "limit": 25
}

Example response:

{
  "ok": true,
  "batchId": "24fc4b0b-d1e2-4320-b822-5bb39c4437bf",
  "processed": 5,
  "completed": 5,
  "failed": 0,
  "status": "completed"
}

Get A Batch

GET /api/lead-gen/batches/{batchId}

Returns the batch plus its items. Completed items include the generated public URL and saved site state.

Example response shape:

{
  "ok": true,
  "batch": {
    "id": "24fc4b0b-d1e2-4320-b822-5bb39c4437bf",
    "status": "completed",
    "industry": "Roofing",
    "credits_reserved": 5
  },
  "items": [
    {
      "id": "9578efdb-2c93-44bd-8e11-e1a99e25fb3f",
      "status": "completed",
      "business_name": "RidgeLine Roofing",
      "public_url": "https://lg.temphost024.com/lead-gen/ridgeline-roofing",
      "primary_color": "#0B1F3A",
      "logo_url": "https://placehold.co/360x120/0B1F3A/FFFFFF.png?text=RidgeLine+Roofing",
      "template_key": "lightning"
    }
  ]
}

List Batches

GET /api/lead-gen/batches

Returns recent Lead Gen V2 batches for the authenticated account.

Errors

Common error responses:

StatusMeaning
400Invalid request body, invalid row, unsupported field, or a row with no business_name, google_cid, or google_place_id.
401Missing or invalid bearer API key.
403Lead Gen access is not enabled, credit account is missing, or credits are insufficient.
409Credit reservation race or retryable reservation failure.
500Unexpected generation or server error.

Error response shape:

{
  "ok": false,
  "error": "Invalid lead-gen batch rows",
  "details": [
    "Row 1 must include business_name."
  ]
}

Notes

  • Use templateKey: "lightning" for the current Lead Gen V2 design.
  • Template selection is top-level only. Row-level template fields are not supported.
  • Numeric template IDs are not part of the public Lead Gen V2 API.
  • Use row-level primaryColor when each generated site needs a different brand color.
  • Use row-level logoUrl when a CSV or API request includes a business-specific logo.
  • If logoUrl is empty, Lightning shows the default placeholder logo.
  • phone, email, and address are optional.
  • address can be a full street address, city/state, or a broad service area.
  • The batch service set is shared across every row in the batch.
  • Public hosted URLs may require deployment/sync depending on the current environment. Local development URLs can be used for preview testing.