NAME

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

OPERATIONS

POST /uploads

createUpload

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

Creates an intermediate Upload object that you can add Parts to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it.

Once you complete the Upload, we will create a File object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object.

For certain purpose values, the correct mime_type must be specified. Please refer to documentation for the supported MIME types for your use case .

For guidance on the proper filename extensions for each purpose, please follow the documentation on creating a File .

Returns the Upload object with status pending .

Responses

200 - OK

Content-Type: application/json

Example:

"{\n  \"id\": \"upload_abc123\",\n  \"object\": \"upload\",\n  \"bytes\": 2147483648,\n  \"created_at\": 1719184911,\n  \"filename\": \"training_examples.jsonl\",\n  \"purpose\": \"fine-tune\",\n  \"status\": \"completed\",\n  \"expires_at\": 1719127296,\n  \"file\": {\n    \"id\": \"file-xyz321\",\n    \"object\": \"file\",\n    \"bytes\": 2147483648,\n    \"created_at\": 1719186911,\n    \"filename\": \"training_examples.jsonl\",\n    \"purpose\": \"fine-tune\",\n  }\n}\n"

SCHEMAS

CreateUploadRequest

Properties:

  • bytes (integer, required) - The number of bytes in the file you are uploading.

  • expires_after (FileExpirationAfter)

    See "FileExpirationAfter" below for shape.

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

  • mime_type (string, required) - The MIME type of the file.

    This must fall within the supported MIME types for your file purpose. See the supported MIME types for assistants and vision.

  • purpose (string, required) - The intended purpose of the uploaded file.

    See the documentation on File purposes .

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

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).

Upload

Properties:

  • bytes (integer, required) - The intended number of bytes to be uploaded.

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

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

  • file (allOf)

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

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

  • object (string) - The object type, which is always "upload".

    Allowed values: upload

  • purpose (string, required) - The intended purpose of the file. Please refer here for acceptable values.

  • status (string, required) - The status of the Upload.

    Allowed values: pending, completed, cancelled, expired

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.