Get file

file(input: FileInput!): File!

Requires project.files.read.

Arguments

ArgumentTypeRequired
inputFileInput!Yes

Input fields

input

FileInput

FieldTypeRequiredDescription
projectReferenceStringNoProject UUID, slug or configured domain. Omit it to use the project of the request.
filePathString!YesProject-relative source path, or the file ID.
refStringNoContent to read: main, branch:<name-or-id>, release:<version> or env:<name>. Omit for main.

Response

Returns File!. Open the type for its fields and nested types.

FieldTypeDescription
binaryBinaryCompanionDescriptor
idID!
versionIdString
pathString!
typeString!
sizeIntSize of the content in bytes; the same value as sizeBytes.
sizeBytesIntSize of the content encoded as UTF-8, in bytes.
contentStringFull text content. Listings read it only when a query selects it.

All fields of File.

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

Example

graphql
query File($input: FileInput!) {
  file(input: $input) {
    id
    createdAt
    updatedAt
    checksum
    content
  }
}
json
{
  "input": {
    "projectReference": "00000000-0000-4000-8000-000000000001",
    "filePath": "example"
  }
}