Skip to main content
POST
/
files
/
upload
Upload a File
from deeprails import DeepRails
DEEPRAILS_API_KEY = "YOUR_API_KEY"
client = DeepRails(
  api_key=DEEPRAILS_API_KEY,
)
file_response = client.files.upload(
  file=open("example.pdf", "rb")
)
print(file_response)
{
  "file_name": "example.pdf",
  "file_id": "file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "file_size": 1024
}
Files used for the file search feature in Defend must be uploaded to DeepRails here before being added to workflows. The request body must include the file to upload as binary content formatted as a form-data.

When you upload a file, you’ll receive a file ID. Use this ID to add the file to a workflow for evaluation. Additionally, you’ll receive a file path corresponding to the s3 bucket where the file is stored.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
files
string[]
required

The contents of the files to upload.

Response

File uploaded successfully

file_name
string

Name of the file.

Example:

"example.pdf"

file_id
string

A unique file ID.

Example:

"file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

file_size
integer

The size of the file in bytes.

Example:

1024