curl --request POST \
--url https://api.wordsmith.ai/api/v1/assistants/{assistant_id}/questions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"question": "<string>",
"attachments": [
{
"upload_job_id": "<string>",
"url": "<string>",
"unzip": true
}
],
"session_id": "<string>",
"permissions": {
"visibility": "<string>"
},
"callback_url": "<string>",
"sync_mode": true
}
'{
"id": "123e4567-e89b-12d3-a456-426614174000",
"session_id": "123e4567-e89b-12d3-a456-426614174000",
"session_url": "https://app.wordsmith.ai/chat/123e4567-e89b-12d3-a456-426614174000",
"status": "completed",
"answer": "A valid contract under US law typically requires four essential elements:\n\n1. **Offer**: A clear, definite proposal to enter into an agreement...",
"attachments": [
{
"file_name": "contract_analysis.pdf",
"content_type": "application/pdf",
"content_length": 245760,
"url": "https://files.wordsmith.ai/signed-url-here"
}
]
}
Ask a question to the Wordsmith AI assistant with optional file attachments
curl --request POST \
--url https://api.wordsmith.ai/api/v1/assistants/{assistant_id}/questions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"question": "<string>",
"attachments": [
{
"upload_job_id": "<string>",
"url": "<string>",
"unzip": true
}
],
"session_id": "<string>",
"permissions": {
"visibility": "<string>"
},
"callback_url": "<string>",
"sync_mode": true
}
'{
"id": "123e4567-e89b-12d3-a456-426614174000",
"session_id": "123e4567-e89b-12d3-a456-426614174000",
"session_url": "https://app.wordsmith.ai/chat/123e4567-e89b-12d3-a456-426614174000",
"status": "completed",
"answer": "A valid contract under US law typically requires four essential elements:\n\n1. **Offer**: A clear, definite proposal to enter into an agreement...",
"attachments": [
{
"file_name": "contract_analysis.pdf",
"content_type": "application/pdf",
"content_length": 245760,
"url": "https://files.wordsmith.ai/signed-url-here"
}
]
}
"default" for the general Wordsmith
assistant, or specify a custom assistant ID if available.Show Attachment Object
url must be provided.upload_job_id must be provided.Show Permissions Object
"private": Only you can access the session "organization": Anyone in your organization can access the session
"public": Anyone with the link can access the sessionsync_mode is false. Optionally signed with the webhook secret if
provided when creating a new API key. Signature is in the
Wordsmith-Signature header.true: Response
includes the full answer (30-second timeout). false: Returns immediately
with a session ID for async processing.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": "What are the key elements of a valid contract under US law?",
"sync_mode": true
}'
"in_progress": Processing is ongoing.
"completed": Answer is ready. "error": Processing failed.status is
"completed".status is "completed".{
"id": "123e4567-e89b-12d3-a456-426614174000",
"session_id": "123e4567-e89b-12d3-a456-426614174000",
"session_url": "https://app.wordsmith.ai/chat/123e4567-e89b-12d3-a456-426614174000",
"status": "completed",
"answer": "A valid contract under US law typically requires four essential elements:\n\n1. **Offer**: A clear, definite proposal to enter into an agreement...",
"attachments": [
{
"file_name": "contract_analysis.pdf",
"content_type": "application/pdf",
"content_length": 245760,
"url": "https://files.wordsmith.ai/signed-url-here"
}
]
}
sync_mode: false, you can receive notifications via webhook when processing completes:
{
"id": "987fcdeb-51a2-43d1-9e8f-7b6c5a4d3e2f",
"session_id": "987fcdeb-51a2-43d1-9e8f-7b6c5a4d3e2f",
"session_url": "https://app.wordsmith.ai/chat/987fcdeb-51a2-43d1-9e8f-7b6c5a4d3e2f",
"status": "completed",
"answer": "Based on my analysis of the contract...",
"attachments": [
{
"file_name": "contract_review.pdf",
"content_type": "application/pdf",
"content_length": 524288,
"url": "https://files.wordsmith.ai/signed-url-here"
}
]
}
{
"error": "Question exceeds maximum length of 10,000 characters",
"status": 400
}
session_id parameter:
id: The unique identifier for this specific question. For new sessions, this equals the session_id. For follow-up questions, this is a unique question ID.session_id: The session ID that contains this question. This remains constant for all questions within the same conversation.id field to check the status of individual questions, and the session_id to identify which conversation session the question belongs to.
sync_mode: true) for:
sync_mode: false) for: