/v1/files/readFile/:filepathOrId
post
Path Parameters
FileMatcherPathParameters

Path parameters for identifying a file by either filepath or file ID

FieldTypeRequiredDescription
filepathOrIdstringNo

File path with workspace rootname (case insensitive) or file ID for flexible file identification

Example: /workspace-rootname/folder/file.ext

Request Headers
HttpEndpointRequestHeaders_AuthOptional_JsonContentType

FieldTypeRequiredDescription
AuthorizationstringNo

Access token

Example: Bearer <token>

Content-TypestringYes

HTTP JSON request content type

Example: application/json

Request Query
ReadFileEndpointHttpQuery

Query parameters for the read file HTTP endpoint

FieldTypeRequiredDescription
wnumberNo

Resize to width if file is an image

Number subset: floating point or integer

Example: 600

hnumberNo

Resize to height if file is an image

Number subset: floating point or integer

Example: 400

posstring or numberNo

Position or gravity to use when fit is cover or contain

Gravity or strategy to use when fit is cover or contain

Enum: topright toprightright bottombottomleft bottomleftleft topnorthnortheasteastsoutheastsouthsouthwestwestnorthwestcentreentropyattention

Example: center

Position to use when fit is cover or contain

Number subset: floating point or integer

Example: 5

fitstringNo

How the image should be resized to fit provided dimensions

Enum: containcoverfillinsideoutside

Example: cover

bgstringNo

Hex background color to use when fit is contain

Example: #FFFFFF

withoutEnlargementbooleanNo

Do not enlarge if the width or height are already less than provided dimensions

Example:

formatstringNo

Format to transform image to if file is an image

Enum: jpegpngwebptiffraw

Example: webp

downloadbooleanNo

Whether the server should add "Content-Disposition: attachment" header which forces browsers to download files like HTML, JPEG, etc. which it'll otherwise open in the browser

Request Body
ReadFileEndpointParams

Parameters for reading/downloading a file with optional image processing

{
filepath?: string
fileId?: string
imageResize?: ImageResizeParams
imageFormat?: string
download?: boolean
}
ImageResizeParams

Parameters for resizing images on-the-fly during file retrieval

{
width?: number
height?: number
fit?: string
position?: string | number
background?: string
withoutEnlargement?: boolean
}
200 Response Headers
ReadFileEndpointHTTPHeaders

HTTP response headers for file read operations

FieldTypeRequiredDescription
Content-TypestringYes

Get file endpoint result content type. If request is successful, it will be the file's content type if it is known or application/octet-stream otherwise, and application/json containing errors if request fails

Example: image/jpeg

Content-LengthstringYes

HTTP response content length in bytes

Example: 1024

Content-DispositionstringNo

HTTP response content disposition

Example: attachment; filename="file.txt"

200 Response Body
binary
4XX or 5XX Response Headers
HttpEndpointResponseHeaders_ContentType_ContentLength

FieldTypeRequiredDescription
Content-TypestringYes

HTTP JSON response content type

Example: application/json

Content-LengthstringYes

HTTP response content length in bytes

4XX or 5XX Response Body
EndpointErrorResult

Endpoint error result

{
errors?: Array<ExternalError>
}
ExternalError

{
message: string
}