Share via


Files - Get Content

Gets the content of the file specified by the given file-id. Files can be user uploaded content or generated by the service like result metrics of a fine-tune job.

GET {endpoint}/openai/files/{file-id}/content?api-version=2024-10-21

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

file-id
path True

string

The identifier of the file.

api-version
query True

string

The requested API version.

Request Header

Name Required Type Description
api-key True

string

Provide your Cognitive Services Azure OpenAI account key here.

Responses

Name Type Description
200 OK

file

Success

Media Types: "application/octet-stream", "application/json"

Other Status Codes

ErrorResponse

An error occurred.

Media Types: "application/octet-stream", "application/json"

Security

api-key

Provide your Cognitive Services Azure OpenAI account key here.

Type: apiKey
In: header

Examples

Getting the file content.

Sample request

GET https://aoairesource.openai.azure.com/openai/files/file-181a1cbdcdcf4677ada87f63a0928099/content?api-version=2024-10-21

Sample response

"raw file content"

Definitions

Name Description
Error

Error

ErrorCode

ErrorCode

ErrorResponse

ErrorResponse

InnerError

InnerError

InnerErrorCode

InnerErrorCode

Error

Error

Name Type Description
code

ErrorCode

ErrorCode
Error codes as defined in the Microsoft REST guidelines (https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses).

details

Error[]

The error details if available.

innererror

InnerError

InnerError
Inner error as defined in the Microsoft REST guidelines (https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses).

message

string

minLength: 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

Error
Error content as defined in the Microsoft REST guidelines (https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses).

InnerError

InnerError

Name Type Description
code

InnerErrorCode

InnerErrorCode
Inner error codes as defined in the Microsoft REST guidelines (https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses).

innererror

InnerError

InnerError
Inner error as defined in the Microsoft REST guidelines (https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses).

InnerErrorCode

InnerErrorCode

Value Description
invalidPayload

The request data is invalid for this operation.