Top up a fixed budget
curl --request POST \
--url https://api.sendler.ai/v1/client-workspaces/{id}/credits/top-up \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'idempotency-key: <idempotency-key>' \
--data '{
"amount": 250
}'import requests
url = "https://api.sendler.ai/v1/client-workspaces/{id}/credits/top-up"
payload = { "amount": 250 }
headers = {
"idempotency-key": "<idempotency-key>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'idempotency-key': '<idempotency-key>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount: 250})
};
fetch('https://api.sendler.ai/v1/client-workspaces/{id}/credits/top-up', 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.sendler.ai/v1/client-workspaces/{id}/credits/top-up",
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([
'amount' => 250
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"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.sendler.ai/v1/client-workspaces/{id}/credits/top-up"
payload := strings.NewReader("{\n \"amount\": 250\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("idempotency-key", "<idempotency-key>")
req.Header.Add("X-API-Key", "<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.sendler.ai/v1/client-workspaces/{id}/credits/top-up")
.header("idempotency-key", "<idempotency-key>")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 250\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sendler.ai/v1/client-workspaces/{id}/credits/top-up")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["idempotency-key"] = '<idempotency-key>'
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 250\n}"
response = http.request(request)
puts response.read_body{
"id": "cmb1x2y3z0000abcd",
"name": "Acme Corp",
"note": "Retainer client",
"creditMode": "NONE",
"limit": 500,
"used": 120,
"remaining": 380,
"exhaustedAt": null,
"seatCap": 3,
"seatsUsed": 1,
"members": 2,
"invited": 1
}Client Workspaces
Top Up Client Workspace
Add credits to a client workspace’s FIXED budget.
POST
/
v1
/
client-workspaces
/
{id}
/
credits
/
top-up
Top up a fixed budget
curl --request POST \
--url https://api.sendler.ai/v1/client-workspaces/{id}/credits/top-up \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'idempotency-key: <idempotency-key>' \
--data '{
"amount": 250
}'import requests
url = "https://api.sendler.ai/v1/client-workspaces/{id}/credits/top-up"
payload = { "amount": 250 }
headers = {
"idempotency-key": "<idempotency-key>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'idempotency-key': '<idempotency-key>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount: 250})
};
fetch('https://api.sendler.ai/v1/client-workspaces/{id}/credits/top-up', 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.sendler.ai/v1/client-workspaces/{id}/credits/top-up",
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([
'amount' => 250
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"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.sendler.ai/v1/client-workspaces/{id}/credits/top-up"
payload := strings.NewReader("{\n \"amount\": 250\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("idempotency-key", "<idempotency-key>")
req.Header.Add("X-API-Key", "<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.sendler.ai/v1/client-workspaces/{id}/credits/top-up")
.header("idempotency-key", "<idempotency-key>")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 250\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sendler.ai/v1/client-workspaces/{id}/credits/top-up")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["idempotency-key"] = '<idempotency-key>'
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 250\n}"
response = http.request(request)
puts response.read_body{
"id": "cmb1x2y3z0000abcd",
"name": "Acme Corp",
"note": "Retainer client",
"creditMode": "NONE",
"limit": 500,
"used": 120,
"remaining": 380,
"exhaustedAt": null,
"seatCap": 3,
"seatsUsed": 1,
"members": 2,
"invited": 1
}Requires
client_workspaces:manage. Requires the master of an active personal (agency) workspace. A key created in a client workspace, or by a non-master, cannot use the client workspace endpoints. If the personal workspace becomes inactive, its keys lose client workspace access.
A top-up adds amount to the budget. It only works when creditMode is FIXED; any other credit rule returns 409.
Idempotency-Key is required
Because a top-up adds credits, send anIdempotency-Key header. A retry with the same key adds the credits once. To set the balance to an exact number instead, use Set Client Workspace Limits with budgetRemaining.
If the workspace had run out, a top-up gives it credits again, and a later run-out sends a new workspace.credits_exhausted event.Authorizations
Body
application/json