=encoding utf8

=head1 NAME

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

=head1 OPERATIONS

=head2 POST /uploads

=head3 createUpload

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

Creates an intermediate
L<Upload|https://platform.openai.com/docs/api-reference/uploads/object> object
that you can add
L<Parts|https://platform.openai.com/docs/api-reference/uploads/part-object>
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
L<File|https://platform.openai.com/docs/api-reference/files/object> 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 C<purpose> values, the correct C<mime_type> must be specified.
Please refer to documentation for the
L<supported MIME types for your use case|https://platform.openai.com/docs/assistants/tools/file-search#supported-files>
.

For guidance on the proper filename extensions for each purpose, please follow
the documentation on
L<creating a File|https://platform.openai.com/docs/api-reference/files/create>
.

Returns the Upload object with status C<pending> .

=head4 Responses

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

=head1 SCHEMAS

=head2 CreateUploadRequest

Properties:

=over

=item * C<bytes> (integer, required) - The number of bytes in the file you are uploading.

=item * C<expires_after> (FileExpirationAfter)

See L</FileExpirationAfter> below for shape.

=item * C<filename> (string, required) - The name of the file to upload.

=item * C<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.

=item * C<purpose> (string, required) - The intended purpose of the uploaded file.

See the
L<documentation on File purposes|https://platform.openai.com/docs/api-reference/files/create#files-create-purpose>
.

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

=back

=head2 FileExpirationAfter

Properties:

=over

=item * C<anchor> (string, required) - Anchor timestamp after which the expiration policy applies. Supported anchors:
C<created_at> .

Allowed values: created_at

=item * C<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).

=back

=head2 Upload

Properties:

=over

=item * C<bytes> (integer, required) - The intended number of bytes to be uploaded.

=item * C<created_at> (integer, required) - The Unix timestamp (in seconds) for when the Upload was created.

=item * C<expires_at> (integer, required) - The Unix timestamp (in seconds) for when the Upload will expire.

=item * C<file> (allOf)

=item * C<filename> (string, required) - The name of the file to be uploaded.

=item * C<id> (string, required) - The Upload unique identifier, which can be referenced in API endpoints.

=item * C<object> (string) - The object type, which is always "upload".

Allowed values: upload

=item * C<purpose> (string, required) - The intended purpose of the file.
L<Please refer here|https://platform.openai.com/docs/api-reference/files/object#files/object-purpose>
for acceptable values.

=item * C<status> (string, required) - The status of the Upload.

Allowed values: pending, completed, cancelled, expired

=back

=head1 SEE ALSO

L<OpenAPI::Client::OpenAI::Path>

=head1 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.

=cut
