Skip to content

List container files

client.Containers.Files.List(ctx, containerID, query) (*CursorPage[ContainerFileListResponse], error)
GET/containers/{container_id}/files

List Container files

ParametersExpand Collapse
containerID string
query ContainerFileListParams
After param.Field[string]optional

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

Limit param.Field[int64]optional

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

Order param.Field[ContainerFileListParamsOrder]optional

Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

const ContainerFileListParamsOrderAsc ContainerFileListParamsOrder = "asc"
const ContainerFileListParamsOrderDesc ContainerFileListParamsOrder = "desc"
ReturnsExpand Collapse
type ContainerFileListResponse 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).

List container files

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"),
  )
  page, err := client.Containers.Files.List(
    context.TODO(),
    "container_id",
    openai.ContainerFileListParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "data": [
    {
      "id": "id",
      "bytes": 0,
      "container_id": "container_id",
      "created_at": 0,
      "object": "container.file",
      "path": "path",
      "source": "source"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
Returns Examples
{
  "data": [
    {
      "id": "id",
      "bytes": 0,
      "container_id": "container_id",
      "created_at": 0,
      "object": "container.file",
      "path": "path",
      "source": "source"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}