Пропустить и перейти к основному содержимому

Этот браузер больше не поддерживается.

Выполните обновление до Microsoft Edge, чтобы воспользоваться новейшими функциями, обновлениями для системы безопасности и технической поддержкой.

Скачать Microsoft Edge Дополнительные сведения об Internet Explorer и Microsoft Edge
microsoft-foundry.rest.security.o-auth2-auth

Files

Get a file

GET /openai/v1/files/{file_id}

Retrieves a file by its identifier.

Параметры пути

file_id string обязательно

The ID of the file to use for this request.

Ответы

The request has succeeded.

Текст

Content-Type: application/json
id string обязательно

The file identifier, which can be referenced in the API endpoints.

bytes integer | null обязательно

The size of the file, in bytes. In a completed file upload response, this can be null when the file size is not yet available.

created_at integer обязательно

The Unix timestamp (in seconds) for when the file was created.

expires_at integer

The Unix timestamp (in seconds) for when the file will expire. In a completed file upload response, this can be null when no expiry is set.

filename string обязательно

The name of the file.

object enum обязательно

The object type, which is always file.

file
purpose enum обязательно

The intended purpose of the file. Supported values are assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, and user_data.

assistantsassistants_outputbatchbatch_outputfine-tunefine-tune-resultsvisionuser_data
status enum обязательно

Deprecated. The current status of the file, which can be either uploaded, processed, or error.

uploadedprocessederror
status_details string

Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job. Completed file upload responses can return null when these details are unset.

Client error

Текст

Content-Type: application/json
error OpenAI.Error обязательно
code string | null обязательно
message string обязательно
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Любое из следующих:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string обязательно

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

Текст

Content-Type: application/json
error OpenAI.Error обязательно
code string | null обязательно
message string обязательно
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Любое из следующих:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string обязательно

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Запрос

curl https://api.openai.com/v1/files/file-abc123 \
  -H "Authorization: Bearer $OPENAI_API_KEY"
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
file_object = client.files.retrieve(
    "file_id",
)
print(file_object.id)
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const file = await openai.files.retrieve("file-abc123");

  console.log(file);
}

main();
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const fileObject = await client.files.retrieve('file_id');

console.log(fileObject.id);
package main

import (
    "context"
    "fmt"

    "github.com/openai/openai-go"
    "github.com/openai/openai-go/option"
)

func main() {
    client := openai.NewClient(
        option.WithAPIKey("My API Key"),
    )
    fileObject, err := client.Files.Get(context.TODO(), "file_id")
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", fileObject.ID)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.files.FileObject;
import com.openai.models.files.FileRetrieveParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        FileObject fileObject = client.files().retrieve("file_id");
    }
}
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

file_object = openai.files.retrieve("file_id")

puts(file_object)

Response

{
  "id": "file-abc123",
  "object": "file",
  "bytes": 120000,
  "created_at": 1677610602,
  "expires_at": 1677614202,
  "filename": "mydata.jsonl",
  "purpose": "fine-tune",
}
ru-ru
Ваши варианты выбора параметров конфиденциальности
  • Заявление об отказе ИИ
  • Предыдущие версии
  • Блог
  • Участие в доработке
  • Конфиденциальность
  • Конфиденциальность медицинских данных потребителей
  • Условия использования
  • Товарные знаки
  • © Microsoft 2026