curl --request POST \
--url https://api.test.doola.com/v1/partner/customer-sessions \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "founder@example.com",
"externalCustomerId": "usr_8f21c",
"firstName": "Ada",
"lastName": "Lovelace",
"countryOfResidence": "USA",
"phoneNumber": "+12125550100"
}
'import requests
url = "https://api.test.doola.com/v1/partner/customer-sessions"
payload = {
"email": "founder@example.com",
"externalCustomerId": "usr_8f21c",
"firstName": "Ada",
"lastName": "Lovelace",
"countryOfResidence": "USA",
"phoneNumber": "+12125550100"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'founder@example.com',
externalCustomerId: 'usr_8f21c',
firstName: 'Ada',
lastName: 'Lovelace',
countryOfResidence: 'USA',
phoneNumber: '+12125550100'
})
};
fetch('https://api.test.doola.com/v1/partner/customer-sessions', 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.test.doola.com/v1/partner/customer-sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'founder@example.com',
'externalCustomerId' => 'usr_8f21c',
'firstName' => 'Ada',
'lastName' => 'Lovelace',
'countryOfResidence' => 'USA',
'phoneNumber' => '+12125550100'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.test.doola.com/v1/partner/customer-sessions"
payload := strings.NewReader("{\n \"email\": \"founder@example.com\",\n \"externalCustomerId\": \"usr_8f21c\",\n \"firstName\": \"Ada\",\n \"lastName\": \"Lovelace\",\n \"countryOfResidence\": \"USA\",\n \"phoneNumber\": \"+12125550100\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.test.doola.com/v1/partner/customer-sessions")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"founder@example.com\",\n \"externalCustomerId\": \"usr_8f21c\",\n \"firstName\": \"Ada\",\n \"lastName\": \"Lovelace\",\n \"countryOfResidence\": \"USA\",\n \"phoneNumber\": \"+12125550100\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.test.doola.com/v1/partner/customer-sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"founder@example.com\",\n \"externalCustomerId\": \"usr_8f21c\",\n \"firstName\": \"Ada\",\n \"lastName\": \"Lovelace\",\n \"countryOfResidence\": \"USA\",\n \"phoneNumber\": \"+12125550100\"\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"expiresIn": 600
}Create a customer session
curl --request POST \
--url https://api.test.doola.com/v1/partner/customer-sessions \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "founder@example.com",
"externalCustomerId": "usr_8f21c",
"firstName": "Ada",
"lastName": "Lovelace",
"countryOfResidence": "USA",
"phoneNumber": "+12125550100"
}
'import requests
url = "https://api.test.doola.com/v1/partner/customer-sessions"
payload = {
"email": "founder@example.com",
"externalCustomerId": "usr_8f21c",
"firstName": "Ada",
"lastName": "Lovelace",
"countryOfResidence": "USA",
"phoneNumber": "+12125550100"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'founder@example.com',
externalCustomerId: 'usr_8f21c',
firstName: 'Ada',
lastName: 'Lovelace',
countryOfResidence: 'USA',
phoneNumber: '+12125550100'
})
};
fetch('https://api.test.doola.com/v1/partner/customer-sessions', 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.test.doola.com/v1/partner/customer-sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'founder@example.com',
'externalCustomerId' => 'usr_8f21c',
'firstName' => 'Ada',
'lastName' => 'Lovelace',
'countryOfResidence' => 'USA',
'phoneNumber' => '+12125550100'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.test.doola.com/v1/partner/customer-sessions"
payload := strings.NewReader("{\n \"email\": \"founder@example.com\",\n \"externalCustomerId\": \"usr_8f21c\",\n \"firstName\": \"Ada\",\n \"lastName\": \"Lovelace\",\n \"countryOfResidence\": \"USA\",\n \"phoneNumber\": \"+12125550100\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.test.doola.com/v1/partner/customer-sessions")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"founder@example.com\",\n \"externalCustomerId\": \"usr_8f21c\",\n \"firstName\": \"Ada\",\n \"lastName\": \"Lovelace\",\n \"countryOfResidence\": \"USA\",\n \"phoneNumber\": \"+12125550100\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.test.doola.com/v1/partner/customer-sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"founder@example.com\",\n \"externalCustomerId\": \"usr_8f21c\",\n \"firstName\": \"Ada\",\n \"lastName\": \"Lovelace\",\n \"countryOfResidence\": \"USA\",\n \"phoneNumber\": \"+12125550100\"\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"expiresIn": 600
}Authorizations
Partner API key. Send the raw key as the Authorization header value — e.g. dk_test_… in sandbox or dk_live_… in production. Generate and rotate keys in the doola Partner Portal.
Body
Send this from your server, never the browser.
The customer's email. If no customer exists for it under your tenant, one is created.
1"founder@example.com"
Your own id for this customer. Optional, and the recommended integration: it is matched before the email, so a customer who changes their address in your system stays the same doola customer instead of being provisioned again with an empty wizard. Unique per tenant.
255"usr_8f21c"
Only used when provisioning a new customer.
"Ada"
Only used when provisioning a new customer.
"Lovelace"
ISO 3166-1 alpha-3. Only used when provisioning a new customer.
"USA"
E.164 format. Only used when provisioning a new customer.
"+12125550100"
Response
Token issued.
A short-lived token for one of your customers.
Return this to your frontend and hand it to the SDK. It acts only on this customer.
When the token stops being accepted. Renew before this, not after.
Remaining lifetime in seconds at mint. Schedule renewal from this, not from expiresAt: a relative timer keeps the end user's device clock out of the arithmetic.
600