Skip to content

List files

client.Files.List(ctx, params) (*CursorPage[SGPFile], error)
GET/v5/files

List the account’s files with pagination.

Optionally filter by filename (case-insensitive partial match). Results are scoped to the files the caller is authorized to read. Files marked hidden (internal or service-owned artifacts) are excluded from this listing but remain retrievable by id. Returns file metadata only, not content.

ParametersExpand Collapse
params FileListParams
EndingBefore param.Field[string]Optional

Query param

Filename param.Field[string]Optional

Query param: Filter files by filename (case-insensitive partial match)

Limit param.Field[int64]Optional

Query param

maximum10000
minimum1
SortBy param.Field[string]Optional

Query param

SortOrder param.Field[SortOrder]Optional

Query param

StartingAfter param.Field[string]Optional

Query param

XProjectID param.Field[string]Optional

Header param

ReturnsExpand Collapse
type SGPFile struct{…}
ID string

The unique identifier of the entity.

CreatedAt Time

The date and time when the entity was created in ISO format.

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Filename string
Md5Checksum string
MimeType string
Size int64
DurationSeconds int64Optional
Object SGPFileObjectOptional
Tags map[string, any]Optional

List files

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"),
  )
  page, err := client.Files.List(context.TODO(), sgpdev.FileListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "has_more": true,
  "items": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": {
        "id": "id",
        "type": "user",
        "object": "identity"
      },
      "filename": "filename",
      "md5_checksum": "md5_checksum",
      "mime_type": "mime_type",
      "size": 0,
      "duration_seconds": 0,
      "object": "file",
      "tags": {
        "foo": "bar"
      }
    }
  ],
  "total": 0,
  "limit": 0,
  "object": "list"
}
Returns Examples
{
  "has_more": true,
  "items": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": {
        "id": "id",
        "type": "user",
        "object": "identity"
      },
      "filename": "filename",
      "md5_checksum": "md5_checksum",
      "mime_type": "mime_type",
      "size": 0,
      "duration_seconds": 0,
      "object": "file",
      "tags": {
        "foo": "bar"
      }
    }
  ],
  "total": 0,
  "limit": 0,
  "object": "list"
}