Create Lead
This endpoint creates a new lead associated with your organization. It is typically invoked by a flow stage, a form submission, or directly by your integration.
πΉ Endpoint Detailsβ
POST /api/v1/leads
π Authenticationβ
| Header | Required | Description |
|---|---|---|
| Content-Type | Yes | Must be application/json |
| Authorization | Yes | Format: ONLIVESITE Credential:ONLIVEAccessKeyId, Signature=CalculatedSignature |
π Request Bodyβ
| Field | Type | Required | Description |
|---|---|---|---|
phone | string | Conditional | Lead's phone number. Required when email is not provided |
email | string (email) | Conditional | Lead's email address. Required when phone is not provided |
name | string | No | Lead's full name |
firstName | string | No | Lead's first name |
lastName | string | No | Lead's last name |
userGroupId | string (UUID) | No | UUID of the user group the lead is routed to |
labels | array of strings | No | Free-form labels (no special characters) |
extraFields | object | No | Custom metadata bag |
location | object | No | Geo location captured at lead capture time |
device | object | No | Device fingerprint captured at lead capture time |
origin | object | No | Origin information captured at lead capture time |
status | string | No | Lead status label (currently only created) |
organizationId | string (UUID) | No | Deprecated β server derives from the security context |
userId | string (UUID) | No | Deprecated β use actorIds via update for multi-agent assignment |
π€ Request Exampleβ
curl -X POST "https://openapi.onlive.site/api/v1/leads" \
-H "Content-Type: application/json" \
-H "Authorization: ONLIVESITE Credential:ONLIVEAccessKeyId, Signature=CalculatedSignature" \
-d '{
"name": "John Doe",
"firstName": "John",
"lastName": "Doe",
"email": "<[email protected]>",
"phone": "+33612345678",
"userGroupId": "550e8400-e29b-41d4-a716-446655440000",
"labels": [
"hotlead",
"enterprise"
],
"extraFields": {
"source": "landing-page",
"campaign": "spring-2026"
},
"location": {
"country": "FR",
"city": "Paris"
},
"device": {
"type": "mobile",
"os": "iOS"
},
"origin": {
"name": "Website contact form",
"channel": "web"
}
}'
π₯ Responseβ
Success Response (201 Created)β
| Field | Type | Description |
|---|---|---|
id | string (UUID) | Unique identifier for the newly created lead |
organizationId | string (UUID) | Organization ID |
organizationName | string | Denormalized organization name |
name | string | Lead's full name |
firstName | string | Lead's first name |
lastName | string | Lead's last name |
phone | string | Lead's phone |
email | string | Lead's email |
status | enum | Lead status |
userGroupId | string (UUID) | Assigned user group ID |
userGroup | string | Denormalized user group name |
actorIds | array of strings | Assigned agent IDs |
labels | array of strings | Labels |
extraFields | object | Custom metadata |
qualification | number (0-1) | Lead qualification score |
sentToIntegration | boolean | Whether the lead has been forwarded to integration |
externalId | string | External identifier |
device | string (UUID) | Primary device ID |
location | string (UUID) | Primary location ID |
origin | string (UUID) | Primary origin ID |
locations | array of objects | All location records |
devices | array of objects | All device records |
origins | array of objects | All origin records |
interactions | array of objects | All interactions |
historics | array of objects | Historic events |
createdAt | string (ISO 8601) | Creation timestamp |
updatedAt | string (ISO 8601) | Last update timestamp |
See Lead Properties for the full schema and sub-entity structures.
Response Exampleβ
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"organizationName": "Acme Inc.",
"name": "John Doe",
"firstName": "John",
"lastName": "Doe",
"phone": "+33612345678",
"status": "created",
"userGroupId": "550e8400-e29b-41d4-a716-446655440000",
"userGroup": "Sales Team",
"labels": ["hotlead", "enterprise"],
"extraFields": { "source": "landing-page" },
"qualification": 0,
"sentToIntegration": false,
"locations": [],
"devices": [],
"origins": [],
"interactions": [],
"historics": [],
"createdAt": "2025-05-13T15:00:00Z",
"updatedAt": "2025-05-13T15:00:00Z"
}
β Error Responsesβ
This endpoint follows the standard error format.
π Validation Rulesβ
- Contact channel
- At least one of
phoneoremailmust be provided emailis lowercased and validated against RFC format when presentphonewhitespace is stripped when present
- At least one of
- Format
userGroupIdmust be a valid UUIDorganizationId/userId(deprecated) must be valid UUIDs when present
- Labels
- Cannot contain special characters:
^ ` ~ ! @ # $ % ^ & * ( ) | + - = ? ; : ' " , . < > { } [ ] \ /and spaces
- Cannot contain special characters:
- Objects
extraFields,location,device,originmust be objects when present
π‘ Best Practicesβ
- Contact
- Always send at least
emailorphoneβ never both empty - Send
name+firstName/lastNamewhen available to enrich the lead
- Always send at least
- Capture context
- Use
location,device,originto enrich at lead capture time - Use
extraFieldsfor integration-specific data
- Use
- Classification
- Set
labels(no special chars) for filtering and routing - Pre-assign
userGroupIdto route the lead to the right team
- Set
- Avoid deprecated fields
- Do not send
organizationId(server-derived) - Do not send
userId(useactorIdsvia update)
- Do not send
π Notesβ
- The
organizationIdis enforced server-side from the security context sentToIntegrationdefaults tofalsequalificationdefaults to0- Sub-entity lists (
locations,devices,origins,interactions,historics) are server-populated
β Common Use Casesβ
- π Form Submissions: Capture leads from a "Contact us" form
- π Flow Integrations: Persist leads generated by an Onlive flow stage
- π§© CRM Sync: Use
externalIdto link with your CRM - π Segmentation: Apply
labelsto segment by source or campaign