Skip to content

Retrieve container file

client.Containers.Files.Get(ctx, containerID, fileID) (*ContainerFileGetResponse, error)
GET/containers/{container_id}/files/{file_id}

Retrieve Container File

ParametersExpand Collapse
containerID string
fileID string
ReturnsExpand Collapse
type ContainerFileGetResponse struct{…}
ID string

Unique identifier for the file.

Bytes int64

Size of the file in bytes.

ContainerID string

The container this file belongs to.

CreatedAt int64

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

Object ContainerFile

The type of this object (container.file).

Path string

Path of the file in the container.

Source string

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

Retrieve container file

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"),
  )
  file, err := client.Containers.Files.Get(
    context.TODO(),
    "container_id",
    "file_id",
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", file.ID)
}
{
  "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"
}