Create agent
curl --request POST \
--url https://api-sandbox.sohopay.xyz/v1/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"merchant_id": "mch_3f2a1b0c",
"name": "research-agent-01",
"credit_limit": "250.00",
"daily_limit": "50.00",
"operator_acknowledgment": true,
"metadata": {}
}
'import requests
url = "https://api-sandbox.sohopay.xyz/v1/agents"
payload = {
"merchant_id": "mch_3f2a1b0c",
"name": "research-agent-01",
"credit_limit": "250.00",
"daily_limit": "50.00",
"operator_acknowledgment": True,
"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({
merchant_id: 'mch_3f2a1b0c',
name: 'research-agent-01',
credit_limit: '250.00',
daily_limit: '50.00',
operator_acknowledgment: true,
metadata: {}
})
};
fetch('https://api-sandbox.sohopay.xyz/v1/agents', 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-sandbox.sohopay.xyz/v1/agents",
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([
'merchant_id' => 'mch_3f2a1b0c',
'name' => 'research-agent-01',
'credit_limit' => '250.00',
'daily_limit' => '50.00',
'operator_acknowledgment' => true,
'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-sandbox.sohopay.xyz/v1/agents"
payload := strings.NewReader("{\n \"merchant_id\": \"mch_3f2a1b0c\",\n \"name\": \"research-agent-01\",\n \"credit_limit\": \"250.00\",\n \"daily_limit\": \"50.00\",\n \"operator_acknowledgment\": true,\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-sandbox.sohopay.xyz/v1/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"merchant_id\": \"mch_3f2a1b0c\",\n \"name\": \"research-agent-01\",\n \"credit_limit\": \"250.00\",\n \"daily_limit\": \"50.00\",\n \"operator_acknowledgment\": true,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.sohopay.xyz/v1/agents")
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 \"merchant_id\": \"mch_3f2a1b0c\",\n \"name\": \"research-agent-01\",\n \"credit_limit\": \"250.00\",\n \"daily_limit\": \"50.00\",\n \"operator_acknowledgment\": true,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"agent_id": "agt_7d1e5b2f",
"merchant_id": "mch_3f2a1b0c",
"name": "research-agent-01",
"wallet_address": "0x8ba1f109551bd432803012645ac136ddd64dba72",
"status": "active",
"credit_limit": "250.00",
"daily_limit": "50.00",
"outstanding_balance": "0.00",
"available_credit": "250.00",
"created_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "INSUFFICIENT_CREDIT",
"message": "Agent agt_7d1e5b2f has 12.50 USDC available; order requires 25.00 USDC.",
"request_id": "req_01j8x9y2z3"
}
}{
"error": {
"code": "INSUFFICIENT_CREDIT",
"message": "Agent agt_7d1e5b2f has 12.50 USDC available; order requires 25.00 USDC.",
"request_id": "req_01j8x9y2z3"
}
}{
"error": {
"code": "INSUFFICIENT_CREDIT",
"message": "Agent agt_7d1e5b2f has 12.50 USDC available; order requires 25.00 USDC.",
"request_id": "req_01j8x9y2z3"
}
}Agents
Create agent
Creates a new agent with a credit line. Key material is generated inside SohoPay’s MPC infrastructure — the private key never leaves the signing enclave. Requires the operator liability acknowledgment.
POST
/
agents
Create agent
curl --request POST \
--url https://api-sandbox.sohopay.xyz/v1/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"merchant_id": "mch_3f2a1b0c",
"name": "research-agent-01",
"credit_limit": "250.00",
"daily_limit": "50.00",
"operator_acknowledgment": true,
"metadata": {}
}
'import requests
url = "https://api-sandbox.sohopay.xyz/v1/agents"
payload = {
"merchant_id": "mch_3f2a1b0c",
"name": "research-agent-01",
"credit_limit": "250.00",
"daily_limit": "50.00",
"operator_acknowledgment": True,
"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({
merchant_id: 'mch_3f2a1b0c',
name: 'research-agent-01',
credit_limit: '250.00',
daily_limit: '50.00',
operator_acknowledgment: true,
metadata: {}
})
};
fetch('https://api-sandbox.sohopay.xyz/v1/agents', 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-sandbox.sohopay.xyz/v1/agents",
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([
'merchant_id' => 'mch_3f2a1b0c',
'name' => 'research-agent-01',
'credit_limit' => '250.00',
'daily_limit' => '50.00',
'operator_acknowledgment' => true,
'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-sandbox.sohopay.xyz/v1/agents"
payload := strings.NewReader("{\n \"merchant_id\": \"mch_3f2a1b0c\",\n \"name\": \"research-agent-01\",\n \"credit_limit\": \"250.00\",\n \"daily_limit\": \"50.00\",\n \"operator_acknowledgment\": true,\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-sandbox.sohopay.xyz/v1/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"merchant_id\": \"mch_3f2a1b0c\",\n \"name\": \"research-agent-01\",\n \"credit_limit\": \"250.00\",\n \"daily_limit\": \"50.00\",\n \"operator_acknowledgment\": true,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.sohopay.xyz/v1/agents")
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 \"merchant_id\": \"mch_3f2a1b0c\",\n \"name\": \"research-agent-01\",\n \"credit_limit\": \"250.00\",\n \"daily_limit\": \"50.00\",\n \"operator_acknowledgment\": true,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"agent_id": "agt_7d1e5b2f",
"merchant_id": "mch_3f2a1b0c",
"name": "research-agent-01",
"wallet_address": "0x8ba1f109551bd432803012645ac136ddd64dba72",
"status": "active",
"credit_limit": "250.00",
"daily_limit": "50.00",
"outstanding_balance": "0.00",
"available_credit": "250.00",
"created_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "INSUFFICIENT_CREDIT",
"message": "Agent agt_7d1e5b2f has 12.50 USDC available; order requires 25.00 USDC.",
"request_id": "req_01j8x9y2z3"
}
}{
"error": {
"code": "INSUFFICIENT_CREDIT",
"message": "Agent agt_7d1e5b2f has 12.50 USDC available; order requires 25.00 USDC.",
"request_id": "req_01j8x9y2z3"
}
}{
"error": {
"code": "INSUFFICIENT_CREDIT",
"message": "Agent agt_7d1e5b2f has 12.50 USDC available; order requires 25.00 USDC.",
"request_id": "req_01j8x9y2z3"
}
}Authorizations
API key as Bearer token. Sandbox keys start with sk_test_, mainnet keys with sk_live_.
Headers
Unique key to make retries safe. Strongly recommended for all write requests.
Body
application/json
Example:
"mch_3f2a1b0c"
Example:
"research-agent-01"
Maximum outstanding balance in USDC
Example:
"250.00"
Maximum daily spend in USDC
Example:
"50.00"
Must be true. Confirms the operator accepts liability for this agent's transactions.
Example:
true
Arbitrary key-value metadata
Response
Agent created
Example:
"agt_7d1e5b2f"
Example:
"mch_3f2a1b0c"
Example:
"research-agent-01"
Example:
"0x8ba1f109551bd432803012645ac136ddd64dba72"
Available options:
active, paused, revoked Example:
"active"
Example:
"250.00"
Example:
"50.00"
Example:
"0.00"
Example:
"250.00"
⌘I

