Import Contacts
curl --request POST \
--url https://api.example.com/v1/import/contacts \
--header 'Content-Type: application/json' \
--data '
{
"rows": [
{}
],
"csv": "<string>",
"has_header": true,
"mapping": {},
"update_existing": true,
"tags": [
{}
]
}
'import requests
url = "https://api.example.com/v1/import/contacts"
payload = {
"rows": [{}],
"csv": "<string>",
"has_header": True,
"mapping": {},
"update_existing": True,
"tags": [{}]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
rows: [{}],
csv: '<string>',
has_header: true,
mapping: {},
update_existing: true,
tags: [{}]
})
};
fetch('https://api.example.com/v1/import/contacts', 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://api.example.com/v1/import/contacts",
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([
'rows' => [
[
]
],
'csv' => '<string>',
'has_header' => true,
'mapping' => [
],
'update_existing' => true,
'tags' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://api.example.com/v1/import/contacts"
payload := strings.NewReader("{\n \"rows\": [\n {}\n ],\n \"csv\": \"<string>\",\n \"has_header\": true,\n \"mapping\": {},\n \"update_existing\": true,\n \"tags\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.example.com/v1/import/contacts")
.header("Content-Type", "application/json")
.body("{\n \"rows\": [\n {}\n ],\n \"csv\": \"<string>\",\n \"has_header\": true,\n \"mapping\": {},\n \"update_existing\": true,\n \"tags\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/import/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"rows\": [\n {}\n ],\n \"csv\": \"<string>\",\n \"has_header\": true,\n \"mapping\": {},\n \"update_existing\": true,\n \"tags\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"job_id": "<string>",
"status": "<string>",
"created_count": 123,
"updated_count": 123,
"skipped_count": 123,
"errors": [
{}
]
}
}Import & Export
Import Contacts
Bulk-import contacts from a JSON array or CSV payload
POST
/
v1
/
import
/
contacts
Import Contacts
curl --request POST \
--url https://api.example.com/v1/import/contacts \
--header 'Content-Type: application/json' \
--data '
{
"rows": [
{}
],
"csv": "<string>",
"has_header": true,
"mapping": {},
"update_existing": true,
"tags": [
{}
]
}
'import requests
url = "https://api.example.com/v1/import/contacts"
payload = {
"rows": [{}],
"csv": "<string>",
"has_header": True,
"mapping": {},
"update_existing": True,
"tags": [{}]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
rows: [{}],
csv: '<string>',
has_header: true,
mapping: {},
update_existing: true,
tags: [{}]
})
};
fetch('https://api.example.com/v1/import/contacts', 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://api.example.com/v1/import/contacts",
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([
'rows' => [
[
]
],
'csv' => '<string>',
'has_header' => true,
'mapping' => [
],
'update_existing' => true,
'tags' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://api.example.com/v1/import/contacts"
payload := strings.NewReader("{\n \"rows\": [\n {}\n ],\n \"csv\": \"<string>\",\n \"has_header\": true,\n \"mapping\": {},\n \"update_existing\": true,\n \"tags\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.example.com/v1/import/contacts")
.header("Content-Type", "application/json")
.body("{\n \"rows\": [\n {}\n ],\n \"csv\": \"<string>\",\n \"has_header\": true,\n \"mapping\": {},\n \"update_existing\": true,\n \"tags\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/import/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"rows\": [\n {}\n ],\n \"csv\": \"<string>\",\n \"has_header\": true,\n \"mapping\": {},\n \"update_existing\": true,\n \"tags\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"job_id": "<string>",
"status": "<string>",
"created_count": 123,
"updated_count": 123,
"skipped_count": 123,
"errors": [
{}
]
}
}Request
Supply either a structuredrows array or a raw csv string. When CSV is provided, supply a mapping that maps CSV column names to contact fields. Imports are processed synchronously for up to 500 rows; larger imports are queued and can be tracked via the returned job_id.
Headers
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
string
Strongly recommended for imports. Same key returns the original result (including
job_id) within 24 hours.Body Parameters
array
Array of contact objects. Each object accepts the same fields as
POST /v1/contacts. Provide either rows or csv.string
Raw CSV text. First line is treated as headers unless
has_header is false. Provide either rows or csv.boolean
default:"true"
Applies only to CSV imports.
object
CSV-only. Maps CSV header names to contact field names (e.g.
{ "Email Address": "email", "Full Name": "full_name" }). Unknown columns are ignored.boolean
default:"false"
When
true, rows with matching email or phone are updated; when false, they are skipped.array
Optional array of tag strings applied to every imported row.
Response
object
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and X-Request-ID. Large imports emit an import.completed webhook event when done.
curl -X POST \
https://data.leadlex.com/functions/v1/api-gateway/v1/import/contacts \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"rows": [
{ "full_name": "Jane Doe", "email": "jane@acme.com" },
{ "full_name": "Bob Smith", "email": "bob@beta.com" }
]
}'
import requests
API_KEY = "wbk_your_api_key_here"
BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"
rows = [
{"full_name": "Jane Doe", "email": "jane@acme.com"},
{"full_name": "Bob Smith", "email": "bob@beta.com"},
]
r = requests.post(
f"{BASE_URL}/v1/import/contacts",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={"rows": rows, "update_existing": True},
)
print(r.json()["data"])
const res = await fetch(
'https://data.leadlex.com/functions/v1/api-gateway/v1/import/contacts',
{
method: 'POST',
headers: {
'Authorization': 'Bearer wbk_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
rows: [
{ full_name: 'Jane Doe', email: 'jane@acme.com' },
{ full_name: 'Bob Smith', email: 'bob@beta.com' },
],
}),
}
);
const { data } = await res.json();
console.log(data);
Example Response
{
"data": {
"job_id": "imp_01HY1",
"status": "completed",
"created_count": 2,
"updated_count": 0,
"skipped_count": 0,
"errors": []
}
}
Errors
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Neither rows nor csv provided, or mapping is malformed |
| 401 | invalid_key | Invalid or expired API key |
| 403 | insufficient_permissions | Missing write:contacts permission |
| 413 | payload_too_large | Payload exceeds 20 MB |
| 429 | rate_limited | Rate limit exceeded |