Create a file
const url = 'https://deeperesearch.com/v1/files';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"filename":"requirements.pdf","mime_type":"application/pdf","size_bytes":482133}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The file’s name, e.g. requirements.pdf.
The file’s type.
The exact size, up to 25 MB.
Example
{ "filename": "requirements.pdf", "mime_type": "application/pdf", "size_bytes": 482133}Responses
Section titled “Responses”The file, with where to upload it
object
ISO 8601 timestamp, UTC
object
Signed upload URL
Send these headers with the upload
object
Example
{ "object": "file", "status": "awaiting_upload", "upload": { "method": "PUT" }}The body isn’t valid JSON (invalid_json)
object
object
Stable, machine-readable error code. See Errors in the docs.
What went wrong, written for people
Example generated
{ "error": { "code": "example", "message": "example" }}Missing or invalid API key (unauthorized)
object
object
Stable, machine-readable error code. See Errors in the docs.
What went wrong, written for people
Example generated
{ "error": { "code": "example", "message": "example" }}The key lacks the scope this needs (forbidden)
object
object
Stable, machine-readable error code. See Errors in the docs.
What went wrong, written for people
Example generated
{ "error": { "code": "example", "message": "example" }}The body is over 128 KB (body_too_large)
object
object
Stable, machine-readable error code. See Errors in the docs.
What went wrong, written for people
Example generated
{ "error": { "code": "example", "message": "example" }}Invalid request; the message names the field (invalid_request, exceeds_max_cost, vendor_unavailable, …)
object
object
Stable, machine-readable error code. See Errors in the docs.
What went wrong, written for people
Example generated
{ "error": { "code": "example", "message": "example" }}Rate limit, spending limit or quota reached (rate_limited, limit_reached, quota_exceeded). See Retry-After.
object
object
Stable, machine-readable error code. See Errors in the docs.
What went wrong, written for people
Example generated
{ "error": { "code": "example", "message": "example" }}