Create Agent
curl --request POST \
--url https://api.magebank.ai/agents/create \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"userid": "<string>",
"walletaddress": "<string>",
"name": "<string>",
"description": "<string>",
"balance": 123,
"dailylimit": 123,
"transactionlimit": 123,
"currency": "<string>",
"requireapprovalforall": true,
"requireapprovalaboveamount": 123,
"tags": [
{}
]
}
'import requests
url = "https://api.magebank.ai/agents/create"
payload = {
"userid": "<string>",
"walletaddress": "<string>",
"name": "<string>",
"description": "<string>",
"balance": 123,
"dailylimit": 123,
"transactionlimit": 123,
"currency": "<string>",
"requireapprovalforall": True,
"requireapprovalaboveamount": 123,
"tags": [{}]
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
userid: '<string>',
walletaddress: '<string>',
name: '<string>',
description: '<string>',
balance: 123,
dailylimit: 123,
transactionlimit: 123,
currency: '<string>',
requireapprovalforall: true,
requireapprovalaboveamount: 123,
tags: [{}]
})
};
fetch('https://api.magebank.ai/agents/create', 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.magebank.ai/agents/create",
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([
'userid' => '<string>',
'walletaddress' => '<string>',
'name' => '<string>',
'description' => '<string>',
'balance' => 123,
'dailylimit' => 123,
'transactionlimit' => 123,
'currency' => '<string>',
'requireapprovalforall' => true,
'requireapprovalaboveamount' => 123,
'tags' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-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.magebank.ai/agents/create"
payload := strings.NewReader("{\n \"userid\": \"<string>\",\n \"walletaddress\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"balance\": 123,\n \"dailylimit\": 123,\n \"transactionlimit\": 123,\n \"currency\": \"<string>\",\n \"requireapprovalforall\": true,\n \"requireapprovalaboveamount\": 123,\n \"tags\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-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.magebank.ai/agents/create")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"userid\": \"<string>\",\n \"walletaddress\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"balance\": 123,\n \"dailylimit\": 123,\n \"transactionlimit\": 123,\n \"currency\": \"<string>\",\n \"requireapprovalforall\": true,\n \"requireapprovalaboveamount\": 123,\n \"tags\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magebank.ai/agents/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userid\": \"<string>\",\n \"walletaddress\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"balance\": 123,\n \"dailylimit\": 123,\n \"transactionlimit\": 123,\n \"currency\": \"<string>\",\n \"requireapprovalforall\": true,\n \"requireapprovalaboveamount\": 123,\n \"tags\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "agent_bRSEFnMRD1fvkMM39hzPdM",
"apikey": "mag_eJwVyN0OgiAYANA3cprT1qV_tY8E0jCVuyILSMtNG-LTt87l6SySt4NQVCGoVvCIggneZSASCOE1NpcE7ZzOopH_Q1c-12A4K4e8zgxnMJM0sjjxFE3xJmc4wDUsre4lGUpJzzDB0Mt7AiFmwiUaAppin1ijeCMN6M9C1mKD12ihTPiPwjkNZXQPme6DbGlNBc9aPfcCbb_dMRb2MbE-vqIKzdgtfgVGPxc",
"name": "Payment Assistant",
"description": "Handles payment processing for customer support",
"status": "active",
"walletAddress": {
"addressId": "",
"networkId": "base-sepolia",
"walletId": ""
},
"balance": "6",
"currency": "USDC",
"paymentRules": {
"dailyLimit": 1000,
"transactionLimit": 100,
"requireApprovalAboveAmount": 50,
"requireApprovalForAll": false
},
"tags": [
"customer-support",
"payments"
],
"created": "2025-05-03T18:52:39.911685+00:00",
"transferResult": {
"success": true,
"txHash": "0x123...abc",
"message": "Successfully transferred 6 USDC from user to agent wallet"
},
"faucetTransaction": {
"success": true,
"txHash": "0xabc...123",
"message": "ETH testnet funds received via faucet"
}
}
{
"id": "agent_bRSEFnMRD1fvkMM39hzPdM",
"warning": "Agent created successfully, but funding transfer failed. Please try funding the agent manually."
}
{
"error": "Agent name is required"
}
{
"error": "User not found"
}
{
"error": "Internal server error"
}
Agents
Create Agent
Create a new agent and fund its wallet
POST
/
agents
/
create
Create Agent
curl --request POST \
--url https://api.magebank.ai/agents/create \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"userid": "<string>",
"walletaddress": "<string>",
"name": "<string>",
"description": "<string>",
"balance": 123,
"dailylimit": 123,
"transactionlimit": 123,
"currency": "<string>",
"requireapprovalforall": true,
"requireapprovalaboveamount": 123,
"tags": [
{}
]
}
'import requests
url = "https://api.magebank.ai/agents/create"
payload = {
"userid": "<string>",
"walletaddress": "<string>",
"name": "<string>",
"description": "<string>",
"balance": 123,
"dailylimit": 123,
"transactionlimit": 123,
"currency": "<string>",
"requireapprovalforall": True,
"requireapprovalaboveamount": 123,
"tags": [{}]
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
userid: '<string>',
walletaddress: '<string>',
name: '<string>',
description: '<string>',
balance: 123,
dailylimit: 123,
transactionlimit: 123,
currency: '<string>',
requireapprovalforall: true,
requireapprovalaboveamount: 123,
tags: [{}]
})
};
fetch('https://api.magebank.ai/agents/create', 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.magebank.ai/agents/create",
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([
'userid' => '<string>',
'walletaddress' => '<string>',
'name' => '<string>',
'description' => '<string>',
'balance' => 123,
'dailylimit' => 123,
'transactionlimit' => 123,
'currency' => '<string>',
'requireapprovalforall' => true,
'requireapprovalaboveamount' => 123,
'tags' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-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.magebank.ai/agents/create"
payload := strings.NewReader("{\n \"userid\": \"<string>\",\n \"walletaddress\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"balance\": 123,\n \"dailylimit\": 123,\n \"transactionlimit\": 123,\n \"currency\": \"<string>\",\n \"requireapprovalforall\": true,\n \"requireapprovalaboveamount\": 123,\n \"tags\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-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.magebank.ai/agents/create")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"userid\": \"<string>\",\n \"walletaddress\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"balance\": 123,\n \"dailylimit\": 123,\n \"transactionlimit\": 123,\n \"currency\": \"<string>\",\n \"requireapprovalforall\": true,\n \"requireapprovalaboveamount\": 123,\n \"tags\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magebank.ai/agents/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userid\": \"<string>\",\n \"walletaddress\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"balance\": 123,\n \"dailylimit\": 123,\n \"transactionlimit\": 123,\n \"currency\": \"<string>\",\n \"requireapprovalforall\": true,\n \"requireapprovalaboveamount\": 123,\n \"tags\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "agent_bRSEFnMRD1fvkMM39hzPdM",
"apikey": "mag_eJwVyN0OgiAYANA3cprT1qV_tY8E0jCVuyILSMtNG-LTt87l6SySt4NQVCGoVvCIggneZSASCOE1NpcE7ZzOopH_Q1c-12A4K4e8zgxnMJM0sjjxFE3xJmc4wDUsre4lGUpJzzDB0Mt7AiFmwiUaAppin1ijeCMN6M9C1mKD12ihTPiPwjkNZXQPme6DbGlNBc9aPfcCbb_dMRb2MbE-vqIKzdgtfgVGPxc",
"name": "Payment Assistant",
"description": "Handles payment processing for customer support",
"status": "active",
"walletAddress": {
"addressId": "",
"networkId": "base-sepolia",
"walletId": ""
},
"balance": "6",
"currency": "USDC",
"paymentRules": {
"dailyLimit": 1000,
"transactionLimit": 100,
"requireApprovalAboveAmount": 50,
"requireApprovalForAll": false
},
"tags": [
"customer-support",
"payments"
],
"created": "2025-05-03T18:52:39.911685+00:00",
"transferResult": {
"success": true,
"txHash": "0x123...abc",
"message": "Successfully transferred 6 USDC from user to agent wallet"
},
"faucetTransaction": {
"success": true,
"txHash": "0xabc...123",
"message": "ETH testnet funds received via faucet"
}
}
{
"id": "agent_bRSEFnMRD1fvkMM39hzPdM",
"warning": "Agent created successfully, but funding transfer failed. Please try funding the agent manually."
}
{
"error": "Agent name is required"
}
{
"error": "User not found"
}
{
"error": "Internal server error"
}
Multi-step Process: This endpoint creates a new agent, generates a blockchain wallet, and can fund the wallet from your user account or via a testnet faucet.
Request Headers
string
required
Your API key for authentication
Request Body
string
required
ID of the user creating the agent
string
User’s wallet address for funding (optional)
string
required
Name of the agent
string
Purpose and functionality of the agent
integer
Initial balance to fund the agent (in smallest units)
integer
Maximum amount that can be spent per day
integer
Maximum amount for a single transaction
string
default:"USDC"
Currency type to use (defaults to USDC)
boolean
default:"false"
Whether all transactions require approval
integer
Transactions above this amount require approval
array
Categories or labels to assign to the agent
Response
string
Unique agent identifier
string
The API key for the agent
string
Name of the agent
string
Purpose and functionality of the agent
string
Current status of the agent (active, inactive, paused)
object
string
Current balance of the agent
string
Currency type used
object
array
Categories or labels assigned to the agent
string
Timestamp when the agent was created
object
object
{
"id": "agent_bRSEFnMRD1fvkMM39hzPdM",
"apikey": "mag_eJwVyN0OgiAYANA3cprT1qV_tY8E0jCVuyILSMtNG-LTt87l6SySt4NQVCGoVvCIggneZSASCOE1NpcE7ZzOopH_Q1c-12A4K4e8zgxnMJM0sjjxFE3xJmc4wDUsre4lGUpJzzDB0Mt7AiFmwiUaAppin1ijeCMN6M9C1mKD12ihTPiPwjkNZXQPme6DbGlNBc9aPfcCbb_dMRb2MbE-vqIKzdgtfgVGPxc",
"name": "Payment Assistant",
"description": "Handles payment processing for customer support",
"status": "active",
"walletAddress": {
"addressId": "",
"networkId": "base-sepolia",
"walletId": ""
},
"balance": "6",
"currency": "USDC",
"paymentRules": {
"dailyLimit": 1000,
"transactionLimit": 100,
"requireApprovalAboveAmount": 50,
"requireApprovalForAll": false
},
"tags": [
"customer-support",
"payments"
],
"created": "2025-05-03T18:52:39.911685+00:00",
"transferResult": {
"success": true,
"txHash": "0x123...abc",
"message": "Successfully transferred 6 USDC from user to agent wallet"
},
"faucetTransaction": {
"success": true,
"txHash": "0xabc...123",
"message": "ETH testnet funds received via faucet"
}
}
{
"id": "agent_bRSEFnMRD1fvkMM39hzPdM",
"warning": "Agent created successfully, but funding transfer failed. Please try funding the agent manually."
}
{
"error": "Agent name is required"
}
{
"error": "User not found"
}
{
"error": "Internal server error"
}
Status Codes
| Status Code | Description |
|---|---|
| 200 | Agent created and funded successfully |
| 201 | Agent created, but funding transfer failed |
| 400 | Bad Request - Invalid or missing parameters |
| 404 | Not Found - User ID not found |
| 500 | Internal Server Error |
Important: Store the returned API key securely as it will be needed for all future operations with this agent.