curl --request POST \
--url https://api.stablepay.ai/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalId": "user001",
"email": "user@example.com",
"phone": "+254712345678",
"countryCode": "KE",
"metadata": {}
}
'import requests
url = "https://api.stablepay.ai/v1/customers"
payload = {
"externalId": "user001",
"email": "user@example.com",
"phone": "+254712345678",
"countryCode": "KE",
"metadata": {}
}
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({
externalId: 'user001',
email: 'user@example.com',
phone: '+254712345678',
countryCode: 'KE',
metadata: {}
})
};
fetch('https://api.stablepay.ai/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stablepay.ai/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([
'externalId' => 'user001',
'email' => 'user@example.com',
'phone' => '+254712345678',
'countryCode' => 'KE',
'metadata' => [
]
]),
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.stablepay.ai/v1/customers"
payload := strings.NewReader("{\n \"externalId\": \"user001\",\n \"email\": \"user@example.com\",\n \"phone\": \"+254712345678\",\n \"countryCode\": \"KE\",\n \"metadata\": {}\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://api.stablepay.ai/v1/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalId\": \"user001\",\n \"email\": \"user@example.com\",\n \"phone\": \"+254712345678\",\n \"countryCode\": \"KE\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stablepay.ai/v1/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 \"externalId\": \"user001\",\n \"email\": \"user@example.com\",\n \"phone\": \"+254712345678\",\n \"countryCode\": \"KE\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "cus_01KXG3R0X8DXTKB849FFFEPT7Y",
"externalId": "user001",
"type": "individual",
"kycStatus": "approved",
"kycAttempts": 1,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"countryCode": "KE",
"riskLevel": "<string>",
"metadata": {},
"verifiedAt": "2023-11-07T05:31:56Z",
"verificationUrl": "https://verify.didit.me/session/XXXX",
"sessionId": "<string>",
"identity": {},
"reviewWarnings": [
{
"code": "COULD_NOT_PERFORM_AML_SCREENING",
"severity": "error",
"feature": "aml_screenings",
"message": "Could not retrieve data from KYC for performing AML Screening."
}
]
}{
"statusCode": 400,
"message": "fiatAmount must be a positive number.",
"code": "validation_error"
}{
"statusCode": 400,
"message": "fiatAmount must be a positive number.",
"code": "validation_error"
}Create Customer
The customers API is a KYC API for DeFi wallets. Onboard and verify your end-users, then link their wallet addresses so verified identity travels with their on-chain activity.
Create a customer and start KYC. Returns a hosted verification URL.
curl --request POST \
--url https://api.stablepay.ai/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalId": "user001",
"email": "user@example.com",
"phone": "+254712345678",
"countryCode": "KE",
"metadata": {}
}
'import requests
url = "https://api.stablepay.ai/v1/customers"
payload = {
"externalId": "user001",
"email": "user@example.com",
"phone": "+254712345678",
"countryCode": "KE",
"metadata": {}
}
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({
externalId: 'user001',
email: 'user@example.com',
phone: '+254712345678',
countryCode: 'KE',
metadata: {}
})
};
fetch('https://api.stablepay.ai/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stablepay.ai/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([
'externalId' => 'user001',
'email' => 'user@example.com',
'phone' => '+254712345678',
'countryCode' => 'KE',
'metadata' => [
]
]),
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.stablepay.ai/v1/customers"
payload := strings.NewReader("{\n \"externalId\": \"user001\",\n \"email\": \"user@example.com\",\n \"phone\": \"+254712345678\",\n \"countryCode\": \"KE\",\n \"metadata\": {}\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://api.stablepay.ai/v1/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalId\": \"user001\",\n \"email\": \"user@example.com\",\n \"phone\": \"+254712345678\",\n \"countryCode\": \"KE\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stablepay.ai/v1/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 \"externalId\": \"user001\",\n \"email\": \"user@example.com\",\n \"phone\": \"+254712345678\",\n \"countryCode\": \"KE\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "cus_01KXG3R0X8DXTKB849FFFEPT7Y",
"externalId": "user001",
"type": "individual",
"kycStatus": "approved",
"kycAttempts": 1,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"countryCode": "KE",
"riskLevel": "<string>",
"metadata": {},
"verifiedAt": "2023-11-07T05:31:56Z",
"verificationUrl": "https://verify.didit.me/session/XXXX",
"sessionId": "<string>",
"identity": {},
"reviewWarnings": [
{
"code": "COULD_NOT_PERFORM_AML_SCREENING",
"severity": "error",
"feature": "aml_screenings",
"message": "Could not retrieve data from KYC for performing AML Screening."
}
]
}{
"statusCode": 400,
"message": "fiatAmount must be a positive number.",
"code": "validation_error"
}{
"statusCode": 400,
"message": "fiatAmount must be a positive number.",
"code": "validation_error"
}Authorizations
Stablepay API key. Include as Authorization: Bearer <key>.
Body
Your own unique identifier for the customer.
"user001"
individual, business "user@example.com"
"+254712345678"
ISO 3166-1 alpha-2.
"KE"
Optional key-value data. Do not include personal information.
Response
Customer created.
Prefixed ULID for this customer.
"cus_01KXG3R0X8DXTKB849FFFEPT7Y"
"user001"
individual, business One of none, pending, in_progress, review, approved, declined, soft_declined, expired, abandoned.
"approved"
1
"KE"
Hosted verification URL. Returned when a verification is started.
"https://verify.didit.me/session/XXXX"
The verified identity. Returned only with refresh=true.
Reasons why the customer isn't approved. This is surfaced to show your end-user why verification is stuck, declined, or needs action. Omitted when the customer is approved or in_progress. Returned with refresh=true, and also on the customer.kyc.updated webhook.
Show child attributes
Show child attributes
[
{
"code": "COULD_NOT_PERFORM_AML_SCREENING",
"severity": "error",
"feature": "aml_screenings",
"message": "Could not retrieve data from KYC for performing AML Screening."
}
]

