Get File Text Content
curl --request GET \
--url https://api.example.com/files/{file_id}/text-content \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/files/{file_id}/text-content"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/files/{file_id}/text-content', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/files/{file_id}/text-content",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/files/{file_id}/text-content"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/files/{file_id}/text-content")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/files/{file_id}/text-content")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Files
Get Extracted Text Content
Return the decoded text of a text-like file for in-browser preview.
Streams the bytes through our API (org-scoped) so the frontend never has to fetch the presigned S3 URL cross-origin — and no third party is involved. Size-capped; binary formats are rejected with 415.
GET
/
files
/
{file_id}
/
text-content
Get File Text Content
curl --request GET \
--url https://api.example.com/files/{file_id}/text-content \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/files/{file_id}/text-content"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/files/{file_id}/text-content', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/files/{file_id}/text-content",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/files/{file_id}/text-content"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/files/{file_id}/text-content")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/files/{file_id}/text-content")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Streams a text-like file’s decoded content through the API as a preview, without requiring a separate fetch of the presigned S3 URL. Only text-ish content types are accepted:
text/*, application/json, application/xml, or anything ending in +json/+xml. The read is ranged and capped — it never pulls more than 2 MB out of S3, and the returned text is truncated to 200,000 characters — so this is a preview, not a way to fetch the full file for binary or very large formats.
There’s no stored “extracted text” field — this endpoint reads the object out of S3 live on every call. Nothing is cached back to the files row.
Auth
Requires a CRM read scope and an active organization on the token. Any ofcontacts:read, deals:read, companies:read, or activities:read qualifies, as does any *:manage scope — manage implies read.
Response
| Field | Type | Description |
|---|---|---|
text | string | Decoded UTF-8 text (invalid bytes replaced), capped at 200,000 characters. |
truncated | boolean | true if the object was cut off by either the 2 MB read cap or the 200,000-character cap. |
content_type | string | The file’s stored content_type. |
Errors
| Status | Cause |
|---|---|
404 Not Found | File doesn’t exist (or isn’t in this org, or is archived). |
409 Conflict | File is still status: "pending". |
415 Unsupported Media Type | content_type isn’t one of the text-previewable types. |
502 Bad Gateway | The S3 read failed. |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
UUID of the file whose text content to preview.
Response
Successful Response
The response is of type Response Get File Text Content Files File Id Text Content Get · object.