Deposit to Agent
curl --request POST \
--url https://api.magebank.ai/agents/deposit \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"userid": "<string>",
"agentid": "<string>",
"amount": 123,
"currency": "<string>"
}
'import requests
url = "https://api.magebank.ai/agents/deposit"
payload = {
"userid": "<string>",
"agentid": "<string>",
"amount": 123,
"currency": "<string>"
}
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>', agentid: '<string>', amount: 123, currency: '<string>'})
};
fetch('https://api.magebank.ai/agents/deposit', 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/deposit",
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>',
'agentid' => '<string>',
'amount' => 123,
'currency' => '<string>'
]),
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/deposit"
payload := strings.NewReader("{\n \"userid\": \"<string>\",\n \"agentid\": \"<string>\",\n \"amount\": 123,\n \"currency\": \"<string>\"\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/deposit")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"userid\": \"<string>\",\n \"agentid\": \"<string>\",\n \"amount\": 123,\n \"currency\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magebank.ai/agents/deposit")
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 \"agentid\": \"<string>\",\n \"amount\": 123,\n \"currency\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"txHash": "0x123...abc",
"message": "Successfully deposited 50 USDC to agent",
"updatedBalance": "150"
}
{
"error": "userid, agentid, and amount are required."
}
{
"error": "Invalid deposit amount"
}
{
"error": "User wallet not found or inaccessible"
}
{
"error": "Agent not found"
}
{
"success": false,
"error": "Transfer failed on-chain: insufficient funds"
}
Agents
Deposit to Agent
Deposit funds into an agent’s wallet
POST
/
agents
/
deposit
Deposit to Agent
curl --request POST \
--url https://api.magebank.ai/agents/deposit \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"userid": "<string>",
"agentid": "<string>",
"amount": 123,
"currency": "<string>"
}
'import requests
url = "https://api.magebank.ai/agents/deposit"
payload = {
"userid": "<string>",
"agentid": "<string>",
"amount": 123,
"currency": "<string>"
}
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>', agentid: '<string>', amount: 123, currency: '<string>'})
};
fetch('https://api.magebank.ai/agents/deposit', 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/deposit",
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>',
'agentid' => '<string>',
'amount' => 123,
'currency' => '<string>'
]),
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/deposit"
payload := strings.NewReader("{\n \"userid\": \"<string>\",\n \"agentid\": \"<string>\",\n \"amount\": 123,\n \"currency\": \"<string>\"\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/deposit")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"userid\": \"<string>\",\n \"agentid\": \"<string>\",\n \"amount\": 123,\n \"currency\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magebank.ai/agents/deposit")
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 \"agentid\": \"<string>\",\n \"amount\": 123,\n \"currency\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"txHash": "0x123...abc",
"message": "Successfully deposited 50 USDC to agent",
"updatedBalance": "150"
}
{
"error": "userid, agentid, and amount are required."
}
{
"error": "Invalid deposit amount"
}
{
"error": "User wallet not found or inaccessible"
}
{
"error": "Agent not found"
}
{
"success": false,
"error": "Transfer failed on-chain: insufficient funds"
}
Blockchain Transaction: This endpoint transfers funds from a user’s wallet to an agent’s wallet through an on-chain transaction.
Request Headers
string
required
Your API key for authentication
Request Body
string
required
ID of the user initiating the deposit
string
required
ID of the agent receiving the deposit
number
required
Amount to deposit
string
default:"USDC"
Currency type to deposit (defaults to USDC)
Response
boolean
Whether the deposit was successful
string
Transaction hash on the blockchain
string
Information about the deposit
string
New balance of the agent after the deposit
{
"success": true,
"txHash": "0x123...abc",
"message": "Successfully deposited 50 USDC to agent",
"updatedBalance": "150"
}
{
"error": "userid, agentid, and amount are required."
}
{
"error": "Invalid deposit amount"
}
{
"error": "User wallet not found or inaccessible"
}
{
"error": "Agent not found"
}
{
"success": false,
"error": "Transfer failed on-chain: insufficient funds"
}
Status Codes
| Status Code | Description |
|---|---|
| 200 | Funds deposited successfully |
| 400 | Bad Request - Invalid or missing parameters |
| 404 | Not Found - Agent or user not found |
| 500 | Internal Server Error - Transaction failed |
Wallet Requirements: The user must have sufficient funds in their wallet and the wallet must be accessible for the deposit to succeed.
Transaction Time: Blockchain transactions may take a few moments to be confirmed. The response is sent after confirmation.