curl --request POST \
--url https://api.wordsmith.ai/api/v1/files/upload-url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_name": "<string>",
"content_type": "<string>",
"content_length": 123
}
'{
"upload_url": "https://s3.amazonaws.com/wordsmith-uploads/signed-url-here",
"upload_job_id": "123e4567-e89b-12d3-a456-426614174000",
"expires_at": "2024-01-15T15:30:00Z"
}
Generate a presigned URL for uploading files to be used with the assistant
curl --request POST \
--url https://api.wordsmith.ai/api/v1/files/upload-url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_name": "<string>",
"content_type": "<string>",
"content_length": 123
}
'{
"upload_url": "https://s3.amazonaws.com/wordsmith-uploads/signed-url-here",
"upload_job_id": "123e4567-e89b-12d3-a456-426614174000",
"expires_at": "2024-01-15T15:30:00Z"
}
curl -X POST "https://api.wordsmith.ai/api/v1/files/upload-url" \
-H "Authorization: Bearer sk-ws-api1-your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"file_name": "contract.pdf",
"content_type": "application/pdf",
"content_length": 1048576
}'
{
"upload_url": "https://s3.amazonaws.com/wordsmith-uploads/signed-url-here",
"upload_job_id": "123e4567-e89b-12d3-a456-426614174000",
"expires_at": "2024-01-15T15:30:00Z"
}
# Step 1: Get upload URL (shown above)
# Step 2: Upload the file
curl -X PUT "https://s3.amazonaws.com/wordsmith-uploads/signed-url-here" \
-H "Content-Type: application/pdf" \
--data-binary @contract.pdf
# Step 3: Use upload_job_id in your assistant question
curl -X POST "https://api.wordsmith.ai/api/v1/assistants/default/questions" \
-H "Authorization: Bearer sk-ws-api1-your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"question": "Please review this contract",
"attachments": [
{
"upload_job_id": "123e4567-e89b-12d3-a456-426614174000"
}
]
}'
{
"error": "Invalid file type",
"status": 400
}
upload_job_id can be used immediately after uploading, no need to wait for processing