获取附件
curl --request GET \
--url https://api.aisa.one/apis/v1/agentmail/threads/{thread_id}/attachments/{attachment_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aisa.one/apis/v1/agentmail/threads/{thread_id}/attachments/{attachment_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aisa.one/apis/v1/agentmail/threads/{thread_id}/attachments/{attachment_id}', 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/agentmail/threads/{thread_id}/attachments/{attachment_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/agentmail/threads/{thread_id}/attachments/{attachment_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.aisa.one/apis/v1/agentmail/threads/{thread_id}/attachments/{attachment_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/agentmail/threads/{thread_id}/attachments/{attachment_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"attachment_id": "<string>",
"size": 123,
"download_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"filename": "<string>",
"content_type": "<string>",
"content_disposition": "inline",
"content_id": "<string>",
"text_url": "<string>"
}会话线程
获取附件
获取只按 id 定位的会话中某个附件的元数据。
GET
https://api.aisa.one
/
apis
/
v1
/
agentmail
/
threads
/
{thread_id}
/
attachments
/
{attachment_id}
获取附件
curl --request GET \
--url https://api.aisa.one/apis/v1/agentmail/threads/{thread_id}/attachments/{attachment_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aisa.one/apis/v1/agentmail/threads/{thread_id}/attachments/{attachment_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aisa.one/apis/v1/agentmail/threads/{thread_id}/attachments/{attachment_id}', 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/agentmail/threads/{thread_id}/attachments/{attachment_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/agentmail/threads/{thread_id}/attachments/{attachment_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.aisa.one/apis/v1/agentmail/threads/{thread_id}/attachments/{attachment_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/agentmail/threads/{thread_id}/attachments/{attachment_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"attachment_id": "<string>",
"size": 123,
"download_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"filename": "<string>",
"content_type": "<string>",
"content_disposition": "inline",
"content_id": "<string>",
"text_url": "<string>"
}获取只按 id 定位的会话中某个附件的元数据。返回
在你的 agent 里把这个端点跑起来 →
attachment_id、filename、size、content_type、content_disposition、content_id,以及一个短时效的 download_url 和 expires_at。字节内容不内联,需在过期前去取 download_url。这是账号级视图,跨越账号下的每一个收件箱。所有 AIsa 调用方共用同一个 AgentMail 账号,因此这里会触及其他调用方创建的收件箱;只针对单个收件箱时请用收件箱级的孪生工具 get_agentmail_inbox_thread_attachment。
示例
curl -X GET "https://api.aisa.one/apis/v1/agentmail/threads/{thread_id}/attachments/{attachment_id}" \
-H "Authorization: Bearer YOUR_API_KEY"
// 把整段复制给 Claude Code、Codex、Cursor 或任意 coding agent。
// 连接、授权、跑通这个例子需要的东西都在里面 ——
// 不用粘贴任何 key,浏览器里点一次 Allow 就好。
{
"operation_id": "get_agentmail_thread_attachment",
"arguments": {},
"max_price_usd": 0.05
}
// ── for the agent ─────────────────────────────────────────────────────────
// Register the AIsa MCP server, then call its `use` tool with the JSON above.
// name aisa
// endpoint https://mcp.aisa.one/mcp
// transport streamable-http
// auth OAuth. The server publishes RFC 9728 metadata, so open a
// browser and the user clicks Allow once — nothing to paste.
// If AISA_API_KEY is set, send it as a bearer header instead.
// Use your own MCP mechanism, not a hand-edited config file:
// Codex codex mcp add aisa --url https://mcp.aisa.one/mcp
// Claude Code claude mcp add --transport http -s user aisa https://mcp.aisa.one/mcp
// Cursor / VS Code a "url" entry for https://mcp.aisa.one/mcp in the MCP config
// The server lists five tools over https://mcp.aisa.one/servers worth of APIs:
// search, get_details, use, batch_use, list_categories. search and
// get_details are free; use is billed per call and max_price_usd refuses
// anything above the cap before spending. This operation's full contract —
// every argument, the response shape, the price and the pitfalls — is at
// https://aisa.one/docs/zh/api-reference/agentmail/get_agentmail-threads-thread-id-attachments-attachment-id.md
// Then run the call and show me the result.
第一次用? 把任意 MCP 客户端指向
https://mcp.aisa.one/mcp —— Claude Code、
Codex、Cursor、VS Code 都可以。鉴权走 OAuth:客户端打开浏览器,你点一次
Allow,不需要粘贴任何 key。各客户端的具体命令和每次调用的价格见
aisa.one/zh-cn/mcp。授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
响应
状态码为 200 的响应
附件 ID。
附件大小(字节)。
Signed HTTPS CDN URL to download the attachment bytes. Retrieve a fresh URL when needed rather than storing it permanently.
Time at which download_url and text_url (when present) expire. Retrieve the attachment again to obtain fresh URLs.
附件文件名。
附件的内容类型。
附件的内容处置方式。
可用选项:
inline, attachment 附件的内容 ID。
Signed HTTPS CDN URL to download extracted plain text, when available. Omitted when no extracted text is available. Expires at the same time as download_url.