Mandates
Create Mandate
POST
/
mandates
Create Mandate
curl --request POST \
--url https://api.usemandate.io/mandates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "agt_abc123",
"purpose": "Fetch financial data from paid APIs",
"max_spend_total": "100.00",
"max_spend_per_transaction": "10.00",
"expires_at": "2026-12-31T00:00:00Z",
"currency": "USDC",
"allowed_sellers": [
"api.example.com"
],
"allowed_categories": [
"data"
]
}
'import requests
url = "https://api.usemandate.io/mandates"
payload = {
"agent_id": "agt_abc123",
"purpose": "Fetch financial data from paid APIs",
"max_spend_total": "100.00",
"max_spend_per_transaction": "10.00",
"expires_at": "2026-12-31T00:00:00Z",
"currency": "USDC",
"allowed_sellers": ["api.example.com"],
"allowed_categories": ["data"]
}
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({
agent_id: 'agt_abc123',
purpose: 'Fetch financial data from paid APIs',
max_spend_total: '100.00',
max_spend_per_transaction: '10.00',
expires_at: '2026-12-31T00:00:00Z',
currency: 'USDC',
allowed_sellers: ['api.example.com'],
allowed_categories: ['data']
})
};
fetch('https://api.usemandate.io/mandates', 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.usemandate.io/mandates",
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([
'agent_id' => 'agt_abc123',
'purpose' => 'Fetch financial data from paid APIs',
'max_spend_total' => '100.00',
'max_spend_per_transaction' => '10.00',
'expires_at' => '2026-12-31T00:00:00Z',
'currency' => 'USDC',
'allowed_sellers' => [
'api.example.com'
],
'allowed_categories' => [
'data'
]
]),
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.usemandate.io/mandates"
payload := strings.NewReader("{\n \"agent_id\": \"agt_abc123\",\n \"purpose\": \"Fetch financial data from paid APIs\",\n \"max_spend_total\": \"100.00\",\n \"max_spend_per_transaction\": \"10.00\",\n \"expires_at\": \"2026-12-31T00:00:00Z\",\n \"currency\": \"USDC\",\n \"allowed_sellers\": [\n \"api.example.com\"\n ],\n \"allowed_categories\": [\n \"data\"\n ]\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.usemandate.io/mandates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"agt_abc123\",\n \"purpose\": \"Fetch financial data from paid APIs\",\n \"max_spend_total\": \"100.00\",\n \"max_spend_per_transaction\": \"10.00\",\n \"expires_at\": \"2026-12-31T00:00:00Z\",\n \"currency\": \"USDC\",\n \"allowed_sellers\": [\n \"api.example.com\"\n ],\n \"allowed_categories\": [\n \"data\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usemandate.io/mandates")
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 \"agent_id\": \"agt_abc123\",\n \"purpose\": \"Fetch financial data from paid APIs\",\n \"max_spend_total\": \"100.00\",\n \"max_spend_per_transaction\": \"10.00\",\n \"expires_at\": \"2026-12-31T00:00:00Z\",\n \"currency\": \"USDC\",\n \"allowed_sellers\": [\n \"api.example.com\"\n ],\n \"allowed_categories\": [\n \"data\"\n ]\n}"
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Use your sandbox (ky_sand_) or production (ky_prod_) API key
Body
application/json
Example:
"agt_abc123"
Example:
"Fetch financial data from paid APIs"
Example:
"100.00"
Example:
"10.00"
Example:
"2026-12-31T00:00:00Z"
Example:
"USDC"
Example:
["api.example.com"]
Example:
["data"]
Response
Successful Response
The response is of type Response Create Mandate Route Mandates Post · object.
⌘I
Create Mandate
curl --request POST \
--url https://api.usemandate.io/mandates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "agt_abc123",
"purpose": "Fetch financial data from paid APIs",
"max_spend_total": "100.00",
"max_spend_per_transaction": "10.00",
"expires_at": "2026-12-31T00:00:00Z",
"currency": "USDC",
"allowed_sellers": [
"api.example.com"
],
"allowed_categories": [
"data"
]
}
'import requests
url = "https://api.usemandate.io/mandates"
payload = {
"agent_id": "agt_abc123",
"purpose": "Fetch financial data from paid APIs",
"max_spend_total": "100.00",
"max_spend_per_transaction": "10.00",
"expires_at": "2026-12-31T00:00:00Z",
"currency": "USDC",
"allowed_sellers": ["api.example.com"],
"allowed_categories": ["data"]
}
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({
agent_id: 'agt_abc123',
purpose: 'Fetch financial data from paid APIs',
max_spend_total: '100.00',
max_spend_per_transaction: '10.00',
expires_at: '2026-12-31T00:00:00Z',
currency: 'USDC',
allowed_sellers: ['api.example.com'],
allowed_categories: ['data']
})
};
fetch('https://api.usemandate.io/mandates', 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.usemandate.io/mandates",
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([
'agent_id' => 'agt_abc123',
'purpose' => 'Fetch financial data from paid APIs',
'max_spend_total' => '100.00',
'max_spend_per_transaction' => '10.00',
'expires_at' => '2026-12-31T00:00:00Z',
'currency' => 'USDC',
'allowed_sellers' => [
'api.example.com'
],
'allowed_categories' => [
'data'
]
]),
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.usemandate.io/mandates"
payload := strings.NewReader("{\n \"agent_id\": \"agt_abc123\",\n \"purpose\": \"Fetch financial data from paid APIs\",\n \"max_spend_total\": \"100.00\",\n \"max_spend_per_transaction\": \"10.00\",\n \"expires_at\": \"2026-12-31T00:00:00Z\",\n \"currency\": \"USDC\",\n \"allowed_sellers\": [\n \"api.example.com\"\n ],\n \"allowed_categories\": [\n \"data\"\n ]\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.usemandate.io/mandates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"agt_abc123\",\n \"purpose\": \"Fetch financial data from paid APIs\",\n \"max_spend_total\": \"100.00\",\n \"max_spend_per_transaction\": \"10.00\",\n \"expires_at\": \"2026-12-31T00:00:00Z\",\n \"currency\": \"USDC\",\n \"allowed_sellers\": [\n \"api.example.com\"\n ],\n \"allowed_categories\": [\n \"data\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usemandate.io/mandates")
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 \"agent_id\": \"agt_abc123\",\n \"purpose\": \"Fetch financial data from paid APIs\",\n \"max_spend_total\": \"100.00\",\n \"max_spend_per_transaction\": \"10.00\",\n \"expires_at\": \"2026-12-31T00:00:00Z\",\n \"currency\": \"USDC\",\n \"allowed_sellers\": [\n \"api.example.com\"\n ],\n \"allowed_categories\": [\n \"data\"\n ]\n}"
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}
