curl --request POST \
--url https://app.gomega.ai/api/agents/crm/leads/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-customer-id: <x-customer-id>' \
--data '
{
"leads": [
{
"row_ref": "<string>",
"contact_name": "<string>",
"contact_phone": "<string>",
"contact_email": "[email protected]",
"stage_slug": "<string>",
"owner_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"custom_fields": {}
}
],
"on_duplicate": "update",
"dry_run": false
}
'import requests
url = "https://app.gomega.ai/api/agents/crm/leads/bulk"
payload = {
"leads": [
{
"row_ref": "<string>",
"contact_name": "<string>",
"contact_phone": "<string>",
"contact_email": "[email protected]",
"stage_slug": "<string>",
"owner_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"custom_fields": {}
}
],
"on_duplicate": "update",
"dry_run": False
}
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({
leads: [
{
row_ref: '<string>',
contact_name: '<string>',
contact_phone: '<string>',
contact_email: '[email protected]',
stage_slug: '<string>',
owner_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
custom_fields: {}
}
],
on_duplicate: 'update',
dry_run: false
})
};
fetch('https://app.gomega.ai/api/agents/crm/leads/bulk', 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/bulk",
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([
'leads' => [
[
'row_ref' => '<string>',
'contact_name' => '<string>',
'contact_phone' => '<string>',
'contact_email' => '[email protected]',
'stage_slug' => '<string>',
'owner_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'custom_fields' => [
]
]
],
'on_duplicate' => 'update',
'dry_run' => false
]),
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/bulk"
payload := strings.NewReader("{\n \"leads\": [\n {\n \"row_ref\": \"<string>\",\n \"contact_name\": \"<string>\",\n \"contact_phone\": \"<string>\",\n \"contact_email\": \"[email protected]\",\n \"stage_slug\": \"<string>\",\n \"owner_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"custom_fields\": {}\n }\n ],\n \"on_duplicate\": \"update\",\n \"dry_run\": false\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/bulk")
.header("x-customer-id", "<x-customer-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"leads\": [\n {\n \"row_ref\": \"<string>\",\n \"contact_name\": \"<string>\",\n \"contact_phone\": \"<string>\",\n \"contact_email\": \"[email protected]\",\n \"stage_slug\": \"<string>\",\n \"owner_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"custom_fields\": {}\n }\n ],\n \"on_duplicate\": \"update\",\n \"dry_run\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gomega.ai/api/agents/crm/leads/bulk")
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 \"leads\": [\n {\n \"row_ref\": \"<string>\",\n \"contact_name\": \"<string>\",\n \"contact_phone\": \"<string>\",\n \"contact_email\": \"[email protected]\",\n \"stage_slug\": \"<string>\",\n \"owner_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"custom_fields\": {}\n }\n ],\n \"on_duplicate\": \"update\",\n \"dry_run\": false\n}"
response = http.request(request)
puts response.read_body{
"dry_run": true,
"summary": {
"total": 123,
"created": 123,
"updated": 123,
"skipped": 123,
"failed": 123
},
"results": [
{
"row_ref": "<string>",
"status": "created",
"lead_id": "<string>",
"matched_by": "email",
"errors": [
"<string>"
],
"ignored_custom_fields": [
"<string>"
]
}
],
"unknown_custom_fields": [
"<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>"
}
}{
"error": {
"type": "authentication_error",
"code": 123,
"message": "<string>"
}
}Bulk create / merge leads
Import up to 500 leads in one request. Requires the public_api:leads:write scope. Uploaded leads are inert (no downstream automation). Use dry_run: true to preview, on_duplicate to control merge behavior, and Idempotency-Key to make retries safe. Subject to a stricter per-minute rate limit than the other endpoints.
curl --request POST \
--url https://app.gomega.ai/api/agents/crm/leads/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-customer-id: <x-customer-id>' \
--data '
{
"leads": [
{
"row_ref": "<string>",
"contact_name": "<string>",
"contact_phone": "<string>",
"contact_email": "[email protected]",
"stage_slug": "<string>",
"owner_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"custom_fields": {}
}
],
"on_duplicate": "update",
"dry_run": false
}
'import requests
url = "https://app.gomega.ai/api/agents/crm/leads/bulk"
payload = {
"leads": [
{
"row_ref": "<string>",
"contact_name": "<string>",
"contact_phone": "<string>",
"contact_email": "[email protected]",
"stage_slug": "<string>",
"owner_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"custom_fields": {}
}
],
"on_duplicate": "update",
"dry_run": False
}
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({
leads: [
{
row_ref: '<string>',
contact_name: '<string>',
contact_phone: '<string>',
contact_email: '[email protected]',
stage_slug: '<string>',
owner_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
custom_fields: {}
}
],
on_duplicate: 'update',
dry_run: false
})
};
fetch('https://app.gomega.ai/api/agents/crm/leads/bulk', 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/bulk",
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([
'leads' => [
[
'row_ref' => '<string>',
'contact_name' => '<string>',
'contact_phone' => '<string>',
'contact_email' => '[email protected]',
'stage_slug' => '<string>',
'owner_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'custom_fields' => [
]
]
],
'on_duplicate' => 'update',
'dry_run' => false
]),
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/bulk"
payload := strings.NewReader("{\n \"leads\": [\n {\n \"row_ref\": \"<string>\",\n \"contact_name\": \"<string>\",\n \"contact_phone\": \"<string>\",\n \"contact_email\": \"[email protected]\",\n \"stage_slug\": \"<string>\",\n \"owner_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"custom_fields\": {}\n }\n ],\n \"on_duplicate\": \"update\",\n \"dry_run\": false\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/bulk")
.header("x-customer-id", "<x-customer-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"leads\": [\n {\n \"row_ref\": \"<string>\",\n \"contact_name\": \"<string>\",\n \"contact_phone\": \"<string>\",\n \"contact_email\": \"[email protected]\",\n \"stage_slug\": \"<string>\",\n \"owner_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"custom_fields\": {}\n }\n ],\n \"on_duplicate\": \"update\",\n \"dry_run\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gomega.ai/api/agents/crm/leads/bulk")
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 \"leads\": [\n {\n \"row_ref\": \"<string>\",\n \"contact_name\": \"<string>\",\n \"contact_phone\": \"<string>\",\n \"contact_email\": \"[email protected]\",\n \"stage_slug\": \"<string>\",\n \"owner_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"custom_fields\": {}\n }\n ],\n \"on_duplicate\": \"update\",\n \"dry_run\": false\n}"
response = http.request(request)
puts response.read_body{
"dry_run": true,
"summary": {
"total": 123,
"created": 123,
"updated": 123,
"skipped": 123,
"failed": 123
},
"results": [
{
"row_ref": "<string>",
"status": "created",
"lead_id": "<string>",
"matched_by": "email",
"errors": [
"<string>"
],
"ignored_custom_fields": [
"<string>"
]
}
],
"unknown_custom_fields": [
"<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>"
}
}{
"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.