curl --request POST \
--url https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"credits": "<string>",
"promo": true
}
'import requests
url = "https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate"
payload = {
"credits": "<string>",
"promo": True
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({credits: '<string>', promo: true})
};
fetch('https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate', 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.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate",
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([
'credits' => '<string>',
'promo' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate"
payload := strings.NewReader("{\n \"credits\": \"<string>\",\n \"promo\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"credits\": \"<string>\",\n \"promo\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credits\": \"<string>\",\n \"promo\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"externalUserId": "<string>",
"usd": "<string>",
"credits": "<string>",
"poolBalanceUsd": "<string>",
"endUserBalanceUsd": "<string>"
}Allocate credits to an end-user
Atomic platform-pool → end-user transfer; both sides ledgered. Fails (402) if the pool cannot cover it — unfunded allocations are impossible. Amounts are exact decimal strings.
curl --request POST \
--url https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"credits": "<string>",
"promo": true
}
'import requests
url = "https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate"
payload = {
"credits": "<string>",
"promo": True
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({credits: '<string>', promo: true})
};
fetch('https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate', 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.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate",
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([
'credits' => '<string>',
'promo' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate"
payload := strings.NewReader("{\n \"credits\": \"<string>\",\n \"promo\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"credits\": \"<string>\",\n \"promo\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credits\": \"<string>\",\n \"promo\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"externalUserId": "<string>",
"usd": "<string>",
"credits": "<string>",
"poolBalanceUsd": "<string>",
"endUserBalanceUsd": "<string>"
}Authorizations
Locus Pro dashboard session (Cognito).
Headers
One key per logical transfer; reuse it on retries.
1 - 255Path Parameters
Case-sensitive immutable ID in the tenant namespace. Prefer an identity-provider subject, not an email address.
1 - 200^[A-Za-z0-9][A-Za-z0-9._:@/-]{0,199}$Body
Response
Allocation applied; returns both balances
Case-sensitive immutable ID in the tenant namespace. Prefer an identity-provider subject, not an email address.
1 - 200^[A-Za-z0-9][A-Za-z0-9._:@/-]{0,199}$Non-negative exact decimal string with at most six fractional digits. Endpoint-specific positivity and amount limits still apply.
^\d+(?:\.\d{1,6})?$Non-negative exact decimal string with at most six fractional digits. Endpoint-specific positivity and amount limits still apply.
^\d+(?:\.\d{1,6})?$Non-negative exact decimal string with at most six fractional digits. Endpoint-specific positivity and amount limits still apply.
^\d+(?:\.\d{1,6})?$Non-negative exact decimal string with at most six fractional digits. Endpoint-specific positivity and amount limits still apply.
^\d+(?:\.\d{1,6})?$