Create a new spending limit
curl --request POST \
--url https://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-squads-network: <x-squads-network>' \
--data '
{
"amount": "<string>",
"token_address": "<string>",
"transaction_signers": [
"<string>"
],
"spending_limit_signers": [
"<string>"
],
"destinations": [
"<string>"
],
"expiration": 123,
"fee_config": {
"currency": "<string>",
"payer_address": "<string>",
"self_managed_fees": false
}
}
'import requests
url = "https://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits"
payload = {
"amount": "<string>",
"token_address": "<string>",
"transaction_signers": ["<string>"],
"spending_limit_signers": ["<string>"],
"destinations": ["<string>"],
"expiration": 123,
"fee_config": {
"currency": "<string>",
"payer_address": "<string>",
"self_managed_fees": False
}
}
headers = {
"x-squads-network": "<x-squads-network>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-squads-network': '<x-squads-network>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '<string>',
token_address: '<string>',
transaction_signers: ['<string>'],
spending_limit_signers: ['<string>'],
destinations: ['<string>'],
expiration: 123,
fee_config: {currency: '<string>', payer_address: '<string>', self_managed_fees: false}
})
};
fetch('https://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits', 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://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits",
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([
'amount' => '<string>',
'token_address' => '<string>',
'transaction_signers' => [
'<string>'
],
'spending_limit_signers' => [
'<string>'
],
'destinations' => [
'<string>'
],
'expiration' => 123,
'fee_config' => [
'currency' => '<string>',
'payer_address' => '<string>',
'self_managed_fees' => false
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-squads-network: <x-squads-network>"
],
]);
$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://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"token_address\": \"<string>\",\n \"transaction_signers\": [\n \"<string>\"\n ],\n \"spending_limit_signers\": [\n \"<string>\"\n ],\n \"destinations\": [\n \"<string>\"\n ],\n \"expiration\": 123,\n \"fee_config\": {\n \"currency\": \"<string>\",\n \"payer_address\": \"<string>\",\n \"self_managed_fees\": false\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-squads-network", "<x-squads-network>")
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://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits")
.header("x-squads-network", "<x-squads-network>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"token_address\": \"<string>\",\n \"transaction_signers\": [\n \"<string>\"\n ],\n \"spending_limit_signers\": [\n \"<string>\"\n ],\n \"destinations\": [\n \"<string>\"\n ],\n \"expiration\": 123,\n \"fee_config\": {\n \"currency\": \"<string>\",\n \"payer_address\": \"<string>\",\n \"self_managed_fees\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-squads-network"] = '<x-squads-network>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"token_address\": \"<string>\",\n \"transaction_signers\": [\n \"<string>\"\n ],\n \"spending_limit_signers\": [\n \"<string>\"\n ],\n \"destinations\": [\n \"<string>\"\n ],\n \"expiration\": 123,\n \"fee_config\": {\n \"currency\": \"<string>\",\n \"payer_address\": \"<string>\",\n \"self_managed_fees\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"spending_limit_address": "<string>",
"transaction": "<string>",
"fee": {
"amount": "<string>",
"amount_decimal": "<string>",
"currency": "<string>",
"sol_equivalent": {
"amount": "<string>",
"amount_decimal": "<string>"
}
}
}{
"status": 123,
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>",
"expected": "<string>",
"actual": "<string>"
}
],
"metadata": {
"status": 123,
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"resource_id": "<string>",
"useful_links": [
"<string>"
]
},
"custom": {},
"simulation_logs": [
"<string>"
]
}{
"status": 123,
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>",
"expected": "<string>",
"actual": "<string>"
}
],
"metadata": {
"status": 123,
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"resource_id": "<string>",
"useful_links": [
"<string>"
]
},
"custom": {},
"simulation_logs": [
"<string>"
]
}{
"status": 123,
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>",
"expected": "<string>",
"actual": "<string>"
}
],
"metadata": {
"status": 123,
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"resource_id": "<string>",
"useful_links": [
"<string>"
]
},
"custom": {},
"simulation_logs": [
"<string>"
]
}Spending Limits
Create Spending Limit
Create a new spending limit for a Smart Account
POST
/
api
/
v1
/
smart-accounts
/
{smart_account_address}
/
spending-limits
Create a new spending limit
curl --request POST \
--url https://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-squads-network: <x-squads-network>' \
--data '
{
"amount": "<string>",
"token_address": "<string>",
"transaction_signers": [
"<string>"
],
"spending_limit_signers": [
"<string>"
],
"destinations": [
"<string>"
],
"expiration": 123,
"fee_config": {
"currency": "<string>",
"payer_address": "<string>",
"self_managed_fees": false
}
}
'import requests
url = "https://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits"
payload = {
"amount": "<string>",
"token_address": "<string>",
"transaction_signers": ["<string>"],
"spending_limit_signers": ["<string>"],
"destinations": ["<string>"],
"expiration": 123,
"fee_config": {
"currency": "<string>",
"payer_address": "<string>",
"self_managed_fees": False
}
}
headers = {
"x-squads-network": "<x-squads-network>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-squads-network': '<x-squads-network>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '<string>',
token_address: '<string>',
transaction_signers: ['<string>'],
spending_limit_signers: ['<string>'],
destinations: ['<string>'],
expiration: 123,
fee_config: {currency: '<string>', payer_address: '<string>', self_managed_fees: false}
})
};
fetch('https://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits', 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://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits",
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([
'amount' => '<string>',
'token_address' => '<string>',
'transaction_signers' => [
'<string>'
],
'spending_limit_signers' => [
'<string>'
],
'destinations' => [
'<string>'
],
'expiration' => 123,
'fee_config' => [
'currency' => '<string>',
'payer_address' => '<string>',
'self_managed_fees' => false
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-squads-network: <x-squads-network>"
],
]);
$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://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"token_address\": \"<string>\",\n \"transaction_signers\": [\n \"<string>\"\n ],\n \"spending_limit_signers\": [\n \"<string>\"\n ],\n \"destinations\": [\n \"<string>\"\n ],\n \"expiration\": 123,\n \"fee_config\": {\n \"currency\": \"<string>\",\n \"payer_address\": \"<string>\",\n \"self_managed_fees\": false\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-squads-network", "<x-squads-network>")
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://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits")
.header("x-squads-network", "<x-squads-network>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"token_address\": \"<string>\",\n \"transaction_signers\": [\n \"<string>\"\n ],\n \"spending_limit_signers\": [\n \"<string>\"\n ],\n \"destinations\": [\n \"<string>\"\n ],\n \"expiration\": 123,\n \"fee_config\": {\n \"currency\": \"<string>\",\n \"payer_address\": \"<string>\",\n \"self_managed_fees\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://developer-api.squads.so/api/v1/smart-accounts/{smart_account_address}/spending-limits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-squads-network"] = '<x-squads-network>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"token_address\": \"<string>\",\n \"transaction_signers\": [\n \"<string>\"\n ],\n \"spending_limit_signers\": [\n \"<string>\"\n ],\n \"destinations\": [\n \"<string>\"\n ],\n \"expiration\": 123,\n \"fee_config\": {\n \"currency\": \"<string>\",\n \"payer_address\": \"<string>\",\n \"self_managed_fees\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"spending_limit_address": "<string>",
"transaction": "<string>",
"fee": {
"amount": "<string>",
"amount_decimal": "<string>",
"currency": "<string>",
"sol_equivalent": {
"amount": "<string>",
"amount_decimal": "<string>"
}
}
}{
"status": 123,
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>",
"expected": "<string>",
"actual": "<string>"
}
],
"metadata": {
"status": 123,
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"resource_id": "<string>",
"useful_links": [
"<string>"
]
},
"custom": {},
"simulation_logs": [
"<string>"
]
}{
"status": 123,
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>",
"expected": "<string>",
"actual": "<string>"
}
],
"metadata": {
"status": 123,
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"resource_id": "<string>",
"useful_links": [
"<string>"
]
},
"custom": {},
"simulation_logs": [
"<string>"
]
}{
"status": 123,
"code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>",
"expected": "<string>",
"actual": "<string>"
}
],
"metadata": {
"status": 123,
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"resource_id": "<string>",
"useful_links": [
"<string>"
]
},
"custom": {},
"simulation_logs": [
"<string>"
]
}Create a new spending limit that allows controlled token spending from your Smart Account.
Key Concepts
- Limit Configuration: Set maximum amount and reset period
- Token Specification: Define which token the limit applies to
- Transaction Signing: Requires approval from authorized signers
Important Notes
- Amount must be greater than zero
- Period can be DAY or WEEK
- Transaction must be signed by enough signers to meet threshold
- The same token can have multiple spending limits with different periods
- For native SOL, set
token_addressto11111111111111111111111111111111
Authorizations
UUID-based API key provided by Squads
Headers
Specifies the network for the API request
Available options:
mainnet, devnet Path Parameters
The address of the smart account
Body
application/json
Reset period for spending limits
Available options:
ONE_TIME, DAILY, WEEKLY, MONTHLY, YEARLY Show child attributes
Show child attributes
Was this page helpful?
⌘I