Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Retrieve file content

client.Files.Content(ctx, fileID) (*Response, error)
GET
/files/{file_id}/content

Returns a response containing the contents of the specified file.

Parameters
fileID string
Returns
type FileContentResponse interface{…}

Retrieve file content

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"),
  )
  response, err := client.Files.Content(context.TODO(), "file_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response)
}
Returns Examples