Skip to content

Retrieve container file

FileRetrieveResponse containers().files().retrieve(FileRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
GET/containers/{container_id}/files/{file_id}

Retrieve Container File

ParametersExpand Collapse
FileRetrieveParams params
String containerId
Optional<String> fileId
ReturnsExpand Collapse
class FileRetrieveResponse:
String id

Unique identifier for the file.

long bytes

Size of the file in bytes.

String containerId

The container this file belongs to.

long createdAt

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

JsonValue; object_ "container.file"constant"container.file"constant

The type of this object (container.file).

String path

Path of the file in the container.

String source

Source of the file (e.g., user, assistant).

Retrieve container file

package com.openai.example;

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

public final class Main {
    private Main() {}

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

        FileRetrieveParams params = FileRetrieveParams.builder()
            .containerId("container_id")
            .fileId("file_id")
            .build();
        FileRetrieveResponse file = client.containers().files().retrieve(params);
    }
}
{
  "id": "id",
  "bytes": 0,
  "container_id": "container_id",
  "created_at": 0,
  "object": "container.file",
  "path": "path",
  "source": "source"
}
Returns Examples
{
  "id": "id",
  "bytes": 0,
  "container_id": "container_id",
  "created_at": 0,
  "object": "container.file",
  "path": "path",
  "source": "source"
}