Skip to content

Create a lead

POST
/leads
Code sample: Shell / cURL
curl --request POST \
--url https://example.com/api/v1/leads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "amount": 1, "companyName": "example", "contactEmail": "hello@example.com", "contactFirstName": "example", "contactLastName": "example", "leadSourceId": "example", "legalName": "example", "ownerId": "example", "referrerClientId": "example", "referrerContactId": "example", "submissionKey": "example", "title": "example" }'

Creates a new Lead company + contact person + Deal in one operation. Finds or creates the client by the contact’s exact email; the same email never duplicates the company. referrerClientId (with commissions.manage) records who referred it, and referrerContactId the rep at that company; a rep that is not its contact is refused with 422. submissionKey makes the call idempotent: a key that already opened a deal returns that deal with 200 and writes nothing, or 422 when the deal is outside the caller’s deal scope. Requires deals.create.

Media typeapplication/json
object
amount
number
companyName
required
string
>= 1 characters <= 255 characters
contactEmail
required
string format: email
/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/
contactFirstName
required
string
>= 1 characters <= 100 characters
contactLastName
string
<= 100 characters
leadSourceId
string
legalName

The company’s legal name, shown on invoices and on the contract page. Optional: a lead whose legal name is not known yet is created without it. Saved only on a company the lead creates; a company that already exists keeps its own.

string
<= 255 characters
ownerId
string
referrerClientId
string
referrerContactId

The rep who sent the lead: a contact of referrerClientId, which it requires. Never changes a commission.

string
submissionKey

The caller’s own key for this submission. The first call with a key opens the deal (201); every later call with it returns that same deal (200) and writes nothing.

string
>= 1 characters <= 200 characters
title
string
<= 255 characters

Example generated

{
"amount": 1,
"companyName": "example",
"contactEmail": "hello@example.com",
"contactFirstName": "example",
"contactLastName": "example",
"leadSourceId": "example",
"legalName": "example",
"ownerId": "example",
"referrerClientId": "example",
"referrerContactId": "example",
"submissionKey": "example",
"title": "example"
}

The submission key had already opened this deal; nothing was written.

Media typeapplication/json
object
data
required
object
clientId
required
string
clientName
required
string
createdNewClient
required
boolean
dealId
required
string

Example generated

{
"data": {
"clientId": "example",
"clientName": "example",
"createdNewClient": true,
"dealId": "example"
}
}

Lead and deal created.

Media typeapplication/json
object
data
required
object
clientId
required
string
clientName
required
string
createdNewClient
required
boolean
dealId
required
string

Example generated

{
"data": {
"clientId": "example",
"clientName": "example",
"createdNewClient": true,
"dealId": "example"
}
}

Validation error. Parse failures include field paths and expectations.

Media typeapplication/json

Validation error with safe field paths and expected values; submitted values are never returned.

object
error
required
object
code
required

Stable machine-readable error code.

string
issues
Array<object>
object
expected
required
string
message
required
string
path
required
Array<string | number>
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Forbidden.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Invalid input.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.