开发者
SpeakNotes API 身份验证
API 接受三种凭据:API 密钥、OAuth 访问令牌或来自已登录会话的 Firebase ID 令牌。
API 密钥
在每个请求中将密钥作为 Bearer 令牌发送。任何已登录的账户都可以创建一个密钥,且可立即使用。
curl https://api.speaknotes.io/v1/notes \ -H "Authorization: Bearer sn_live_YOUR_API_KEY"
正式密钥以 sn_live_ 开头,作用于您的真实库。沙盒密钥以 sn_test_ 开头,针对固定输出运行。在作用域功能出现之前颁发的密钥仍然有效,并拥有完全访问权限。
作用域
每个密钥和每个 OAuth 令牌都带有作用域。读取权限并不隐含写入权限,因此作用域为 notes:read 的密钥无法删除任何内容。缺少作用域的请求会收到 403 错误,并指出缺少的内容。
notes:readRead notes, transcripts, and summaries.notes:writeCreate, update, and delete notes.folders:readRead folders.folders:writeCreate, update, and delete folders.transcriptions:writeTranscribe audio and video.summaries:writeGenerate summaries from audio, text, and YouTube URLs.usage:readRead credit balance and usage history.
速率限制
限制是按凭据而非按 IP 计算的,因此一个集成不会影响另一个。每个响应都包含 X-RateLimit-Limit、X-RateLimit-Remaining 和 X-RateLimit-Reset,429 错误中包含 Retry-After。
120
读取 每分钟
30
写入 每分钟
10
处理 每分钟
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="SpeakNotes API", error="invalid_token",
resource_metadata="https://api.speaknotes.io/.well-known/oauth-protected-resource"
{
"error": {
"type": "authentication_error",
"code": "invalid_token",
"message": "The API key is invalid, expired, or revoked.",
"doc_url": "https://speaknotes.io/developers/errors#invalid_token"
}
}OAuth
正在构建其他 SpeakNotes 用户登录的应用?请使用 OAuth,而不是要求他们粘贴密钥。 /developers/oauth
轮换与撤销
密钥仅在创建时显示一次,并以哈希形式存储。撤销密钥会立即生效。您在创建密钥时还可以为其设置过期日期。