NAME

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

DESCRIPTION

This document describes the API endpoint at /files.

PATHS

GET /files

List files

Returns a list of files.

Operation ID

listFiles

$client->listFiles( ... );

Parameters

  • purpose (in query) (Optional) - Only return files with the given purpose.

    Type: string

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

    Type: integer

    Default: 10000

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

    Type: string

    Allowed values: asc, desc

    Default: desc

  • after (in query) (Optional) - 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.

    Type: string

Responses

Status Code: 200

OK

Content Types:

  • application/json

    Example (See the OpenAI spec for more detail):

    {
       "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

Upload file

Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 1 TB.

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.

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

Operation ID

createFile

$client->createFile( ... );

Parameters

Request Body

Content Type: multipart/form-data

Example:

{
   "expires_after" : null
}


         

Responses

Status Code: 200

OK

Content Types:

  • application/json

    Example (See the OpenAI spec for more detail):

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

SEE ALSO

OpenAPI::Client::OpenAI::Path

COPYRIGHT AND LICENSE

Copyright (C) 2023-2025 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.