Upload File - Complete
This completes the Upload, and the returned Upload object contains a nested File object that is ready for use across the platform. You can define the order of the Parts by providing an ordered list of Part IDs. The total number of bytes uploaded must match the size originally specified when creating the Upload object. After this operation no additional Parts can be added once the Upload is completed.
POST {endpoint}/openai/uploads/{upload-id}/complete?api-version=2024-10-21URI 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). | 
| upload-id | path | True | string | The identifier of the upload. | 
| api-version | query | True | string | The requested API version. | 
Request Header
Media Types: "application/json", "text/json", "application/*+json"
| Name | Required | Type | Description | 
|---|---|---|---|
| api-key | True | string | Provide your Cognitive Services Azure OpenAI account key here. | 
Request Body
Media Types: "application/json", "text/json", "application/*+json"
| Name | Required | Type | Description | 
|---|---|---|---|
| part_ids | True | string[] | IList`1 | 
| md5 | string | 
Responses
| Name | Type | Description | 
|---|---|---|
| 200 OK | Success | |
| Other Status Codes | An error occurred. | 
Security
api-key
Provide your Cognitive Services Azure OpenAI account key here.
					Type: 
					apiKey
					In: 
					header
			
Examples
Complete and validate a large file upload operation.
Sample request
POST https://aoairesource.openai.azure.com/openai/uploads/fine-tune-72a2792ef7d24ba7b82c7fe4a37e379f/complete?api-version=2024-10-21
Sample response
{
  "bytes": 2097152,
  "filename": "training_data_v21.jsonl",
  "purpose": "fine-tune",
  "status": "completed",
  "expires_at": 1646133327,
  "file": {
    "status": "processed",
    "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 | 
| File | FileState | 
| Inner | InnerError | 
| Inner | InnerErrorCode | 
| Purpose | Purpose | 
| Type | TypeDiscriminator | 
| Upload | UploadFileCompleteBody | 
| Upload | UploadResource | 
| Upload | UploadStatus | 
Error
Error
| Name | Type | Description | 
|---|---|---|
| code | ErrorCode | |
| details | Error[] | The error details if available. | 
| innererror | InnerError | |
| message | stringminLength: 1 | The message of this error. | 
| target | string | The location where the error happened if available. | 
ErrorCode 
			
			ErrorCode
| Value | Description | 
|---|---|
| conflict | The requested operation conflicts with the current resource state. | 
| invalidPayload | The request data is invalid for this operation. | 
| forbidden | The operation is forbidden for the current user/api key. | 
| notFound | The resource is not found. | 
| unexpectedEntityState | The operation cannot be executed in the current resource's state. | 
| itemDoesAlreadyExist | The item does already exist. | 
| serviceUnavailable | The service is currently not available. | 
| internalFailure | Internal error. Please retry. | 
| quotaExceeded | Quota exceeded. | 
| jsonlValidationFailed | Validation of jsonl data failed. | 
| fileImportFailed | Import of file failed. | 
| tooManyRequests | Too many requests. Please retry later. | 
| unauthorized | The current user/api key is not authorized for the operation. | 
| contentFilter | Image generation failed as a result of our safety system. | 
ErrorResponse 
			
			ErrorResponse
| Name | Type | Description | 
|---|---|---|
| error | Error | 
File
File
| Name | Type | Description | 
|---|---|---|
| bytes | integer (int64) | 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 (unixtime) | A timestamp when this job or item was created (in unix epochs). | 
| filename | stringminLength: 1 | The name of the file. | 
| id | string | The identity of this item. | 
| object | TypeDiscriminator | |
| purpose | Purpose | |
| status | FileState | |
| status_details | string | The error message with details in case processing of this file failed. | 
FileState 
			
			FileState
| Value | Description | 
|---|---|
| uploaded | The file has been uploaded but it's not yet processed. This state is not returned by Azure OpenAI and exposed only for compatibility. It can be categorized as an inactive state. | 
| pending | The operation was created and is not queued to be processed in the future. It can be categorized as an inactive state. | 
| running | The operation has started to be processed. It can be categorized as an active state. | 
| processed | The operation has successfully be processed and is ready for consumption. It can be categorized as a terminal state. | 
| error | The operation has completed processing with a failure and cannot be further consumed. It can be categorized as a terminal state. | 
| deleting | The entity is ni the process to be deleted. This state is not returned by Azure OpenAI and exposed only for compatibility. It can be categorized as an active state. | 
| deleted | The entity has been deleted but may still be referenced by other entities predating the deletion. It can be categorized as a terminal state. | 
InnerError 
			
			InnerError
| Name | Type | Description | 
|---|---|---|
| code | InnerErrorCode | |
| innererror | InnerError | 
InnerErrorCode  
			
			InnerErrorCode
| Value | Description | 
|---|---|
| invalidPayload | The request data is invalid for this operation. | 
Purpose
Purpose
| Value | Description | 
|---|---|
| fine-tune | This file contains training data for a fine tune job. | 
| fine-tune-results | This file contains the results of a fine tune job. | 
| assistants | This file contains data to be used in assistants. | 
| assistants_output | This file contains the results of an assistant. | 
| batch | This file contains the input data for a batch. | 
| batch_output | This file contains the results of a batch. | 
TypeDiscriminator 
			
			TypeDiscriminator
| Value | Description | 
|---|---|
| list | This object represents a list of other objects. | 
| fine_tuning.job | This object represents a fine tune job. | 
| file | This object represents a file. | 
| fine_tuning.job.event | This object represents an event of a fine tuning job. | 
| fine_tuning.job.checkpoint | This object represents a checkpoint of a fine tuning job. | 
| model | This object represents a model (can be a base model or fine tune job result). | 
| batch | This object represents a batch. | 
| upload | This object represents a file upload. | 
| upload.part | This object represents part of a file upload. | 
UploadFileCompleteBody   
			
			UploadFileCompleteBody
| Name | Type | Description | 
|---|---|---|
| md5 | string | |
| part_ids | string[] | IList`1 | 
UploadResource 
			
			UploadResource
| Name | Type | Description | 
|---|---|---|
| bytes | integer (int64) | |
| created_at | integer (unixtime) | A timestamp when this job or item was created (in unix epochs). | 
| expires_at | integer (unixtime) | |
| file | File | |
| filename | string | |
| id | string | The identity of this item. | 
| object | TypeDiscriminator | |
| purpose | Purpose | |
| status | UploadStatus | 
UploadStatus 
			
			UploadStatus
| Value | Description | 
|---|---|
| pending | |
| expired | |
| completed | |
| cancelled |