Upload File - Start
An intermediate Upload object is created, allowing you to add Parts to it. Currently, an Upload size can be a maximum of 9 GB in total and will expire two hours after being created. After the Upload is completed a File object will be generated, containing all the uploaded parts. This File object can then be used across our platform just like any other file.
POST {endpoint}/openai/uploads?api-version=2024-08-01-preview
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
endpoint
|
path | True |
string url |
Supported Cognitive Services endpoints (protocol and hostname, for example: https://aoairesource.openai.azure.com. Replace "aoairesource" with your Azure OpenAI account name). |
api-version
|
query | True |
string |
The requested API version. |
Request Body
Media Types: "application/json", "text/json", "application/*+json"
Name | Required | Type | Description |
---|---|---|---|
bytes | True |
integer |
|
filename | True |
string |
|
mime_type | True |
string |
Responses
Name | Type | Description |
---|---|---|
200 OK |
The upload has been successfully created. Headers Location: string |
|
Other Status Codes |
An error occurred. |
Security
api-key
API key authentication
Type:
apiKey
In:
header
OAuth2Auth
OAuth2 authentication
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
Scopes
Name | Description |
---|---|
https://cognitiveservices.azure.com/.default |
Examples
Start a large file upload operation.
Sample request
POST https://aoairesource.openai.azure.com/openai/uploads?api-version=2024-08-01-preview
Sample response
location: https://aoairesource.openai.azure.com/openai/uploads/runs/fine-tune-72a2792ef7d24ba7b82c7fe4a37e379f
{
"bytes": 2097152,
"filename": "training_data_v21.jsonl",
"purpose": "fine-tune",
"status": "pending",
"expires_at": 1646133327,
"file": {
"bytes": 140,
"purpose": "fine-tune",
"filename": "puppy.jsonl",
"id": "file-181a1cbdcdcf4677ada87f63a0928099",
"created_at": 1646126127,
"object": "file"
},
"id": "fine-tune-72a2792ef7d24ba7b82c7fe4a37e379f",
"created_at": 1646126127,
"object": "upload"
}
Definitions
Name | Description |
---|---|
Error |
Error |
Error |
ErrorCode |
Error |
ErrorResponse |
File |
File |
Inner |
InnerError |
Inner |
InnerErrorCode |
Purpose |
Purpose |
Type |
TypeDiscriminator |
Upload |
UploadFileStartBody |
Upload |
UploadResource |
Upload |
UploadStatus |
Error
Error
Name | Type | Description |
---|---|---|
code |
ErrorCode |
|
details |
Error[] |
The error details if available. |
innererror |
InnerError |
|
message |
string |
The message of this error. |
target |
string |
The location where the error happened if available. |
ErrorCode
ErrorCode
Name | Type | Description |
---|---|---|
conflict |
string |
The requested operation conflicts with the current resource state. |
contentFilter |
string |
Image generation failed as a result of our safety system. |
fileImportFailed |
string |
Import of file failed. |
forbidden |
string |
The operation is forbidden for the current user/api key. |
internalFailure |
string |
Internal error. Please retry. |
invalidPayload |
string |
The request data is invalid for this operation. |
itemDoesAlreadyExist |
string |
The item does already exist. |
jsonlValidationFailed |
string |
Validation of jsonl data failed. |
notFound |
string |
The resource is not found. |
quotaExceeded |
string |
Quota exceeded. |
serviceUnavailable |
string |
The service is currently not available. |
tooManyRequests |
string |
Too many requests. Please retry later. |
unauthorized |
string |
The current user/api key is not authorized for the operation. |
unexpectedEntityState |
string |
The operation cannot be executed in the current resource's state. |
ErrorResponse
ErrorResponse
Name | Type | Description |
---|---|---|
error |
Error |
File
File
Name | Type | Description |
---|---|---|
bytes |
integer |
The size of this file when available (can be null). File sizes larger than 2^53-1 are not supported to ensure compatibility with JavaScript integers. |
created_at |
integer |
A timestamp when this job or item was created (in unix epochs). |
filename |
string |
The name of the file. |
id |
string |
The identity of this item. |
object |
TypeDiscriminator |
|
purpose |
Purpose |
InnerError
InnerError
Name | Type | Description |
---|---|---|
code |
InnerErrorCode |
|
innererror |
InnerError |
InnerErrorCode
InnerErrorCode
Name | Type | Description |
---|---|---|
invalidPayload |
string |
The request data is invalid for this operation. |
Purpose
Purpose
Name | Type | Description |
---|---|---|
assistants |
string |
This file contains data to be used in assistants. |
assistants_output |
string |
This file contains the results of an assistant. |
batch |
string |
This file contains the input data for a batch. |
batch_output |
string |
This file contains the results of a batch. |
fine-tune |
string |
This file contains training data for a fine tune job. |
fine-tune-results |
string |
This file contains the results of a fine tune job. |
TypeDiscriminator
TypeDiscriminator
Name | Type | Description |
---|---|---|
file |
string |
This object represents a file. |
fine_tuning.job |
string |
This object represents a fine tune job. |
fine_tuning.job.checkpoint |
string |
This object represents a checkpoint of a fine tuning job. |
fine_tuning.job.event |
string |
This object represents an event of a fine tuning job. |
list |
string |
This object represents a list of other objects. |
model |
string |
This object represents a model (can be a base model or fine tune job result). |
upload |
string |
This object represents a file upload. |
upload.part |
string |
This object represents part of a file upload. |
UploadFileStartBody
UploadFileStartBody
Name | Type | Description |
---|---|---|
bytes |
integer |
|
filename |
string |
|
mime_type |
string |
|
purpose |
Purpose |
UploadResource
UploadResource
Name | Type | Description |
---|---|---|
bytes |
integer |
|
created_at |
integer |
A timestamp when this job or item was created (in unix epochs). |
expires_at |
integer |
|
file |
File |
|
filename |
string |
|
id |
string |
The identity of this item. |
object |
TypeDiscriminator |
|
purpose |
Purpose |
|
status |
UploadStatus |
UploadStatus
UploadStatus
Name | Type | Description |
---|---|---|
cancelled |
string |
|
completed |
string |
|
expired |
string |
|
pending |
string |