Customers
Create customer
Developer API operation for POST /dev/v1/customers.
POST
/
dev
/
v1
/
customers
Create customer
curl --request POST \
--url https://api.shoppex.io/dev/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "[email protected]",
"name": "Berlin Buyer",
"phone": "+491234567",
"country_code": "DE",
"street_address": "Teststrasse 1",
"city": "Berlin",
"postal_code": "10115",
"upsert": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '[email protected]',
name: 'Berlin Buyer',
phone: '+491234567',
country_code: 'DE',
street_address: 'Teststrasse 1',
city: 'Berlin',
postal_code: '10115',
upsert: true
})
};
fetch('https://api.shoppex.io/dev/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.shoppex.io/dev/v1/customers"
payload = {
"email": "[email protected]",
"name": "Berlin Buyer",
"phone": "+491234567",
"country_code": "DE",
"street_address": "Teststrasse 1",
"city": "Berlin",
"postal_code": "10115",
"upsert": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.shoppex.io/dev/v1/customers",
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' => '[email protected]',
'name' => 'Berlin Buyer',
'phone' => '+491234567',
'country_code' => 'DE',
'street_address' => 'Teststrasse 1',
'city' => 'Berlin',
'postal_code' => '10115',
'upsert' => true
]),
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://api.shoppex.io/dev/v1/customers"
payload := strings.NewReader("{\n \"email\": \"[email protected]\",\n \"name\": \"Berlin Buyer\",\n \"phone\": \"+491234567\",\n \"country_code\": \"DE\",\n \"street_address\": \"Teststrasse 1\",\n \"city\": \"Berlin\",\n \"postal_code\": \"10115\",\n \"upsert\": true\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))
}{
"data": {
"id": "cus_1",
"shop_id": "shop_1",
"email": "[email protected]",
"name": "Berlin Buyer",
"surname": null,
"phone": "+491234567",
"phone_country_code": null,
"country_code": "DE",
"street_address": "Teststrasse 1",
"additional_address_info": null,
"city": "Berlin",
"postal_code": "10115",
"state": null,
"affiliate_revenue": 0,
"affiliate_revenue_currency": "USD",
"affiliate_revenue_percent": 0,
"customer_balance": 12,
"customer_balance_currency": "EUR",
"created_at": 1710686400
}
}Authorizations
Use your Shoppex API key in the Authorization header.
Body
application/jsonmultipart/form-datatext/plain
Response
200 - application/json
Successful response
⌘I
Create customer
curl --request POST \
--url https://api.shoppex.io/dev/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "[email protected]",
"name": "Berlin Buyer",
"phone": "+491234567",
"country_code": "DE",
"street_address": "Teststrasse 1",
"city": "Berlin",
"postal_code": "10115",
"upsert": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '[email protected]',
name: 'Berlin Buyer',
phone: '+491234567',
country_code: 'DE',
street_address: 'Teststrasse 1',
city: 'Berlin',
postal_code: '10115',
upsert: true
})
};
fetch('https://api.shoppex.io/dev/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.shoppex.io/dev/v1/customers"
payload = {
"email": "[email protected]",
"name": "Berlin Buyer",
"phone": "+491234567",
"country_code": "DE",
"street_address": "Teststrasse 1",
"city": "Berlin",
"postal_code": "10115",
"upsert": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.shoppex.io/dev/v1/customers",
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' => '[email protected]',
'name' => 'Berlin Buyer',
'phone' => '+491234567',
'country_code' => 'DE',
'street_address' => 'Teststrasse 1',
'city' => 'Berlin',
'postal_code' => '10115',
'upsert' => true
]),
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://api.shoppex.io/dev/v1/customers"
payload := strings.NewReader("{\n \"email\": \"[email protected]\",\n \"name\": \"Berlin Buyer\",\n \"phone\": \"+491234567\",\n \"country_code\": \"DE\",\n \"street_address\": \"Teststrasse 1\",\n \"city\": \"Berlin\",\n \"postal_code\": \"10115\",\n \"upsert\": true\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))
}{
"data": {
"id": "cus_1",
"shop_id": "shop_1",
"email": "[email protected]",
"name": "Berlin Buyer",
"surname": null,
"phone": "+491234567",
"phone_country_code": null,
"country_code": "DE",
"street_address": "Teststrasse 1",
"additional_address_info": null,
"city": "Berlin",
"postal_code": "10115",
"state": null,
"affiliate_revenue": 0,
"affiliate_revenue_currency": "USD",
"affiliate_revenue_percent": 0,
"customer_balance": 12,
"customer_balance_currency": "EUR",
"created_at": 1710686400
}
}