Import Companies
curl --request POST \
--url https://api.example.com/v1/import/companies \
--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/companies"
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/companies', 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/companies",
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/companies"
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/companies")
.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/companies")
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 Companies
Bulk-import companies from a JSON array or CSV payload
POST
/
v1
/
import
/
companies
Import Companies
curl --request POST \
--url https://api.example.com/v1/import/companies \
--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/companies"
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/companies', 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/companies",
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/companies"
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/companies")
.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/companies")
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 arows array or a raw csv string. Imports up to 500 rows are synchronous; larger payloads are queued and tracked via job_id.
Headers
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
string
Strongly recommended. Returns the original result (including
job_id) within 24 hours when replayed.Body Parameters
array
Array of company objects with the same fields accepted by
POST /v1/companies.string
Raw CSV string. Provide either
rows or csv.boolean
default:"true"
Applies only to CSV imports.
object
CSV-only. Maps CSV header names to company fields (e.g.
{ "Company": "name", "Website": "domain" }).boolean
default:"false"
When
true, rows with matching domain are updated; when false, they are skipped.array
Optional array of tag strings applied to every imported company.
Response
object
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and X-Request-ID.
curl -X POST \
https://data.leadlex.com/functions/v1/api-gateway/v1/import/companies \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"rows": [
{ "name": "Acme Corp", "domain": "acme.com", "industry": "Legal Services" }
]
}'
import requests
API_KEY = "wbk_your_api_key_here"
BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"
rows = [
{"name": "Acme Corp", "domain": "acme.com", "industry": "Legal Services"},
{"name": "Beta LLP", "domain": "beta.com"},
]
r = requests.post(
f"{BASE_URL}/v1/import/companies",
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/companies',
{
method: 'POST',
headers: {
'Authorization': 'Bearer wbk_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
rows: [{ name: 'Acme Corp', domain: 'acme.com' }],
}),
}
);
const { data } = await res.json();
console.log(data);
Example Response
{
"data": {
"job_id": "imp_co_01HY1",
"status": "completed",
"created_count": 1,
"updated_count": 0,
"skipped_count": 0,
"errors": []
}
}
Errors
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Neither rows nor csv provided |
| 401 | invalid_key | Invalid or expired API key |
| 403 | insufficient_permissions | Missing write:companies permission |
| 413 | payload_too_large | Payload exceeds 20 MB |
| 429 | rate_limited | Rate limit exceeded |