TokenLab

檔案與批次

檢索檔案

檢索單一已上傳檔案的中繼資料。

GET
/v1/files/{file_id}

回傳檔案的名稱、大小、用途及建立時間。若不包含 Anthropic 標頭,此功能涵蓋批次處理 (batch) 與影像參考檔案。若包含 Anthropic Files 標頭,則涵蓋 Anthropic 格式的檔案。

範例

請求

cURL
curl -X GET "https://api.tokenlab.sh/v1/files/file_abc123" \
  -H "Authorization: Bearer sk-your-api-key"

影像參考檔案

此端點亦可回傳由 TokenLab 建立的影像參考檔案之中繼資料。status 欄位為選填,對於未提供該欄位的檔案系列,此欄位可能會省略。

回應範例

回應

200 OK
{
  "id": "file_abc123",
  "object": "file",
  "bytes": 32768,
  "created_at": 1706000000,
  "filename": "batch-input.jsonl",
  "purpose": "batch"
}

重要欄位

idstring
檔案 ID。
filenamestring
原始或生成的檔案名稱。
purposestring
檔案用途,例如 batch、batch_output、user_data 或 vision。

授權

BearerAuth
AuthorizationBearer <token>

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

位置: header

路徑參數

file_id*string

請求標頭

anthropic-beta?string

包含 files-api-2025-04-14 以使用 Anthropic Files API 模式。

回應

application/json

application/json