Customers
Customers, their addresses and segments (contact details need read_customer_pii). Every example sets SOOQUNA_TOKEN from the environment; see authentication. Responses are from a test store, cut to two items per list.
| Endpoint | Method | Path |
|---|---|---|
| Create a customer | POST | /customers |
| List customers | GET | /customers |
| Count customers | GET | /customers/count |
| List customer tags | GET | /customers/tags |
| Get a customer | GET | /customers/{id} |
| Update a customer | PATCH | /customers/{id} |
| Add an address | POST | /customers/{id}/addresses |
| Update an address | PATCH | /customers/{id}/addresses/{address_id} |
| Make an address the default | POST | /customers/{id}/addresses/{address_id}/default |
| Delete an address | DELETE | /customers/{id}/addresses/{address_id} |
| Change marketing consent | PUT | /customers/{id}/marketing |
| List a customer’s consent history | GET | /customers/{id}/consents |
| List a customer’s orders | GET | /customers/{id}/orders |
| Invite a customer to create an account | POST | /customers/{id}/send-invite |
| Tag or delete many customers | POST | /customers/bulk |
| Create a customer segment | POST | /segments |
| List customer segments | GET | /segments |
| List the fields segment queries can use | GET | /segments/fields |
| Get a segment | GET | /segments/{id} |
| Update a segment | PUT | /segments/{id} |
| Delete a segment | DELETE | /segments/{id} |
| Delete a customer | DELETE | /customers/{id} |
Create a customer
Section titled “Create a customer”POST /customers · Scope: write_customers · Needs an Idempotency-Key header
curl -X POST "https://api.sooquna.com/admin/api/2026-10/customers" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "first_name": "Noora", "last_name": "Al-Kuwari", "email": "[email protected]", "phone": "+97455123456", "locale": "ar", "tags": ["vip"], "email_marketing": {"state": "subscribed", "opt_in_level": "single_opt_in"}, "addresses": [ { "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Zone 66, Street 801, Building 12", "city": "Doha", "country_code": "QA", "phone": "+97455123456", "default": true } ]}'const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers", { method: "POST", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, "Idempotency-Key": crypto.randomUUID(), "Content-Type": "application/json", }, body: JSON.stringify({ "first_name": "Noora", "last_name": "Al-Kuwari", "phone": "+97455123456", "locale": "ar", "tags": ["vip"], "email_marketing": {"state": "subscribed", "opt_in_level": "single_opt_in"}, "addresses": [ { "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Zone 66, Street 801, Building 12", "city": "Doha", "country_code": "QA", "phone": "+97455123456", "default": true } ] }),});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import os, uuidimport requests
res = requests.post( "https://api.sooquna.com/admin/api/2026-10/customers", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], "Idempotency-Key": str(uuid.uuid4()), }, json={ "first_name": "Noora", "last_name": "Al-Kuwari", "phone": "+97455123456", "locale": "ar", "tags": ["vip"], "email_marketing": {"state": "subscribed", "opt_in_level": "single_opt_in"}, "addresses": [ { "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Zone 66, Street 801, Building 12", "city": "Doha", "country_code": "QA", "phone": "+97455123456", "default": True, }, ], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), 'Idempotency-Key: ' . bin2hex(random_bytes(16)), 'Content-Type: application/json', ], CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode([ 'first_name' => 'Noora', 'last_name' => 'Al-Kuwari', 'phone' => '+97455123456', 'locale' => 'ar', 'tags' => ['vip'], 'email_marketing' => ['state' => 'subscribed', 'opt_in_level' => 'single_opt_in'], 'addresses' => [ [ 'first_name' => 'Noora', 'last_name' => 'Al-Kuwari', 'address1' => 'Zone 66, Street 801, Building 12', 'city' => 'Doha', 'country_code' => 'QA', 'phone' => '+97455123456', 'default' => true, ], ], ], JSON_UNESCAPED_UNICODE),]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os" "strings"
"github.com/google/uuid")
func main() { body := `{ "first_name": "Noora", "last_name": "Al-Kuwari", "email": "[email protected]", "phone": "+97455123456", "locale": "ar", "tags": ["vip"], "email_marketing": {"state": "subscribed", "opt_in_level": "single_opt_in"}, "addresses": [ { "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Zone 66, Street 801, Building 12", "city": "Doha", "country_code": "QA", "phone": "+97455123456", "default": true } ]}` req, err := http.NewRequest("POST", "https://api.sooquna.com/admin/api/2026-10/customers", strings.NewReader(body)) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) req.Header.Set("Idempotency-Key", uuid.NewString()) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Post, "https://api.sooquna.com/admin/api/2026-10/customers");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));req.Headers.Add("Idempotency-Key", Guid.NewGuid().ToString());req.Content = new StringContent("""{ "first_name": "Noora", "last_name": "Al-Kuwari", "email": "[email protected]", "phone": "+97455123456", "locale": "ar", "tags": ["vip"], "email_marketing": {"state": "subscribed", "opt_in_level": "single_opt_in"}, "addresses": [ { "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Zone 66, Street 801, Building 12", "city": "Doha", "country_code": "QA", "phone": "+97455123456", "default": true } ]}""", Encoding.UTF8, "application/json");var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 201
{ "accepts_email_marketing": true, "accepts_sms_marketing": false, "addresses": [ { "address1": "Zone 66, Street 801, Building 12", "address2": "", "city": "Doha", "company": "", "country_code": "QA", "extra": {}, "first_name": "Noora", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000006", "is_default": true, "last_name": "Al-Kuwari", "latitude": null, "longitude": null, "phone": "+97455123456", "province_code": "", "zip": "" } ], "amount_spent": "0.00", "average_order_value": "0.00", "created_at": "2026-10-18T09:30:00Z", "currency": "QAR", "default_address": { "address1": "Zone 66, Street 801, Building 12", "address2": "", "city": "Doha", "company": "", "country_code": "QA", "extra": {}, "first_name": "Noora", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000006", "is_default": true, "last_name": "Al-Kuwari", "latitude": null, "longitude": null, "phone": "+97455123456", "province_code": "", "zip": "" }, "display_name": "Noora Al-Kuwari", "email_marketing": { "opt_in_level": "single_opt_in", "state": "subscribed", "updated_at": "2026-10-18T09:30:00Z" }, "first_name": "Noora", "first_order_at": null, "id": "0193a1b2-c3d4-7e5f-8a6b-000000000007", "last_name": "Al-Kuwari", "last_order_at": null, "locale": "ar", "note": "", "orders_count": 0, "phone": "+97455123456", "pii_masked": false, "sms_marketing": { "opt_in_level": "single_opt_in", "state": "not_subscribed", "updated_at": null }, "state": "enabled", "tags": ["vip"], "tax_exempt": false, "tax_exemptions": [], "updated_at": "2026-10-18T09:30:00Z", "version": 2}List customers
Section titled “List customers”GET /customers · Scope: read_customers
| Parameter | In | Description |
|---|---|---|
q |
query | For example noora. |
limit |
query | For example 10. |
curl -X GET "https://api.sooquna.com/admin/api/2026-10/customers?q=noora&limit=10" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers?q=noora&limit=10", { method: "GET", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.get( "https://api.sooquna.com/admin/api/2026-10/customers?q=noora&limit=10", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers?q=noora&limit=10');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("GET", "https://api.sooquna.com/admin/api/2026-10/customers?q=noora&limit=10", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Get, "https://api.sooquna.com/admin/api/2026-10/customers?q=noora&limit=10");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 200
{ "data": [ { "accepts_email_marketing": true, "accepts_sms_marketing": false, "amount_spent": "0.00", "average_order_value": "0.00", "created_at": "2026-10-18T09:30:00Z", "currency": "QAR", "default_address": { "address1": "Zone 66, Street 801, Building 12", "address2": "", "city": "Doha", "company": "", "country_code": "QA", "extra": {}, "first_name": "Noora", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000006", "is_default": true, "last_name": "Al-Kuwari", "latitude": null, "longitude": null, "phone": "+97455123456", "province_code": "", "zip": "" }, "display_name": "Noora Al-Kuwari", "email_marketing": { "opt_in_level": "single_opt_in", "state": "subscribed", "updated_at": "2026-10-18T09:30:00Z" }, "first_name": "Noora", "first_order_at": null, "id": "0193a1b2-c3d4-7e5f-8a6b-000000000007", "last_name": "Al-Kuwari", "last_order_at": null, "locale": "ar", "note": "", "orders_count": 0, "phone": "+97455123456", "pii_masked": false, "sms_marketing": { "opt_in_level": "single_opt_in", "state": "not_subscribed", "updated_at": null }, "state": "enabled", "tags": ["vip"], "tax_exempt": false, "tax_exemptions": [], "updated_at": "2026-10-18T09:30:00Z", "version": 2 } ], "page_info": {"has_next_page": false}}Count customers
Section titled “Count customers”GET /customers/count · Scope: read_customers
| Parameter | In | Description |
|---|---|---|
tag |
query | For example vip. |
curl -X GET "https://api.sooquna.com/admin/api/2026-10/customers/count?tag=vip" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/count?tag=vip", { method: "GET", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.get( "https://api.sooquna.com/admin/api/2026-10/customers/count?tag=vip", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/count?tag=vip');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("GET", "https://api.sooquna.com/admin/api/2026-10/customers/count?tag=vip", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Get, "https://api.sooquna.com/admin/api/2026-10/customers/count?tag=vip");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 200
{"count": 1}List customer tags
Section titled “List customer tags”GET /customers/tags · Scope: read_customers
curl -X GET "https://api.sooquna.com/admin/api/2026-10/customers/tags" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/tags", { method: "GET", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.get( "https://api.sooquna.com/admin/api/2026-10/customers/tags", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/tags');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("GET", "https://api.sooquna.com/admin/api/2026-10/customers/tags", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Get, "https://api.sooquna.com/admin/api/2026-10/customers/tags");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 200
{"data": [{"customers": 1, "tag": "vip"}]}Get a customer
Section titled “Get a customer”GET /customers/{id} · Scope: read_customers
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
curl -X GET "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007", { method: "GET", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.get( "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("GET", "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Get, "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 200
{ "accepts_email_marketing": true, "accepts_sms_marketing": false, "addresses": [ { "address1": "Zone 66, Street 801, Building 12", "address2": "", "city": "Doha", "company": "", "country_code": "QA", "extra": {}, "first_name": "Noora", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000006", "is_default": true, "last_name": "Al-Kuwari", "latitude": null, "longitude": null, "phone": "+97455123456", "province_code": "", "zip": "" } ], "amount_spent": "0.00", "average_order_value": "0.00", "created_at": "2026-10-18T09:30:00Z", "currency": "QAR", "default_address": { "address1": "Zone 66, Street 801, Building 12", "address2": "", "city": "Doha", "company": "", "country_code": "QA", "extra": {}, "first_name": "Noora", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000006", "is_default": true, "last_name": "Al-Kuwari", "latitude": null, "longitude": null, "phone": "+97455123456", "province_code": "", "zip": "" }, "display_name": "Noora Al-Kuwari", "email_marketing": { "opt_in_level": "single_opt_in", "state": "subscribed", "updated_at": "2026-10-18T09:30:00Z" }, "first_name": "Noora", "first_order_at": null, "id": "0193a1b2-c3d4-7e5f-8a6b-000000000007", "last_name": "Al-Kuwari", "last_order_at": null, "locale": "ar", "note": "", "orders_count": 0, "phone": "+97455123456", "pii_masked": false, "sms_marketing": { "opt_in_level": "single_opt_in", "state": "not_subscribed", "updated_at": null }, "state": "enabled", "tags": ["vip"], "tax_exempt": false, "tax_exemptions": [], "updated_at": "2026-10-18T09:30:00Z", "version": 2}Update a customer
Section titled “Update a customer”PATCH /customers/{id} · Scope: write_customers
Fields you leave out stay as they are.
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
curl -X PATCH "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "note": "Prefers delivery after Maghrib", "tags": ["vip", "abaya"], "version": 2}'const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007", { method: "PATCH", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({ "note": "Prefers delivery after Maghrib", "tags": ["vip", "abaya"], "version": 2 }),});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.patch( "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], }, json={ "note": "Prefers delivery after Maghrib", "tags": ["vip", "abaya"], "version": 2, },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'PATCH', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), 'Content-Type: application/json', ], CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode([ 'note' => 'Prefers delivery after Maghrib', 'tags' => ['vip', 'abaya'], 'version' => 2, ], JSON_UNESCAPED_UNICODE),]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os" "strings")
func main() { body := `{ "note": "Prefers delivery after Maghrib", "tags": ["vip", "abaya"], "version": 2}` req, err := http.NewRequest("PATCH", "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007", strings.NewReader(body)) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Patch, "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));req.Content = new StringContent("""{ "note": "Prefers delivery after Maghrib", "tags": ["vip", "abaya"], "version": 2}""", Encoding.UTF8, "application/json");var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 200
{ "accepts_email_marketing": true, "accepts_sms_marketing": false, "addresses": [ { "address1": "Zone 66, Street 801, Building 12", "address2": "", "city": "Doha", "company": "", "country_code": "QA", "extra": {}, "first_name": "Noora", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000006", "is_default": true, "last_name": "Al-Kuwari", "latitude": null, "longitude": null, "phone": "+97455123456", "province_code": "", "zip": "" } ], "amount_spent": "0.00", "average_order_value": "0.00", "created_at": "2026-10-18T09:30:00Z", "currency": "QAR", "default_address": { "address1": "Zone 66, Street 801, Building 12", "address2": "", "city": "Doha", "company": "", "country_code": "QA", "extra": {}, "first_name": "Noora", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000006", "is_default": true, "last_name": "Al-Kuwari", "latitude": null, "longitude": null, "phone": "+97455123456", "province_code": "", "zip": "" }, "display_name": "Noora Al-Kuwari", "email_marketing": { "opt_in_level": "single_opt_in", "state": "subscribed", "updated_at": "2026-10-18T09:30:00Z" }, "first_name": "Noora", "first_order_at": null, "id": "0193a1b2-c3d4-7e5f-8a6b-000000000007", "last_name": "Al-Kuwari", "last_order_at": null, "locale": "ar", "note": "Prefers delivery after Maghrib", "orders_count": 0, "phone": "+97455123456", "pii_masked": false, "sms_marketing": { "opt_in_level": "single_opt_in", "state": "not_subscribed", "updated_at": null }, "state": "enabled", "tags": ["abaya", "vip"], "tax_exempt": false, "tax_exemptions": [], "updated_at": "2026-10-18T09:30:00Z", "version": 3}Add an address
Section titled “Add an address”POST /customers/{id}/addresses · Scope: write_customers
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
curl -X POST "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Lusail Marina, Tower 3, Apt 1204", "city": "Lusail", "country_code": "QA", "phone": "+97455123456"}'const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses", { method: "POST", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({ "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Lusail Marina, Tower 3, Apt 1204", "city": "Lusail", "country_code": "QA", "phone": "+97455123456" }),});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.post( "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], }, json={ "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Lusail Marina, Tower 3, Apt 1204", "city": "Lusail", "country_code": "QA", "phone": "+97455123456", },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), 'Content-Type: application/json', ], CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode([ 'first_name' => 'Noora', 'last_name' => 'Al-Kuwari', 'address1' => 'Lusail Marina, Tower 3, Apt 1204', 'city' => 'Lusail', 'country_code' => 'QA', 'phone' => '+97455123456', ], JSON_UNESCAPED_UNICODE),]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os" "strings")
func main() { body := `{ "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Lusail Marina, Tower 3, Apt 1204", "city": "Lusail", "country_code": "QA", "phone": "+97455123456"}` req, err := http.NewRequest("POST", "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses", strings.NewReader(body)) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Post, "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));req.Content = new StringContent("""{ "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Lusail Marina, Tower 3, Apt 1204", "city": "Lusail", "country_code": "QA", "phone": "+97455123456"}""", Encoding.UTF8, "application/json");var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 201
{ "address1": "Lusail Marina, Tower 3, Apt 1204", "address2": "", "city": "Lusail", "company": "", "country_code": "QA", "extra": {}, "first_name": "Noora", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000049", "is_default": false, "last_name": "Al-Kuwari", "latitude": null, "longitude": null, "phone": "+97455123456", "province_code": "", "zip": ""}Update an address
Section titled “Update an address”PATCH /customers/{id}/addresses/{address_id} · Scope: write_customers
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
address_id |
path | The address ID. |
curl -X PATCH "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Lusail Marina, Tower 3, Apt 1205", "city": "Lusail", "country_code": "QA"}'const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049", { method: "PATCH", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({ "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Lusail Marina, Tower 3, Apt 1205", "city": "Lusail", "country_code": "QA" }),});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.patch( "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], }, json={ "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Lusail Marina, Tower 3, Apt 1205", "city": "Lusail", "country_code": "QA", },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'PATCH', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), 'Content-Type: application/json', ], CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode([ 'first_name' => 'Noora', 'last_name' => 'Al-Kuwari', 'address1' => 'Lusail Marina, Tower 3, Apt 1205', 'city' => 'Lusail', 'country_code' => 'QA', ], JSON_UNESCAPED_UNICODE),]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os" "strings")
func main() { body := `{ "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Lusail Marina, Tower 3, Apt 1205", "city": "Lusail", "country_code": "QA"}` req, err := http.NewRequest("PATCH", "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049", strings.NewReader(body)) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Patch, "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));req.Content = new StringContent("""{ "first_name": "Noora", "last_name": "Al-Kuwari", "address1": "Lusail Marina, Tower 3, Apt 1205", "city": "Lusail", "country_code": "QA"}""", Encoding.UTF8, "application/json");var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 200
{ "address1": "Lusail Marina, Tower 3, Apt 1205", "address2": "", "city": "Lusail", "company": "", "country_code": "QA", "extra": {}, "first_name": "Noora", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000049", "is_default": false, "last_name": "Al-Kuwari", "latitude": null, "longitude": null, "phone": "", "province_code": "", "zip": ""}Make an address the default
Section titled “Make an address the default”POST /customers/{id}/addresses/{address_id}/default · Scope: write_customers
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
address_id |
path | The address ID. |
curl -X POST "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049/default" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049/default", { method: "POST", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.post( "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049/default", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049/default');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("POST", "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049/default", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Post, "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049/default");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 204
{}Delete an address
Section titled “Delete an address”DELETE /customers/{id}/addresses/{address_id} · Scope: write_customers
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
address_id |
path | The address ID. |
curl -X DELETE "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049", { method: "DELETE", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.delete( "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'DELETE', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("DELETE", "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Delete, "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/addresses/0193a1b2-c3d4-7e5f-8a6b-000000000049");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Change marketing consent
Section titled “Change marketing consent”PUT /customers/{id}/marketing · Scope: write_customers
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
curl -X PUT "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/marketing" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "email": {"state": "subscribed", "opt_in_level": "confirmed_opt_in"}, "sms": {"state": "unsubscribed"}}'const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/marketing", { method: "PUT", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({ "email": {"state": "subscribed", "opt_in_level": "confirmed_opt_in"}, "sms": {"state": "unsubscribed"} }),});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.put( "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/marketing", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], }, json={ "email": {"state": "subscribed", "opt_in_level": "confirmed_opt_in"}, "sms": {"state": "unsubscribed"}, },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/marketing');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), 'Content-Type: application/json', ], CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode([ 'email' => ['state' => 'subscribed', 'opt_in_level' => 'confirmed_opt_in'], 'sms' => ['state' => 'unsubscribed'], ], JSON_UNESCAPED_UNICODE),]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os" "strings")
func main() { body := `{ "email": {"state": "subscribed", "opt_in_level": "confirmed_opt_in"}, "sms": {"state": "unsubscribed"}}` req, err := http.NewRequest("PUT", "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/marketing", strings.NewReader(body)) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Put, "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/marketing");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));req.Content = new StringContent("""{ "email": {"state": "subscribed", "opt_in_level": "confirmed_opt_in"}, "sms": {"state": "unsubscribed"}}""", Encoding.UTF8, "application/json");var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 200
{ "accepts_email_marketing": true, "accepts_sms_marketing": false, "addresses": [ { "address1": "Lusail Marina, Tower 3, Apt 1205", "address2": "", "city": "Lusail", "company": "", "country_code": "QA", "extra": {}, "first_name": "Noora", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000049", "is_default": true, "last_name": "Al-Kuwari", "latitude": null, "longitude": null, "phone": "", "province_code": "", "zip": "" }, { "address1": "Zone 66, Street 801, Building 12", "address2": "", "city": "Doha", "company": "", "country_code": "QA", "extra": {}, "first_name": "Noora", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000006", "is_default": false, "last_name": "Al-Kuwari", "latitude": null, "longitude": null, "phone": "+97455123456", "province_code": "", "zip": "" } ], "amount_spent": "0.00", "average_order_value": "0.00", "created_at": "2026-10-18T09:30:00Z", "currency": "QAR", "default_address": { "address1": "Lusail Marina, Tower 3, Apt 1205", "address2": "", "city": "Lusail", "company": "", "country_code": "QA", "extra": {}, "first_name": "Noora", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000049", "is_default": true, "last_name": "Al-Kuwari", "latitude": null, "longitude": null, "phone": "", "province_code": "", "zip": "" }, "display_name": "Noora Al-Kuwari", "email_marketing": { "opt_in_level": "confirmed_opt_in", "state": "subscribed", "updated_at": "2026-10-18T09:30:00Z" }, "first_name": "Noora", "first_order_at": null, "id": "0193a1b2-c3d4-7e5f-8a6b-000000000007", "last_name": "Al-Kuwari", "last_order_at": null, "locale": "ar", "note": "Prefers delivery after Maghrib", "orders_count": 0, "phone": "+97455123456", "pii_masked": false, "sms_marketing": { "opt_in_level": "single_opt_in", "state": "unsubscribed", "updated_at": "2026-10-18T09:30:00Z" }, "state": "enabled", "tags": ["abaya", "vip"], "tax_exempt": false, "tax_exemptions": [], "updated_at": "2026-10-18T09:30:00Z", "version": 6}List a customer’s consent history
Section titled “List a customer’s consent history”GET /customers/{id}/consents · Scope: read_customers
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
curl -X GET "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/consents" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/consents", { method: "GET", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.get( "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/consents", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/consents');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("GET", "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/consents", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Get, "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/consents");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 200
{ "data": [ { "actor": "Docs", "channel": "email", "created_at": "2026-10-18T09:30:00Z", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000008", "opt_in_level": "confirmed_opt_in", "source": "admin", "state": "subscribed" }, { "actor": "Docs", "channel": "sms", "created_at": "2026-10-18T09:30:00Z", "id": "0193a1b2-c3d4-7e5f-8a6b-000000000009", "opt_in_level": "single_opt_in", "source": "admin", "state": "unsubscribed" } ]}List a customer’s orders
Section titled “List a customer’s orders”GET /customers/{id}/orders · Scope: read_customers
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
curl -X GET "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/orders" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/orders", { method: "GET", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.get( "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/orders", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/orders');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("GET", "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/orders", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Get, "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/orders");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Invite a customer to create an account
Section titled “Invite a customer to create an account”POST /customers/{id}/send-invite · Scope: write_customers
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
curl -X POST "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/send-invite" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/send-invite", { method: "POST", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.post( "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/send-invite", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/send-invite');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("POST", "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/send-invite", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Post, "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007/send-invite");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Tag or delete many customers
Section titled “Tag or delete many customers”POST /customers/bulk · Scope: write_customers
Actions: add_tags, remove_tags, delete.
curl -X POST "https://api.sooquna.com/admin/api/2026-10/customers/bulk" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "action": "add_tags", "ids": ["0193a1b2-c3d4-7e5f-8a6b-000000000007"], "tags": ["ramadan-2026"]}'const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/bulk", { method: "POST", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({ "action": "add_tags", "ids": ["0193a1b2-c3d4-7e5f-8a6b-000000000007"], "tags": ["ramadan-2026"] }),});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.post( "https://api.sooquna.com/admin/api/2026-10/customers/bulk", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], }, json={ "action": "add_tags", "ids": ["0193a1b2-c3d4-7e5f-8a6b-000000000007"], "tags": ["ramadan-2026"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/bulk');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), 'Content-Type: application/json', ], CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode([ 'action' => 'add_tags', 'ids' => ['0193a1b2-c3d4-7e5f-8a6b-000000000007'], 'tags' => ['ramadan-2026'], ], JSON_UNESCAPED_UNICODE),]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os" "strings")
func main() { body := `{ "action": "add_tags", "ids": ["0193a1b2-c3d4-7e5f-8a6b-000000000007"], "tags": ["ramadan-2026"]}` req, err := http.NewRequest("POST", "https://api.sooquna.com/admin/api/2026-10/customers/bulk", strings.NewReader(body)) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Post, "https://api.sooquna.com/admin/api/2026-10/customers/bulk");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));req.Content = new StringContent("""{ "action": "add_tags", "ids": ["0193a1b2-c3d4-7e5f-8a6b-000000000007"], "tags": ["ramadan-2026"]}""", Encoding.UTF8, "application/json");var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 200
{"skipped": 0, "updated": 1}Create a customer segment
Section titled “Create a customer segment”POST /segments · Scope: write_customers
curl -X POST "https://api.sooquna.com/admin/api/2026-10/segments" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "Big spenders", "query": "amount_spent > 500"}'const res = await fetch("https://api.sooquna.com/admin/api/2026-10/segments", { method: "POST", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({"name": "Big spenders", "query": "amount_spent > 500"}),});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.post( "https://api.sooquna.com/admin/api/2026-10/segments", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], }, json={"name": "Big spenders", "query": "amount_spent > 500"},)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/segments');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), 'Content-Type: application/json', ], CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode(['name' => 'Big spenders', 'query' => 'amount_spent > 500'], JSON_UNESCAPED_UNICODE),]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os" "strings")
func main() { body := `{"name": "Big spenders", "query": "amount_spent > 500"}` req, err := http.NewRequest("POST", "https://api.sooquna.com/admin/api/2026-10/segments", strings.NewReader(body)) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Post, "https://api.sooquna.com/admin/api/2026-10/segments");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));req.Content = new StringContent("""{"name": "Big spenders", "query": "amount_spent > 500"}""", Encoding.UTF8, "application/json");var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 201
{ "count": 0, "counted_at": "2026-10-18T09:30:00Z", "created_at": "2026-10-18T09:30:00Z", "default_key": null, "id": "0193a1b2-c3d4-7e5f-8a6b-000000000044", "materialized_at": null, "name": "Big spenders", "query": "amount_spent > 500", "updated_at": "2026-10-18T09:30:00Z", "version": 1}List customer segments
Section titled “List customer segments”GET /segments · Scope: read_customers
curl -X GET "https://api.sooquna.com/admin/api/2026-10/segments" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/segments", { method: "GET", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.get( "https://api.sooquna.com/admin/api/2026-10/segments", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/segments');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("GET", "https://api.sooquna.com/admin/api/2026-10/segments", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Get, "https://api.sooquna.com/admin/api/2026-10/segments");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 200
{ "data": [ { "count": 0, "counted_at": "2026-10-18T09:30:00Z", "created_at": "2026-10-18T09:30:00Z", "default_key": null, "id": "0193a1b2-c3d4-7e5f-8a6b-000000000044", "materialized_at": null, "name": "Big spenders", "query": "amount_spent > 500", "updated_at": "2026-10-18T09:30:00Z", "version": 1 } ]}List the fields segment queries can use
Section titled “List the fields segment queries can use”GET /segments/fields · Scope: read_customers
curl -X GET "https://api.sooquna.com/admin/api/2026-10/segments/fields" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/segments/fields", { method: "GET", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.get( "https://api.sooquna.com/admin/api/2026-10/segments/fields", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/segments/fields');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("GET", "https://api.sooquna.com/admin/api/2026-10/segments/fields", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Get, "https://api.sooquna.com/admin/api/2026-10/segments/fields");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 200
{ "data": [ { "available": false, "description": { "ar": "تتوفر البيانات عند إطلاق الدفع.", "en": "Fills in once checkout launches." }, "example": "abandoned_checkout_date > -30d", "label": {"ar": "تاريخ السلة المتروكة", "en": "Abandoned checkout date"}, "name": "abandoned_checkout_date", "operators": ["=", ">"], "type": "date" }, { "available": true, "description": { "ar": "إجمالي الإنفاق بعملة المتجر.", "en": "Total spent, in the store currency." }, "example": "amount_spent > 500", "label": {"ar": "المبلغ المنفق", "en": "Amount spent"}, "name": "amount_spent", "operators": ["=", "!="], "type": "money" } ]}Get a segment
Section titled “Get a segment”GET /segments/{id} · Scope: read_customers
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
curl -X GET "https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044", { method: "GET", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.get( "https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("GET", "https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Get, "https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 200
{ "count": 0, "counted_at": "2026-10-18T09:30:00Z", "created_at": "2026-10-18T09:30:00Z", "default_key": null, "id": "0193a1b2-c3d4-7e5f-8a6b-000000000044", "materialized_at": null, "name": "Big spenders", "query": "amount_spent > 500", "updated_at": "2026-10-18T09:30:00Z", "version": 1}Update a segment
Section titled “Update a segment”PUT /segments/{id} · Scope: write_customers
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
curl -X PUT "https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "Big spenders", "query": "amount_spent > 1000", "version": 1}'const res = await fetch("https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044", { method: "PUT", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({"name": "Big spenders", "query": "amount_spent > 1000", "version": 1}),});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.put( "https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], }, json={ "name": "Big spenders", "query": "amount_spent > 1000", "version": 1, },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), 'Content-Type: application/json', ], CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode([ 'name' => 'Big spenders', 'query' => 'amount_spent > 1000', 'version' => 1, ], JSON_UNESCAPED_UNICODE),]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os" "strings")
func main() { body := `{"name": "Big spenders", "query": "amount_spent > 1000", "version": 1}` req, err := http.NewRequest("PUT", "https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044", strings.NewReader(body)) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Put, "https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));req.Content = new StringContent("""{"name": "Big spenders", "query": "amount_spent > 1000", "version": 1}""", Encoding.UTF8, "application/json");var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 200
{ "count": 0, "counted_at": "2026-10-18T09:30:00Z", "created_at": "2026-10-18T09:30:00Z", "default_key": null, "id": "0193a1b2-c3d4-7e5f-8a6b-000000000044", "materialized_at": null, "name": "Big spenders", "query": "amount_spent > 1000", "updated_at": "2026-10-18T09:30:00Z", "version": 2}Delete a segment
Section titled “Delete a segment”DELETE /segments/{id} · Scope: write_customers
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
curl -X DELETE "https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044", { method: "DELETE", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.delete( "https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'DELETE', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("DELETE", "https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Delete, "https://api.sooquna.com/admin/api/2026-10/segments/0193a1b2-c3d4-7e5f-8a6b-000000000044");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Response 204
{}Delete a customer
Section titled “Delete a customer”DELETE /customers/{id} · Scope: write_customers
| Parameter | In | Description |
|---|---|---|
id |
path | The resource’s ID. |
curl -X DELETE "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007" \ -H "X-Sooquna-Access-Token: $SOOQUNA_TOKEN"const res = await fetch("https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007", { method: "DELETE", headers: { "X-Sooquna-Access-Token": process.env.SOOQUNA_TOKEN, },});if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);const data = await res.json();console.log(data);import osimport requests
res = requests.delete( "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007", headers={ "X-Sooquna-Access-Token": os.environ["SOOQUNA_TOKEN"], },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'DELETE', CURLOPT_HTTPHEADER => [ 'X-Sooquna-Access-Token: ' . getenv('SOOQUNA_TOKEN'), ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("$status: $response");}$data = json_decode($response, true);print_r($data);package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("DELETE", "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007", nil) if err != nil { panic(err) } req.Header.Set("X-Sooquna-Access-Token", os.Getenv("SOOQUNA_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() if res.StatusCode >= 300 { data, _ := io.ReadAll(res.Body) panic(fmt.Sprintf("%d: %s", res.StatusCode, data)) } data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();var req = new HttpRequestMessage(HttpMethod.Delete, "https://api.sooquna.com/admin/api/2026-10/customers/0193a1b2-c3d4-7e5f-8a6b-000000000007");req.Headers.Add("X-Sooquna-Access-Token", Environment.GetEnvironmentVariable("SOOQUNA_TOKEN"));var res = await client.SendAsync(req);if (!res.IsSuccessStatusCode) throw new Exception($"{(int)res.StatusCode}: {await res.Content.ReadAsStringAsync()}");Console.WriteLine(await res.Content.ReadAsStringAsync());Was this page helpful?

