NAME

OpenAPI::Client::OpenAI::Path::files - Documentation for the /files path.

OPERATIONS

GET /files

listFiles

$client->list_files({
    body => { ... },
});

Returns a list of files.

Path/query parameters

  • purpose (in query, optional, string) - Only return files with the given purpose.

  • limit (in query, optional, integer) - A limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000.

    Default: 10000

  • order (in query, optional, string) - Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

    Allowed values: asc, desc

    Default: desc

  • after (in query, optional, string) - A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

Responses

200 - OK

Content-Type: application/json

Example:

{
   "data" : [
      "{\n  \"id\": \"file-abc123\",\n  \"object\": \"file\",\n  \"bytes\": 120000,\n  \"created_at\": 1677610602,\n  \"expires_at\": 1680202602,\n  \"filename\": \"salesOverview.pdf\",\n  \"purpose\": \"assistants\",\n}\n"
   ],
   "first_id" : "file-abc123",
   "has_more" : false,
   "last_id" : "file-abc456",
   "object" : "list"
}

POST /files

createFile

$client->create_file({
    body => { ... },
});

Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and each project can store up to 2.5 TB of files in total. There is no organization-wide storage limit. Uploads to this endpoint are rate-limited to 1,000 requests per minute per authenticated user.

- The Assistants API supports files up to 2 million tokens and of specific file types. See the Assistants Tools guide for details. - The Fine-tuning API only supports .jsonl files. The input also has certain required formats for fine-tuning chat or completions models. - The Batch API only supports .jsonl files up to 200 MB in size. The input also has a specific required format . - For Retrieval or file_search ingestion, upload files here first. If you need to attach multiple uploaded files to the same vector store, use /vector_stores/{vector_store_id}/file_batches instead of attaching them one by one. Vector store attachment has separate limits from file upload, including 2,000 attached files per minute per organization.

Please contact us if you need to increase these storage limits.

Responses

200 - OK

Content-Type: application/json

Example:

"{\n  \"id\": \"file-abc123\",\n  \"object\": \"file\",\n  \"bytes\": 120000,\n  \"created_at\": 1677610602,\n  \"expires_at\": 1680202602,\n  \"filename\": \"salesOverview.pdf\",\n  \"purpose\": \"assistants\",\n}\n"

SCHEMAS

CreateFileRequest

Properties:

  • expires_after (FileExpirationAfter)

    See "FileExpirationAfter" below for shape.

  • file (string, required) - The File object (not file name) to be uploaded.

  • purpose (string, required) - The intended purpose of the uploaded file. One of: - assistants : Used in the Assistants API - batch : Used in the Batch API - fine-tune : Used for fine-tuning - vision : Images used for vision fine-tuning - user_data : Flexible file type for any purpose - evals : Used for eval data sets

    Allowed values: assistants, batch, fine-tune, vision, user_data, evals

FileExpirationAfter

Properties:

  • anchor (string, required) - Anchor timestamp after which the expiration policy applies. Supported anchors: created_at .

    Allowed values: created_at

  • seconds (integer, required) - The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).

ListFilesResponse

Properties:

  • data (array of OpenAIFile, required)

  • first_id (string, required)

  • has_more (boolean, required)

  • last_id (string, required)

  • object (string, required)

OpenAIFile

Properties:

  • bytes (integer, required) - The size of the file, in bytes.

  • created_at (integer, required) - The Unix timestamp (in seconds) for when the file was created.

  • expires_at (integer) - The Unix timestamp (in seconds) for when the file will expire.

  • filename (string, required) - The name of the file.

  • id (string, required) - The file identifier, which can be referenced in the API endpoints.

  • object (string, required) - The object type, which is always file .

    Allowed values: file

  • purpose (string, required) - The intended purpose of the file. Supported values are assistants , assistants_output , batch , batch_output , fine-tune , fine-tune-results , vision , and user_data .

    Allowed values: assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, user_data

  • status (string, required) - Deprecated. The current status of the file, which can be either uploaded , processed , or error .

    Allowed values: uploaded, processed, error

  • status_details (string) - Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job .

SEE ALSO

OpenAPI::Client::OpenAI::Path

COPYRIGHT AND LICENSE

Copyright (C) 2023-2026 by Nelson Ferraz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.0 or, at your option, any later version of Perl 5 you may have available.