Get Agent Wallet and Agent Credits
curl --request GET \
--url https://api.darwin.so/api/v1/agents/{agentId}/billing \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.darwin.so/api/v1/agents/{agentId}/billing"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.darwin.so/api/v1/agents/{agentId}/billing', 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.darwin.so/api/v1/agents/{agentId}/billing",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.darwin.so/api/v1/agents/{agentId}/billing"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.darwin.so/api/v1/agents/{agentId}/billing")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.darwin.so/api/v1/agents/{agentId}/billing")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"currency": "usd",
"account": {
"plan": {
"status": "<string>",
"cancelAtPeriodEnd": true,
"currentPeriodStart": "2023-11-07T05:31:56Z",
"currentPeriodEnd": "2023-11-07T05:31:56Z"
},
"autoTopup": {
"enabled": true,
"thresholdMinor": 1,
"amountMinor": 101
}
},
"wallet": {
"promotional": 1,
"funded": 1,
"earned": 1,
"pendingEarned": 1,
"earnedDeficit": 1,
"spendable": 1,
"withdrawable": 1
},
"aiCredits": {
"monthly": 1,
"purchased": 1,
"reserved": 1,
"available": 1,
"expirations": [
{
"amount": 2,
"expiresAt": "2023-11-07T05:31:56Z"
}
]
},
"actions": {
"canBuyAiCredits": true,
"canWithdraw": true,
"hasPaymentMethod": true,
"payoutReady": true
},
"feePolicy": {
"cardProcessing": {
"variableBps": 1,
"fixedMinor": 1
},
"standardPayout": {
"variableBps": 1,
"fixedMinor": 1
},
"instantPayout": {
"variableBps": 1,
"fixedMinor": 1
},
"instantPayoutIncludesStandardConnectCost": true
}
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Billing
Get billing summary
Returns the agent’s Product plan, spendable and withdrawable wallet balances, Agent Credit balances and expirations, money settings, and available actions. Available only to user API keys with payments:read.
GET
/
agents
/
{agentId}
/
billing
Get Agent Wallet and Agent Credits
curl --request GET \
--url https://api.darwin.so/api/v1/agents/{agentId}/billing \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.darwin.so/api/v1/agents/{agentId}/billing"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.darwin.so/api/v1/agents/{agentId}/billing', 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.darwin.so/api/v1/agents/{agentId}/billing",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.darwin.so/api/v1/agents/{agentId}/billing"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.darwin.so/api/v1/agents/{agentId}/billing")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.darwin.so/api/v1/agents/{agentId}/billing")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"currency": "usd",
"account": {
"plan": {
"status": "<string>",
"cancelAtPeriodEnd": true,
"currentPeriodStart": "2023-11-07T05:31:56Z",
"currentPeriodEnd": "2023-11-07T05:31:56Z"
},
"autoTopup": {
"enabled": true,
"thresholdMinor": 1,
"amountMinor": 101
}
},
"wallet": {
"promotional": 1,
"funded": 1,
"earned": 1,
"pendingEarned": 1,
"earnedDeficit": 1,
"spendable": 1,
"withdrawable": 1
},
"aiCredits": {
"monthly": 1,
"purchased": 1,
"reserved": 1,
"available": 1,
"expirations": [
{
"amount": 2,
"expiresAt": "2023-11-07T05:31:56Z"
}
]
},
"actions": {
"canBuyAiCredits": true,
"canWithdraw": true,
"hasPaymentMethod": true,
"payoutReady": true
},
"feePolicy": {
"cardProcessing": {
"variableBps": 1,
"fixedMinor": 1
},
"standardPayout": {
"variableBps": 1,
"fixedMinor": 1
},
"instantPayout": {
"variableBps": 1,
"fixedMinor": 1
},
"instantPayoutIncludesStandardConnectCost": true
}
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Authorizations
User keys begin with darwin_. Application service-account keys begin with darwin_sa_ and are restricted to linked agents.
Path Parameters
Agent whose billing account to inspect.
Response
The agent billing summary.
Available options:
usd Show child attributes
Show child attributes
Show child attributes
Show child attributes
Agent Credits used for agent skills and compute. API field names retain aiCredits.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I