List files

files(projectReference: String, ref: String, branch: String, branchId: String, limit: Int, cursor: String, sortBy: FileSortBy, sortOrder: FileSortOrder): FilesConnection

Arguments

ArgumentTypeRequiredDescription
projectReferenceStringNoProject ID or slug. Omit to use the current project context.
refStringNoContent selector; omit to preserve the current content context.
branchStringNoBranch name or ID alias for ref; conflicting aliases are rejected.
branchIdStringNoLegacy branch ID alias; omit to preserve the current context.
limitIntNo
cursorStringNo
sortByFileSortByNoField to sort by. Tied update times break by path ascending. Default: "updated_at".
sortOrderFileSortOrderNoSort direction. Default: "desc".

Response

Returns FilesConnection. Open the type for its fields and nested types.

FieldTypeDescription
data[File!]!File metadata only. Restricted server-function paths are excluded before pagination.
pageInfoPageInfo!

Types marked with ! cannot be null. Lists use [Type] notation. The type index lists all published input and response types.

Example

graphql
query Files($projectReference: String, $ref: String, $branch: String, $branchId: String, $limit: Int, $cursor: String, $sortBy: FileSortBy, $sortOrder: FileSortOrder) {
  files(projectReference: $projectReference, ref: $ref, branch: $branch, branchId: $branchId, limit: $limit, cursor: $cursor, sortBy: $sortBy, sortOrder: $sortOrder) {
    data {
      id
      createdAt
      updatedAt
      checksum
      content
    }
    pageInfo {
      hasNextPage
      endCursor
      hasPreviousPage
      startCursor
    }
  }
}
json
{
  "projectReference": "00000000-0000-4000-8000-000000000001"
}