Create customer
curl --request POST \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"profile_image_id": "<string>",
"loyalty_tier_id": "<string>",
"loyalty_tier_starting_point": 123,
"business": {
"name": "<string>",
"business_type": "<string>",
"gstin": "<string>"
},
"kyc_documents": [
{
"document_number": "<string>",
"document_type_id": "<string>",
"note": "<string>",
"file": "<string>"
}
]
}
'import requests
url = "https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers"
payload = {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"profile_image_id": "<string>",
"loyalty_tier_id": "<string>",
"loyalty_tier_starting_point": 123,
"business": {
"name": "<string>",
"business_type": "<string>",
"gstin": "<string>"
},
"kyc_documents": [
{
"document_number": "<string>",
"document_type_id": "<string>",
"note": "<string>",
"file": "<string>"
}
]
}
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({
first_name: '<string>',
last_name: '<string>',
email: '<string>',
profile_image_id: '<string>',
loyalty_tier_id: '<string>',
loyalty_tier_starting_point: 123,
business: {name: '<string>', business_type: '<string>', gstin: '<string>'},
kyc_documents: [
{
document_number: '<string>',
document_type_id: '<string>',
note: '<string>',
file: '<string>'
}
]
})
};
fetch('https://staging.api.commercengine.io/api/v1/{store_id}/admin/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://staging.api.commercengine.io/api/v1/{store_id}/admin/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([
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '<string>',
'profile_image_id' => '<string>',
'loyalty_tier_id' => '<string>',
'loyalty_tier_starting_point' => 123,
'business' => [
'name' => '<string>',
'business_type' => '<string>',
'gstin' => '<string>'
],
'kyc_documents' => [
[
'document_number' => '<string>',
'document_type_id' => '<string>',
'note' => '<string>',
'file' => '<string>'
]
]
]),
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://staging.api.commercengine.io/api/v1/{store_id}/admin/customers"
payload := strings.NewReader("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"profile_image_id\": \"<string>\",\n \"loyalty_tier_id\": \"<string>\",\n \"loyalty_tier_starting_point\": 123,\n \"business\": {\n \"name\": \"<string>\",\n \"business_type\": \"<string>\",\n \"gstin\": \"<string>\"\n },\n \"kyc_documents\": [\n {\n \"document_number\": \"<string>\",\n \"document_type_id\": \"<string>\",\n \"note\": \"<string>\",\n \"file\": \"<string>\"\n }\n ]\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://staging.api.commercengine.io/api/v1/{store_id}/admin/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"profile_image_id\": \"<string>\",\n \"loyalty_tier_id\": \"<string>\",\n \"loyalty_tier_starting_point\": 123,\n \"business\": {\n \"name\": \"<string>\",\n \"business_type\": \"<string>\",\n \"gstin\": \"<string>\"\n },\n \"kyc_documents\": [\n {\n \"document_number\": \"<string>\",\n \"document_type_id\": \"<string>\",\n \"note\": \"<string>\",\n \"file\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers")
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 \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"profile_image_id\": \"<string>\",\n \"loyalty_tier_id\": \"<string>\",\n \"loyalty_tier_starting_point\": 123,\n \"business\": {\n \"name\": \"<string>\",\n \"business_type\": \"<string>\",\n \"gstin\": \"<string>\"\n },\n \"kyc_documents\": [\n {\n \"document_number\": \"<string>\",\n \"document_type_id\": \"<string>\",\n \"note\": \"<string>\",\n \"file\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"success": true,
"content": {
"customer": {
"id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"full_name": "<string>",
"profile_image_url": "<string>",
"country_code": "<string>",
"phone": "<string>",
"email": "<string>",
"is_phone_verified": true,
"is_email_verified": true,
"is_whatsapp_verified": true,
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"last_seen": "2023-11-07T05:31:56Z",
"kyc_status": "pending",
"is_verified": true,
"customer_group_id": "<string>",
"tags": [
"<string>"
],
"business": {
"name": "<string>",
"business_type": "<string>",
"pan_number": "<string>",
"gstin": "<string>",
"is_registered_under_gst": true
},
"segments": [
{
"id": "<string>",
"name": "<string>"
}
],
"address": {
"first_name": "<string>",
"phone": "<string>",
"email": "<string>",
"address_line1": "<string>",
"pincode": "<string>",
"city": "<string>",
"state": "<string>",
"country": "India",
"id": "<string>",
"last_name": "<string>",
"country_code": "<string>",
"address_line2": "<string>",
"landmark": "<string>",
"gstin": "<string>",
"business_name": "<string>",
"is_phone_verified": true,
"is_email_verified": true,
"is_default_shipping": true,
"is_default_billing": true
}
}
}
}Customers
Create customer
Create customer
POST
/
customers
Create customer
curl --request POST \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"profile_image_id": "<string>",
"loyalty_tier_id": "<string>",
"loyalty_tier_starting_point": 123,
"business": {
"name": "<string>",
"business_type": "<string>",
"gstin": "<string>"
},
"kyc_documents": [
{
"document_number": "<string>",
"document_type_id": "<string>",
"note": "<string>",
"file": "<string>"
}
]
}
'import requests
url = "https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers"
payload = {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"profile_image_id": "<string>",
"loyalty_tier_id": "<string>",
"loyalty_tier_starting_point": 123,
"business": {
"name": "<string>",
"business_type": "<string>",
"gstin": "<string>"
},
"kyc_documents": [
{
"document_number": "<string>",
"document_type_id": "<string>",
"note": "<string>",
"file": "<string>"
}
]
}
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({
first_name: '<string>',
last_name: '<string>',
email: '<string>',
profile_image_id: '<string>',
loyalty_tier_id: '<string>',
loyalty_tier_starting_point: 123,
business: {name: '<string>', business_type: '<string>', gstin: '<string>'},
kyc_documents: [
{
document_number: '<string>',
document_type_id: '<string>',
note: '<string>',
file: '<string>'
}
]
})
};
fetch('https://staging.api.commercengine.io/api/v1/{store_id}/admin/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://staging.api.commercengine.io/api/v1/{store_id}/admin/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([
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '<string>',
'profile_image_id' => '<string>',
'loyalty_tier_id' => '<string>',
'loyalty_tier_starting_point' => 123,
'business' => [
'name' => '<string>',
'business_type' => '<string>',
'gstin' => '<string>'
],
'kyc_documents' => [
[
'document_number' => '<string>',
'document_type_id' => '<string>',
'note' => '<string>',
'file' => '<string>'
]
]
]),
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://staging.api.commercengine.io/api/v1/{store_id}/admin/customers"
payload := strings.NewReader("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"profile_image_id\": \"<string>\",\n \"loyalty_tier_id\": \"<string>\",\n \"loyalty_tier_starting_point\": 123,\n \"business\": {\n \"name\": \"<string>\",\n \"business_type\": \"<string>\",\n \"gstin\": \"<string>\"\n },\n \"kyc_documents\": [\n {\n \"document_number\": \"<string>\",\n \"document_type_id\": \"<string>\",\n \"note\": \"<string>\",\n \"file\": \"<string>\"\n }\n ]\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://staging.api.commercengine.io/api/v1/{store_id}/admin/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"profile_image_id\": \"<string>\",\n \"loyalty_tier_id\": \"<string>\",\n \"loyalty_tier_starting_point\": 123,\n \"business\": {\n \"name\": \"<string>\",\n \"business_type\": \"<string>\",\n \"gstin\": \"<string>\"\n },\n \"kyc_documents\": [\n {\n \"document_number\": \"<string>\",\n \"document_type_id\": \"<string>\",\n \"note\": \"<string>\",\n \"file\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers")
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 \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"profile_image_id\": \"<string>\",\n \"loyalty_tier_id\": \"<string>\",\n \"loyalty_tier_starting_point\": 123,\n \"business\": {\n \"name\": \"<string>\",\n \"business_type\": \"<string>\",\n \"gstin\": \"<string>\"\n },\n \"kyc_documents\": [\n {\n \"document_number\": \"<string>\",\n \"document_type_id\": \"<string>\",\n \"note\": \"<string>\",\n \"file\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"success": true,
"content": {
"customer": {
"id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"full_name": "<string>",
"profile_image_url": "<string>",
"country_code": "<string>",
"phone": "<string>",
"email": "<string>",
"is_phone_verified": true,
"is_email_verified": true,
"is_whatsapp_verified": true,
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"last_seen": "2023-11-07T05:31:56Z",
"kyc_status": "pending",
"is_verified": true,
"customer_group_id": "<string>",
"tags": [
"<string>"
],
"business": {
"name": "<string>",
"business_type": "<string>",
"pan_number": "<string>",
"gstin": "<string>",
"is_registered_under_gst": true
},
"segments": [
{
"id": "<string>",
"name": "<string>"
}
],
"address": {
"first_name": "<string>",
"phone": "<string>",
"email": "<string>",
"address_line1": "<string>",
"pincode": "<string>",
"city": "<string>",
"state": "<string>",
"country": "India",
"id": "<string>",
"last_name": "<string>",
"country_code": "<string>",
"address_line2": "<string>",
"landmark": "<string>",
"gstin": "<string>",
"business_name": "<string>",
"is_phone_verified": true,
"is_email_verified": true,
"is_default_shipping": true,
"is_default_billing": true
}
}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Was this page helpful?
⌘I