Skip to content

Export evaluation items to a file

client.EvaluationItems.Export(ctx, body) (*EvaluationItemExport, error)
POST/v5/evaluation-items/export

Export all evaluation items for a single evaluation as a downloadable file.

The evaluation is specified by evaluation_id in the request body. export_format selects CSV, JSON, or JSONL; for CSV the per-item data and files fields are flattened into individual columns and metric-like result columns are expanded. export_method controls delivery: direct returns the file contents inline in the response, while signed_url uploads the file to object storage and returns a pre-signed download URL. Requesting signed_url in an environment where object storage is not configured fails with a 501, so use direct there instead. Set include_archived=true to include archived items in the export. This endpoint reads items only and does not modify the evaluation.

ParametersExpand Collapse
body EvaluationItemExportParams
EvaluationID param.Field[string]

The ID of the evaluation to export items from.

ExportFormat param.Field[ExportFormat]Optional

The format of the exported evaluation items. json returns a single JSON array, while jsonl returns one JSON object per line.

ExportMethod param.Field[ExportMethod]Optional

The method for exporting evaluation items. signed_url returns a pre-signed URL, while direct returns the raw content.

IncludeArchived param.Field[bool]Optional

If true, include archived evaluation items in the export.

ReturnsExpand Collapse
type EvaluationItemExport struct{…}

Response model for exporting evaluation items. This class represents the response when users export evaluation items. It contains either a signed URL to download the exported data from object storage, or the actual content bytes when direct download is used (in environments where object storage is not configured).

Filename string

The name of the exported file

Content stringOptional

The raw file content as bytes, used when direct download is enabled

SignedURL stringOptional

Pre-signed URL to download the file from object storage, if applicable

Export evaluation items to a file

package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  evaluationItemExport, err := client.EvaluationItems.Export(context.TODO(), sgpdev.EvaluationItemExportParams{
    EvaluationID: "evaluation_id",
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", evaluationItemExport.Filename)
}
{
  "filename": "filename",
  "content": "content",
  "signed_url": "signed_url"
}
Returns Examples
{
  "filename": "filename",
  "content": "content",
  "signed_url": "signed_url"
}