Create a contact
curl --request POST \
--url https://lancepilot.com/api/v3/workspaces/{workspace}/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"number": "+14155550123",
"name": "John Doe",
"email": "[email protected]",
"gender": "male"
}
'import requests
url = "https://lancepilot.com/api/v3/workspaces/{workspace}/contacts"
payload = {
"number": "+14155550123",
"name": "John Doe",
"email": "[email protected]",
"gender": "male"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
number: '+14155550123',
name: 'John Doe',
email: '[email protected]',
gender: 'male'
})
};
fetch('https://lancepilot.com/api/v3/workspaces/{workspace}/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://lancepilot.com/api/v3/workspaces/{workspace}/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([
'number' => '+14155550123',
'name' => 'John Doe',
'email' => '[email protected]',
'gender' => 'male'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://lancepilot.com/api/v3/workspaces/{workspace}/contacts"
payload := strings.NewReader("{\n \"number\": \"+14155550123\",\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"gender\": \"male\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://lancepilot.com/api/v3/workspaces/{workspace}/contacts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"number\": \"+14155550123\",\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"gender\": \"male\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lancepilot.com/api/v3/workspaces/{workspace}/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"number\": \"+14155550123\",\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"gender\": \"male\"\n}"
response = http.request(request)
puts response.read_body{
"status": 201,
"message": "Resource created successfully.",
"data": {}
}{
"message": "Validation error",
"errors": {}
}Contacts
Add Contacts
Create a new contact in the workspace.
POST
/
workspaces
/
{workspace}
/
contacts
Create a contact
curl --request POST \
--url https://lancepilot.com/api/v3/workspaces/{workspace}/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"number": "+14155550123",
"name": "John Doe",
"email": "[email protected]",
"gender": "male"
}
'import requests
url = "https://lancepilot.com/api/v3/workspaces/{workspace}/contacts"
payload = {
"number": "+14155550123",
"name": "John Doe",
"email": "[email protected]",
"gender": "male"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
number: '+14155550123',
name: 'John Doe',
email: '[email protected]',
gender: 'male'
})
};
fetch('https://lancepilot.com/api/v3/workspaces/{workspace}/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://lancepilot.com/api/v3/workspaces/{workspace}/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([
'number' => '+14155550123',
'name' => 'John Doe',
'email' => '[email protected]',
'gender' => 'male'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://lancepilot.com/api/v3/workspaces/{workspace}/contacts"
payload := strings.NewReader("{\n \"number\": \"+14155550123\",\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"gender\": \"male\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://lancepilot.com/api/v3/workspaces/{workspace}/contacts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"number\": \"+14155550123\",\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"gender\": \"male\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lancepilot.com/api/v3/workspaces/{workspace}/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"number\": \"+14155550123\",\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"gender\": \"male\"\n}"
response = http.request(request)
puts response.read_body{
"status": 201,
"message": "Resource created successfully.",
"data": {}
}{
"message": "Validation error",
"errors": {}
}JSON (Basic Contact)
{
"number": "+14155550123",
"name": "John Doe",
"email": "[email protected]",
"gender": "male"
}
Multipart Form Data (Extended Contact)
If you want to upload an avatar image, assign groups, or set status, you must send the request asmultipart/form-data. Example:
POST /contacts
Content-Type: multipart/form-data
number=+14155550123
name=John Doe
[email protected]
gender=male
status=1
avatar=@/path/to/image.png
contact_groups[]=12
contact_groups[]=15
📝 Field Requirements
| Field | Type | Required | Notes |
|---|---|---|---|
number | string | Yes | WhatsApp phone number (must be unique in workspace). |
name | string (max 50) | No | Contact’s display name. Defaults to Unknown if not provided. |
email | string (email) | No | Contact’s email address. |
gender | enum(male,female,other) | No | Gender of contact. |
status | boolean | No | Defaults to true. Only available in form-data requests. |
avatar | file (image, ≤2MB) | No | Upload contact avatar (form-data only). |
contact_groups | array of integers | No | Group IDs to assign contact into (form-data only, workspace scoped). |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID of the workspace.
Body
application/json
The WhatsApp phone number of the contact
Example:
"+14155550123"
Maximum string length:
50Example:
"John Doe"
Example:
Available options:
male, female, other Example:
"male"
⌘I