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。
expires_atinteger|null
檔案過期的 Unix 時間(若該檔案設有過期時間)。

若檔案 ID 未知或無法存取,將傳回 404 file_not_found。

授權

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

application/json