Replace usage budgets
curl --request PUT \
--url https://api.aisa.one/apis/v1/social/messaging/business-agent/budget \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"budgets": [
{
"max_budget": 1,
"time_window": "one_day",
"unit_type": "token"
}
]
}
'import requests
url = "https://api.aisa.one/apis/v1/social/messaging/business-agent/budget"
payload = { "budgets": [
{
"max_budget": 1,
"time_window": "one_day",
"unit_type": "token"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({budgets: [{max_budget: 1, time_window: 'one_day', unit_type: 'token'}]})
};
fetch('https://api.aisa.one/apis/v1/social/messaging/business-agent/budget', 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.aisa.one/apis/v1/social/messaging/business-agent/budget",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'budgets' => [
[
'max_budget' => 1,
'time_window' => 'one_day',
'unit_type' => 'token'
]
]
]),
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.aisa.one/apis/v1/social/messaging/business-agent/budget"
payload := strings.NewReader("{\n \"budgets\": [\n {\n \"max_budget\": 1,\n \"time_window\": \"one_day\",\n \"unit_type\": \"token\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.aisa.one/apis/v1/social/messaging/business-agent/budget")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"budgets\": [\n {\n \"max_budget\": 1,\n \"time_window\": \"one_day\",\n \"unit_type\": \"token\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/social/messaging/business-agent/budget")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"budgets\": [\n {\n \"max_budget\": 1,\n \"time_window\": \"one_day\",\n \"unit_type\": \"token\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"budgets": [
{
"max_budget": 2,
"time_window": "one_day",
"unit_type": "token",
"budget_id": "<string>"
}
]
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "<string>",
"retryable": true,
"type": "<string>"
}
}AIsa Messaging
Replace usage budgets
Business Agent. The full desired set: budgets left out are removed, an empty list returns to unlimited. Pass budget_id to edit one in place. When a cap is hit the agent finishes its turn, stops answering and hands the thread to a human until the window rolls over.
A write: needs messaging:write and is audited.
PUT
https://api.aisa.one
/
apis
/
v1
/
social
/
messaging
/
business-agent
/
budget
Replace usage budgets
curl --request PUT \
--url https://api.aisa.one/apis/v1/social/messaging/business-agent/budget \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"budgets": [
{
"max_budget": 1,
"time_window": "one_day",
"unit_type": "token"
}
]
}
'import requests
url = "https://api.aisa.one/apis/v1/social/messaging/business-agent/budget"
payload = { "budgets": [
{
"max_budget": 1,
"time_window": "one_day",
"unit_type": "token"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({budgets: [{max_budget: 1, time_window: 'one_day', unit_type: 'token'}]})
};
fetch('https://api.aisa.one/apis/v1/social/messaging/business-agent/budget', 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.aisa.one/apis/v1/social/messaging/business-agent/budget",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'budgets' => [
[
'max_budget' => 1,
'time_window' => 'one_day',
'unit_type' => 'token'
]
]
]),
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.aisa.one/apis/v1/social/messaging/business-agent/budget"
payload := strings.NewReader("{\n \"budgets\": [\n {\n \"max_budget\": 1,\n \"time_window\": \"one_day\",\n \"unit_type\": \"token\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.aisa.one/apis/v1/social/messaging/business-agent/budget")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"budgets\": [\n {\n \"max_budget\": 1,\n \"time_window\": \"one_day\",\n \"unit_type\": \"token\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/social/messaging/business-agent/budget")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"budgets\": [\n {\n \"max_budget\": 1,\n \"time_window\": \"one_day\",\n \"unit_type\": \"token\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"budgets": [
{
"max_budget": 2,
"time_window": "one_day",
"unit_type": "token",
"budget_id": "<string>"
}
]
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "<string>",
"retryable": true,
"type": "<string>"
}
}请求规范
- 方法与路径: PUT /apis/v1/social/messaging/business-agent/budget
- 可用状态: enabled
- 请求 URL 模板:
https://api.aisa.one/apis/v1/social/messaging/business-agent/budget - connectionId: query; 必填
{
"operationId": "put_aisa_messaging_apis_v1_social_messaging_busin_f3c30c",
"method": "PUT",
"path": "/apis/v1/social/messaging/business-agent/budget",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [
{
"description": "Your messaging connection (msc_...), from GET /apis/v1/social/messaging/connections. On a request with a JSON body it may be sent as a top-level body member instead.",
"in": "query",
"name": "connectionId",
"required": true,
"schema": {
"pattern": "^msc_[0-9A-Za-z]+$",
"type": "string"
}
}
],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"example": {
"budgets": [
{
"max_budget": 1,
"time_window": "one_day",
"unit_type": "token"
}
]
},
"schema": {
"additionalProperties": false,
"properties": {
"budgets": {
"items": {
"properties": {
"budget_id": {
"description": "Pass it back to edit an existing budget; omit to add one.",
"type": "string"
},
"max_budget": {
"minimum": 1,
"type": "integer"
},
"time_window": {
"description": "Rolling window in the WABA timezone.",
"enum": [
"one_day",
"seven_days",
"fourteen_days",
"thirty_days"
],
"type": "string"
},
"unit_type": {
"description": "Tokens count across the Business Manager, AI turns per conversation.",
"enum": [
"token",
"ai_turn"
],
"type": "string"
}
},
"required": [
"unit_type",
"time_window",
"max_budget"
],
"type": "object"
},
"type": "array"
},
"connectionId": {
"description": "The connection, when not sent as the connectionId query parameter.",
"pattern": "^msc_[0-9A-Za-z]+$",
"type": "string"
}
},
"required": [
"budgets"
],
"type": "object"
}
}
},
"required": true
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
费用与请求规则
此操作不另收费。授权
查询参数
请求体
application/json