读取设置与每日额度
返回账号偏好、当前 UTC 日的已用和剩余额度,以及邮件传输状态。
GET
/api/settings请求参数
此操作无需提交参数。
请求示例
JavaScript 示例可在本站已登录的浏览器中运行。cURL 和 Python 示例读取你本机的 cookies.txt Cookie 文件。请将会话 Cookie 视为私密凭据。
cURL
curl -i -X GET 'https://social2api.com/api/settings' \
--cookie ./cookies.txtPython
from urllib.error import HTTPError
from urllib.request import Request, HTTPCookieProcessor, build_opener
from http.cookiejar import MozillaCookieJar
request = Request(
"https://social2api.com/api/settings",
method="GET",
)
cookies = MozillaCookieJar("./cookies.txt")
cookies.load(ignore_discard=True)
send = build_opener(HTTPCookieProcessor(cookies)).open
try:
with send(request) as response:
print(response.status, response.read().decode("utf-8"))
except HTTPError as error:
print(error.code, error.read().decode("utf-8"))JavaScript
const response = await fetch("/api/settings", {
method: "GET",
credentials: "same-origin",
});
console.log(response.status, await response.text());响应
200 · 示例响应
{
"preferences": {
"locale": "zh",
"dailyLimit": 100000,
"lowBalance": false,
"lowBalanceThreshold": 1000,
"runFailed": false
},
"usage": {
"day": "2026-01-15",
"used": 0,
"remaining": 100000
},
"mailEnabled": false
}错误示例
{
"error": "请先登录。"
}| 字段 | 类型 | 说明 |
|---|---|---|
preferences.locale | zh | en | 设置与提醒使用的语言偏好。 |
preferences.dailyLimit | integer | null | 账号每日上游调用上限。 |
preferences.lowBalance | boolean | 是否为低额度发送邮件。 |
preferences.lowBalanceThreshold | integer | 低额度提醒阈值,单位为调用次数。 |
preferences.runFailed | boolean | 是否为失败或部分完成的任务发送邮件。 |
preferences | object | 还可包含账号保存的其它偏好。 |
usage.day | YYYY-MM-DD | 当前 UTC 日期。 |
usage.used | integer | 当日已尝试的上游调用数。 |
usage.remaining | integer | null | 当日剩余调用次数。不限额时为 null。 |
mailEnabled | boolean | 部署是否配置邮件传输。邮件提醒还需验证邮箱。 |
错误状态
| HTTP | 原因与处理 |
|---|---|
401 | 控制台会话缺失、过期或无效。 |
405 | 请求方法不受支持。 |
503 | 此部署未配置该控制台服务。 |