Skip to content

Create a file

POST
/v1/files
curl --request POST \
--url https://deeperesearch.com/v1/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "filename": "requirements.pdf", "mime_type": "application/pdf", "size_bytes": 482133 }'

Step 1 of 3 to attach a file: returns a signed URL. Upload the bytes there with PUT, then call POST /v1/files/{id}/complete.

Media typeapplication/json
object
filename
required

The file’s name, e.g. requirements.pdf.

string
>= 1 characters <= 255 characters
mime_type
required

The file’s type.

string
Allowed values: text/plain text/markdown application/pdf image/png image/jpeg image/webp
size_bytes
required

The exact size, up to 25 MB.

integer
> 0 <= 26214400

Example

{
"filename": "requirements.pdf",
"mime_type": "application/pdf",
"size_bytes": 482133
}

The file, with where to upload it

Media typeapplication/json
object
id
required
string format: uuid
object
required
string
Allowed value: file
filename
required
string
mime_type
required
string
size_bytes
required
integer
>= -9007199254740991 <= 9007199254740991
status
required
string
Allowed values: awaiting_upload processing ready failed
text_chars
required

Characters of text read from the file

Any of:
integer
>= -9007199254740991 <= 9007199254740991
note
required
string | null
created_at
required

ISO 8601 timestamp, UTC

string
upload
required
object
url
required

Signed upload URL

string
method
required
string
Allowed value: PUT
headers
required

Send these headers with the upload

object
key
additional properties
string
expires_in_seconds
required
integer
>= -9007199254740991 <= 9007199254740991

Example

{
"object": "file",
"status": "awaiting_upload",
"upload": {
"method": "PUT"
}
}

The body isn’t valid JSON (invalid_json)

Media typeapplication/json
object
error
required
object
code
required

Stable, machine-readable error code. See Errors in the docs.

string
message
required

What went wrong, written for people

string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

Missing or invalid API key (unauthorized)

Media typeapplication/json
object
error
required
object
code
required

Stable, machine-readable error code. See Errors in the docs.

string
message
required

What went wrong, written for people

string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

The key lacks the scope this needs (forbidden)

Media typeapplication/json
object
error
required
object
code
required

Stable, machine-readable error code. See Errors in the docs.

string
message
required

What went wrong, written for people

string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

The body is over 128 KB (body_too_large)

Media typeapplication/json
object
error
required
object
code
required

Stable, machine-readable error code. See Errors in the docs.

string
message
required

What went wrong, written for people

string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

Invalid request; the message names the field (invalid_request, exceeds_max_cost, vendor_unavailable, …)

Media typeapplication/json
object
error
required
object
code
required

Stable, machine-readable error code. See Errors in the docs.

string
message
required

What went wrong, written for people

string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

Rate limit, spending limit or quota reached (rate_limited, limit_reached, quota_exceeded). See Retry-After.

Media typeapplication/json
object
error
required
object
code
required

Stable, machine-readable error code. See Errors in the docs.

string
message
required

What went wrong, written for people

string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}