Utwórz kontakt
curl --request POST \
--url https://api.example.com/api/v1/contacts \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"tags": [
{}
],
"list_id": 123,
"list_name": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/contacts"
payload = {
"email": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"tags": [{}],
"list_id": 123,
"list_name": "<string>"
}
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({
email: '<string>',
first_name: '<string>',
last_name: '<string>',
phone: '<string>',
tags: [{}],
list_id: 123,
list_name: '<string>'
})
};
fetch('https://api.example.com/api/v1/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/api/v1/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([
'email' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'phone' => '<string>',
'tags' => [
[
]
],
'list_id' => 123,
'list_name' => '<string>'
]),
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/api/v1/contacts"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"list_id\": 123,\n \"list_name\": \"<string>\"\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/api/v1/contacts")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"list_id\": 123,\n \"list_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/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 \"email\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"list_id\": 123,\n \"list_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": 456,
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Smith",
"phone": "+1234567890",
"tags": ["customer", "vip"],
"lead_score": 0,
"created_at": "2025-12-30T09:00:00",
"updated_at": "2025-12-30T09:00:00"
},
"message": "Contact created successfully"
}
{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "Adres email jest wymagany"
}
}
{
"success": false,
"error": {
"code": "PERMISSION_DENIED",
"message": "Klucz API nie posiada uprawnienia 'contacts.write'"
}
}
Kontakty
Utwórz kontakt
Dodaj nowy kontakt i opcjonalnie przypisz do listy mailingowej
POST
/
api
/
v1
/
contacts
Utwórz kontakt
curl --request POST \
--url https://api.example.com/api/v1/contacts \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"tags": [
{}
],
"list_id": 123,
"list_name": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/contacts"
payload = {
"email": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"tags": [{}],
"list_id": 123,
"list_name": "<string>"
}
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({
email: '<string>',
first_name: '<string>',
last_name: '<string>',
phone: '<string>',
tags: [{}],
list_id: 123,
list_name: '<string>'
})
};
fetch('https://api.example.com/api/v1/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/api/v1/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([
'email' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'phone' => '<string>',
'tags' => [
[
]
],
'list_id' => 123,
'list_name' => '<string>'
]),
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/api/v1/contacts"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"list_id\": 123,\n \"list_name\": \"<string>\"\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/api/v1/contacts")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"list_id\": 123,\n \"list_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/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 \"email\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"list_id\": 123,\n \"list_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": 456,
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Smith",
"phone": "+1234567890",
"tags": ["customer", "vip"],
"lead_score": 0,
"created_at": "2025-12-30T09:00:00",
"updated_at": "2025-12-30T09:00:00"
},
"message": "Contact created successfully"
}
{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "Adres email jest wymagany"
}
}
{
"success": false,
"error": {
"code": "PERMISSION_DENIED",
"message": "Klucz API nie posiada uprawnienia 'contacts.write'"
}
}
Treść żądania
string
required
Adres email kontaktu (wymagany i musi być prawidłowy)
string
Imię kontaktu
string
Nazwisko kontaktu
string
Numer telefonu kontaktu
array
Tablica nazw tagów do przypisania kontaktowi
integer
ID listy mailingowej do której dodać kontakt (opcjonalne)
string
Nazwa listy mailingowej do której dodać kontakt (alternatywa dla list_id)
Odpowiedź
boolean
Wskazuje czy żądanie zakończyło się sukcesem
object
Obiekt kontaktu
Show Pola kontaktu
Show Pola kontaktu
integer
Unikalny identyfikator kontaktu
string
Adres email kontaktu
string
Imię kontaktu
string
Nazwisko kontaktu
string
Numer telefonu kontaktu
array
Tablica nazw tagów przypisanych do kontaktu
integer
Ocena potencjalnego klienta
string
Znacznik czasu utworzenia w formacie ISO 8601
string
Znacznik czasu ostatniej aktualizacji w formacie ISO 8601
string
Komunikat sukcesu
Przykład
curl -X POST https://api.mailist.com/api/v1/contacts \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Smith",
"phone": "+1234567890",
"tags": ["customer", "vip"],
"list_id": 123
}'
const response = await fetch('https://api.mailist.com/api/v1/contacts', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: 'jane@example.com',
first_name: 'Jane',
last_name: 'Smith',
phone: '+1234567890',
tags: ['customer', 'vip'],
list_id: 123
})
});
const data = await response.json();
import requests
response = requests.post(
'https://api.mailist.com/api/v1/contacts',
headers={
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'email': 'jane@example.com',
'first_name': 'Jane',
'last_name': 'Smith',
'phone': '+1234567890',
'tags': ['customer', 'vip'],
'list_id': 123
}
)
data = response.json()
Odpowiedź
{
"success": true,
"data": {
"id": 456,
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Smith",
"phone": "+1234567890",
"tags": ["customer", "vip"],
"lead_score": 0,
"created_at": "2025-12-30T09:00:00",
"updated_at": "2025-12-30T09:00:00"
},
"message": "Contact created successfully"
}
{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "Adres email jest wymagany"
}
}
{
"success": false,
"error": {
"code": "PERMISSION_DENIED",
"message": "Klucz API nie posiada uprawnienia 'contacts.write'"
}
}
