curl --request POST \
--url https://app.gomega.ai/api/agents/crm/leads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-customer-id: <x-customer-id>' \
--data '
{
"contact_name": "<string>",
"contact_phone": "<string>",
"contact_email": "[email protected]",
"stage_slug": "<string>",
"custom_fields": {}
}
'import requests
url = "https://app.gomega.ai/api/agents/crm/leads"
payload = {
"contact_name": "<string>",
"contact_phone": "<string>",
"contact_email": "[email protected]",
"stage_slug": "<string>",
"custom_fields": {}
}
headers = {
"x-customer-id": "<x-customer-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-customer-id': '<x-customer-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
contact_name: '<string>',
contact_phone: '<string>',
contact_email: '[email protected]',
stage_slug: '<string>',
custom_fields: {}
})
};
fetch('https://app.gomega.ai/api/agents/crm/leads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.gomega.ai/api/agents/crm/leads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contact_name' => '<string>',
'contact_phone' => '<string>',
'contact_email' => '[email protected]',
'stage_slug' => '<string>',
'custom_fields' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-customer-id: <x-customer-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.gomega.ai/api/agents/crm/leads"
payload := strings.NewReader("{\n \"contact_name\": \"<string>\",\n \"contact_phone\": \"<string>\",\n \"contact_email\": \"[email protected]\",\n \"stage_slug\": \"<string>\",\n \"custom_fields\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-customer-id", "<x-customer-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.gomega.ai/api/agents/crm/leads")
.header("x-customer-id", "<x-customer-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contact_name\": \"<string>\",\n \"contact_phone\": \"<string>\",\n \"contact_email\": \"[email protected]\",\n \"stage_slug\": \"<string>\",\n \"custom_fields\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gomega.ai/api/agents/crm/leads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-customer-id"] = '<x-customer-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact_name\": \"<string>\",\n \"contact_phone\": \"<string>\",\n \"contact_email\": \"[email protected]\",\n \"stage_slug\": \"<string>\",\n \"custom_fields\": {}\n}"
response = http.request(request)
puts response.read_body{
"lead": {
"id": "<string>",
"customer_id": "<string>",
"source_platform": "<string>",
"source_type": "<string>",
"status": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"contact_name": "<string>",
"contact_phone": "<string>",
"contact_email": "<string>",
"score": 123,
"qualified": true,
"current_stage": {
"id": "<string>",
"slug": "<string>",
"name": "<string>",
"color": "<string>"
},
"owner": {
"id": "<string>",
"name": "<string>",
"role_name": "<string>"
},
"last_interaction_at": "2023-11-07T05:31:56Z",
"interaction_count": 123,
"custom_fields": {}
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}Create a single lead
Creates one lead (or merges into an existing lead by email / phone-last-10). Requires the public_api:leads:write scope. Send an Idempotency-Key so a retry returns the original result instead of double-creating.
curl --request POST \
--url https://app.gomega.ai/api/agents/crm/leads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-customer-id: <x-customer-id>' \
--data '
{
"contact_name": "<string>",
"contact_phone": "<string>",
"contact_email": "[email protected]",
"stage_slug": "<string>",
"custom_fields": {}
}
'import requests
url = "https://app.gomega.ai/api/agents/crm/leads"
payload = {
"contact_name": "<string>",
"contact_phone": "<string>",
"contact_email": "[email protected]",
"stage_slug": "<string>",
"custom_fields": {}
}
headers = {
"x-customer-id": "<x-customer-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-customer-id': '<x-customer-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
contact_name: '<string>',
contact_phone: '<string>',
contact_email: '[email protected]',
stage_slug: '<string>',
custom_fields: {}
})
};
fetch('https://app.gomega.ai/api/agents/crm/leads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.gomega.ai/api/agents/crm/leads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contact_name' => '<string>',
'contact_phone' => '<string>',
'contact_email' => '[email protected]',
'stage_slug' => '<string>',
'custom_fields' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-customer-id: <x-customer-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.gomega.ai/api/agents/crm/leads"
payload := strings.NewReader("{\n \"contact_name\": \"<string>\",\n \"contact_phone\": \"<string>\",\n \"contact_email\": \"[email protected]\",\n \"stage_slug\": \"<string>\",\n \"custom_fields\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-customer-id", "<x-customer-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.gomega.ai/api/agents/crm/leads")
.header("x-customer-id", "<x-customer-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contact_name\": \"<string>\",\n \"contact_phone\": \"<string>\",\n \"contact_email\": \"[email protected]\",\n \"stage_slug\": \"<string>\",\n \"custom_fields\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gomega.ai/api/agents/crm/leads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-customer-id"] = '<x-customer-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact_name\": \"<string>\",\n \"contact_phone\": \"<string>\",\n \"contact_email\": \"[email protected]\",\n \"stage_slug\": \"<string>\",\n \"custom_fields\": {}\n}"
response = http.request(request)
puts response.read_body{
"lead": {
"id": "<string>",
"customer_id": "<string>",
"source_platform": "<string>",
"source_type": "<string>",
"status": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"contact_name": "<string>",
"contact_phone": "<string>",
"contact_email": "<string>",
"score": 123,
"qualified": true,
"current_stage": {
"id": "<string>",
"slug": "<string>",
"name": "<string>",
"color": "<string>"
},
"owner": {
"id": "<string>",
"name": "<string>",
"role_name": "<string>"
},
"last_interaction_at": "2023-11-07T05:31:56Z",
"interaction_count": 123,
"custom_fields": {}
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}Authorizations
Admin-issued Personal Access Token, e.g. Authorization: Bearer mega_<64 hex>. The key carries scopes (public_api:leads:read, public_api:leads:write, public_api:webhooks:manage) and is locked to one customer.
Headers
The customer this request acts on. Must match the customer your key is locked to.
Client-generated unique key. Replaying the same key returns the original stored response instead of creating duplicates. Scoped per customer + endpoint; reuse with a different body returns 409.
Body
At least one of contact_name, contact_phone, contact_email is required.
google_ads, meta_ads, google_organic, direct, referral, hubspot, zoho, ghl, shopify, zenmaid, lead_docket, salesforce form, phone_call, email, chat, sms, manual, import Map of custom-field slug to a scalar value (string | number | boolean | null).
Show child attributes
Show child attributes
Response
The created (or merged) lead.
Show child attributes
Show child attributes