Customers
Create customer
Create a customer and attribute them to an affiliate partner for commission tracking
POST
/
v1
/
customers
Create customer
curl --request POST \
--url https://api.example.com/v1/customersimport requests
url = "https://api.example.com/v1/customers"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/customers', 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/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/customers"
req, _ := http.NewRequest("POST", url, nil)
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/customers")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"key": "customer_123",
"partner": "partner_123",
"deleted": false,
"name": "Alice",
"surname": "Brown",
"email": "[email protected]",
"status": "active",
"created_at": "2025-05-02T16:12:39.000000Z",
"updated_at": "2025-05-02T16:12:39.000000Z",
"deleted_at": null,
"tags": [
{
"value": "new"
}
]
},
"status": 1
}
Endpoint
POST https://api.partnero.com/v1/customers
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Yes | Unique customer identifier (use account ID or email) |
email | string | No | Customer’s email address |
name | string | No | Customer’s first name |
surname | string | No | Customer’s last name |
tags | array | No | Tags to associate with the customer |
partner.key | string | Yes* | Partner’s referral key (from partnero_partner cookie or URL) |
partner.id | string | Yes* | Partner’s ID (alternative to key) |
partner.email | string | Yes* | Partner’s email (alternative to key) |
options.referral_url | string | No | Referral URL for custom link attribution |
partner.key, partner.id, or partner.email.
Request
cURL
curl --location 'https://api.partnero.com/v1/customers' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"partner": {
"key": "ref_123"
},
"key": "customer_123",
"email": "[email protected]",
"name": "Alice",
"surname": "Brown",
"tags": ["new"]
}'
Response
{
"data": {
"key": "customer_123",
"partner": "partner_123",
"deleted": false,
"name": "Alice",
"surname": "Brown",
"email": "[email protected]",
"status": "active",
"created_at": "2025-05-02T16:12:39.000000Z",
"updated_at": "2025-05-02T16:12:39.000000Z",
"deleted_at": null,
"tags": [
{
"value": "new"
}
]
},
"status": 1
}
The
partner.key is stored in the partnero_partner cookie when a visitor clicks a referral link. Use the PartneroJS script to automatically capture this.Error responses
| Status | Error | Solution |
|---|---|---|
| 400 | Invalid partner key | Verify the partner exists in your program |
| 422 | Validation error | Check required fields (key, partner identification) |
| 422 | Duplicate key | Customer with this key already exists |
⌘I
Create customer
curl --request POST \
--url https://api.example.com/v1/customersimport requests
url = "https://api.example.com/v1/customers"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/customers', 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/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/customers"
req, _ := http.NewRequest("POST", url, nil)
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/customers")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"key": "customer_123",
"partner": "partner_123",
"deleted": false,
"name": "Alice",
"surname": "Brown",
"email": "[email protected]",
"status": "active",
"created_at": "2025-05-02T16:12:39.000000Z",
"updated_at": "2025-05-02T16:12:39.000000Z",
"deleted_at": null,
"tags": [
{
"value": "new"
}
]
},
"status": 1
}
