TokenLab

檔案與批次

列出批次

列出目前 Workspace 中的批次。

GET
/v1/batches

概覽

傳回目前 Workspace 中透過 POST /v1/batches 建立的批次,依最新建立時間排序。Message Batches 請參閱 列出訊息批次。

查詢參數

limitintegerquery預設值: 20
要傳回的批次數量,介於 1 到 100 之間。
afterstringquery
批次 ID 游標:傳回此批次之後的批次。請使用前一頁的 last_id。不可與 before 同時使用。
beforestringquery
批次 ID 游標:傳回此批次之前的批次。不可與 after 同時使用。
orderstringquery預設值: desc
依建立時間排序,為 asc 或 desc。

範例

請求

cURL
curl -X GET "https://api.tokenlab.sh/v1/batches?limit=20" \
  -H "Authorization: Bearer sk-your-api-key"

回應範例

回應

200 OK
{
  "object": "list",
  "data": [{ "id": "batch_abc123", "object": "batch", "status": "completed" }],
  "first_id": "batch_abc123",
  "last_id": "batch_abc123",
  "has_more": false
}

重要欄位

objectstring
固定為 list。
dataarray
批次。
statusstring
各批次的狀態。
has_moreboolean
當 has_more 為 true 時,表示有更多結果可用。

授權

BearerAuth
AuthorizationBearer <token>

API Key 驗證。請在 Dashboard > API > API Keys 建立或管理 API 金鑰。

位置: header

查詢參數

limit?integer

要回傳的批次數量。預設 20。

範圍1 <= value <= 100
預設值20
after?string

批次 ID 游標:回傳此 ID 之後的批次。不能與 before 結合使用。

before?string

批次 ID 游標:回傳此 ID 之前的批次。不能與 after 結合使用。

order?string

按建立時間排序。

預設值"desc"

可選值

  • "asc"
  • "desc"

回應

application/json

application/json

application/json