> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.labric.co/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.labric.co/_mcp/server.

# Get File Content

GET https://platform.labric.co/api/v1/tools/files/{file_id}/content

Fetch a source file's content for inspecting raw instrument output.

Returns a presigned download URL plus a best-effort UTF-8 text preview of
the start of the file. Large files return a URL only (no inline preview);
fetch the full bytes via the URL when needed.

Reference: https://docs.labric.co/api-reference/labric-api/tools/get-file-content

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: openapi-tools
  version: 1.0.0
paths:
  /api/v1/tools/files/{file_id}/content:
    get:
      operationId: get_file_content
      summary: Get File Content
      description: >-
        Fetch a source file's content for inspecting raw instrument output.


        Returns a presigned download URL plus a best-effort UTF-8 text preview
        of

        the start of the file. Large files return a URL only (no inline
        preview);

        fetch the full bytes via the URL when needed.
      tags:
        - tools
      parameters:
        - name: file_id
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolsFileContentSchema'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '422':
          description: Unprocessable Content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorSchema'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
servers:
  - url: https://platform.labric.co
    description: https://platform.labric.co
components:
  schemas:
    ToolsFileContentSchema:
      type: object
      properties:
        file_id:
          type: string
        file_name:
          type:
            - string
            - 'null'
        size_kilobytes:
          type:
            - integer
            - 'null'
        download_url:
          type: string
          description: Presigned URL to fetch the full file (e.g. via the SDK).
        text_preview:
          type:
            - string
            - 'null'
          description: >-
            Best-effort UTF-8 decode of the start of the file, or null if
            skipped.
        preview_truncated:
          type: boolean
          description: True if the file is longer than the inlined preview.
        preview_skipped_reason:
          type:
            - string
            - 'null'
          description: Why an inline preview was not returned (e.g. file too large).
      required:
        - file_id
        - file_name
        - size_kilobytes
        - download_url
        - text_preview
        - preview_truncated
        - preview_skipped_reason
      description: The content of a source data file, for inspecting raw instrument output.
      title: ToolsFileContentSchema
    ErrorSchema:
      type: object
      properties:
        detail:
          type: string
      required:
        - detail
      title: ErrorSchema
    ValidationErrorSchema:
      type: object
      properties:
        detail:
          type: array
          items:
            type: object
            additionalProperties:
              description: Any type
      required:
        - detail
      description: Shape of Ninja's built-in 422 request-validation error response.
      title: ValidationErrorSchema
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer

```

## Examples



**Request**

```json
{}
```

**Response**

```json
{
  "file_id": "a1b2c3d4-e5f6-7890-ab12-cd34ef567890",
  "file_name": "experiment_2024-06-15_output.csv",
  "size_kilobytes": 512,
  "download_url": "https://platform.labric.co/downloads/a1b2c3d4-e5f6-7890-ab12-cd34ef567890?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
  "text_preview": "Time,Temperature,Pressure\n0,22.5,101.3\n1,22.7,101.2\n2,22.6,101.3\n3,22.8,101.4\n4,22.9,101.3\n",
  "preview_truncated": true,
  "preview_skipped_reason": null
}
```

**SDK Code**

```python
import requests

url = "https://platform.labric.co/api/v1/tools/files/file_id/content"

payload = {}
headers = {
    "Authorization": "Bearer <api_key>",
    "Content-Type": "application/json"
}

response = requests.get(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://platform.labric.co/api/v1/tools/files/file_id/content';
const options = {
  method: 'GET',
  headers: {Authorization: 'Bearer <api_key>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://platform.labric.co/api/v1/tools/files/file_id/content"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("GET", url, payload)

	req.Header.Add("Authorization", "Bearer <api_key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://platform.labric.co/api/v1/tools/files/file_id/content")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <api_key>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://platform.labric.co/api/v1/tools/files/file_id/content")
  .header("Authorization", "Bearer <api_key>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://platform.labric.co/api/v1/tools/files/file_id/content', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://platform.labric.co/api/v1/tools/files/file_id/content");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <api_key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <api_key>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://platform.labric.co/api/v1/tools/files/file_id/content")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```