Claude Platform Docs

檔案

上傳檔案
$client->beta->files->upload(string file, ?int expiresInSeconds, ?list<AnthropicBeta> betas, ?string workspaceID): BetaFileMetadata
POST/v1/files
列出檔案
$client->beta->files->list(?list<string> ids, ?int limit, ?string page, ?string scopeID, ?list<AnthropicBeta> betas, ?string workspaceID): PageCursor<BetaFileMetadata>
GET/v1/files
下載檔案
$client->beta->files->download(string fileID, ?list<AnthropicBeta> betas, ?string workspaceID): download
GET/v1/files/{file_id}/content
取得檔案中繼資料
$client->beta->files->retrieveMetadata(string fileID, ?list<AnthropicBeta> betas, ?string workspaceID): BetaFileMetadata
GET/v1/files/{file_id}
刪除檔案
$client->beta->files->delete(string fileID, ?list<AnthropicBeta> betas, ?string workspaceID): BetaDeletedFile
DELETE/v1/files/{file_id}
Models
class BetaDeletedFile { $type; $id; }
?Type type

Deleted object type.

For file deletion, this is always "file_deleted".

string id

ID of the deleted file.

class BetaFileMetadata { $type = 'file'; $id; $createdAt; /* 6 more */ }
"file" type

Object type.

For files, this is always "file".

string id

Unique object identifier.

The format and length of IDs may change over time.

\Datetime createdAt

RFC 3339 datetime string representing when the file was created.

string filename

Original filename of the uploaded file.

string mimeType

MIME type of the file.

int sizeBytes

Size of the file in bytes.

?bool downloadable

Whether the file can be downloaded.

?\Datetime expiresAt

RFC 3339 datetime string representing when the file will expire and become unavailable for download. Null if the file does not expire. For files uploaded with expires_in_seconds, this is the upload time plus that value.

?BetaFileScope scope

The scope of this file, indicating the context in which it was created (e.g., a session).

class BetaFileScope { $type = 'session'; $id; }
"session" type

The type of scope (e.g., "session").

string id

The ID of the scoping resource (e.g., the session ID).