Skip to content

Read the text of a file attached to a deal

GET
/deals/{id}/attachments/{attachmentId}/content
Code sample: Shell / cURL
curl --request GET \
--url 'https://example.com/api/v1/deals/example/attachments/example/content?offset=0&limit=262144' \
--header 'Authorization: Bearer <token>'

Returns one page of the text of a PDF or Word file on the deal, such as its SOW, so it can be read without downloading it. offset and limit count characters; follow nextOffset until truncated is false. A file with no text layer (a scan), a damaged or locked file, a file over 10 MB, a PDF over 100 pages or a file missing from storage answers 200 with readable: false and the unreadableReason. An unknown deal or file, or a deal outside the member’s scope, is a 404. Requires deals.view. Client members never read deal files.

id
required

Deal identifier (CUID2).

string
>= 1 characters

Deal identifier (CUID2).

attachmentId
required

Deal attachment identifier (CUID2).

string
>= 1 characters

Deal attachment identifier (CUID2).

offset

Character offset to start the page at.

integer
0 <= 9007199254740991

Character offset to start the page at.

limit

Most characters to return in this page.

integer
default: 262144 >= 1 <= 262144

Most characters to return in this page.

One page of the file’s text.

Media typeapplication/json
object
data
required

One page of the text of a file attached to a deal, or why it cannot be read.

object
content
required

The requested page of text.

string | null
dealId
required
string
fileName
required
string
fileSize
required

File size in bytes.

integer
>= -9007199254740991 <= 9007199254740991
id
required
string
mimeType
required
string
nextOffset
required

Pass as offset to read the next page; null on the last page.

Any of:
integer
>= -9007199254740991 <= 9007199254740991
offset
required
integer
>= -9007199254740991 <= 9007199254740991
readable
required

True when content holds a page of the file’s text.

boolean
totalChars
required

Characters in the whole file.

Any of:
integer
>= -9007199254740991 <= 9007199254740991
truncated
required

True when more text follows this page.

boolean
unreadableReason
required

Why the content is not returned: a file type that has no text reader, a file over the read limit, a PDF with more pages than the limit, a file with no text (a scan or a picture), a damaged or locked file, or a file missing from storage. Null when readable.

Any of:
string
Allowed values: unsupported too_large too_many_pages no_text unreadable missing

Example

{
"data": {
"unreadableReason": "unsupported"
}
}

Validation error. Parse failures include field paths and expectations.

Media typeapplication/json

Validation error with safe field paths and expected values; submitted values are never returned.

object
error
required
object
code
required

Stable machine-readable error code.

string
issues
Array<object>
object
expected
required
string
message
required
string
path
required
Array<string | number>
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Forbidden.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Not found.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.