---
title: "Text-bytes preview for small text/code files"
method: GET
path: "/api/workspaces/{slug}/files/{fileId}/preview"
tags: ["Files"]
---

# Text-bytes preview for small text/code files

`GET /api/workspaces/{slug}/files/{fileId}/preview`

## Request

- Base URL: `https://trydock.ai`
- URL: `https://trydock.ai/api/workspaces/{slug}/files/{fileId}/preview`
- Auth: HTTP bearer

Returns the raw text bytes for files ≤256 KB with a text-like MIME (text/*, application/json, yaml, xml, js, ts, sh). Used by the in-browser code preview. Returns `{ id, name, mimeType, size, text }`.

## Path parameters

- `slug` string, required
- `fileId` string, required

## Response `200`

Text payload

- object
  - `id` string, required
  - `name` string, required
  - `mimeType` string, required
  - `size` integer, required
  - `text` string, required

## Other responses

- `400`: MIME not previewable or oversize

## Changes

- **2026-11-05** `767beae124a8`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/trydock/apis/dock-rest-api/changes/api/workspaces/:slug/files/:fileId/preview/get.md)

---

[API](https://skmtc.dev/trydock/apis/dock-rest-api.md) - [All operations](https://skmtc.dev/trydock/apis/dock-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/trydock/apis/dock-rest-api/revisions/dd96ae96a412?raw)
