Loading...
    • Developer Guide
    • API Reference
    • MCP
    • Resources
    • Release Notes
    Search...
    ⌘K
    Using the API
    API overviewBeta headersErrors
    Messages
    Create a Message
    Count tokens in a Message
    Models
    List Models
    Get a Model
    Beta
    Upload File
    List Files
    Download File
    Get File Metadata
    Delete File
    Admin
    Completions
    Create a Text Completion
    Support & configuration
    Rate limitsService tiersVersionsIP addressesSupported regionsOpenAI SDK compatibility
    Console
    Log in

    Files

    Upload File
    client.Beta.Files.Upload(ctx, params) (*FileMetadata, error)
    POST/v1/files
    List Files
    client.Beta.Files.List(ctx, params) (*Page[FileMetadata], error)
    GET/v1/files
    Download File
    client.Beta.Files.Download(ctx, fileID, query) (*Response, error)
    GET/v1/files/{file_id}/content
    Get File Metadata
    client.Beta.Files.GetMetadata(ctx, fileID, query) (*FileMetadata, error)
    GET/v1/files/{file_id}
    Delete File
    client.Beta.Files.Delete(ctx, fileID, body) (*DeletedFile, error)
    DELETE/v1/files/{file_id}
    ModelsExpand Collapse
    type DeletedFile struct{…}
    ID string

    ID of the deleted file.

    Type DeletedFileTypeoptional

    Deleted object type.

    For file deletion, this is always "file_deleted".

    type FileMetadata struct{…}
    ID string

    Unique object identifier.

    The format and length of IDs may change over time.

    CreatedAt Time

    RFC 3339 datetime string representing when the file was created.

    Filename string

    Original filename of the uploaded file.

    MimeType string

    MIME type of the file.

    SizeBytes int64

    Size of the file in bytes.

    Type File

    Object type.

    For files, this is always "file".

    Downloadable booloptional

    Whether the file can be downloaded.

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Partners

    • Amazon Bedrock
    • Google Cloud's Vertex AI

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Help and security

    • Availability
    • Status
    • Support
    • Discord

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy