Create Assistant Question
API Documentation
Create Assistant Question
Ask a question to the Wordsmith AI assistant with optional file attachments
POST
Create Assistant Question
Creates a new assistant session by asking a question, or adds a question to an existing session. The assistant can analyze text, documents, and provide legal insights based on the question and any attached files.
When adding questions to an existing session, the conversation context is preserved, allowing for follow-up questions and multi-turn conversations.
Editing the assistant’s wording only affects questions filtered afterwards. Whatever a question was answered with is stored when it is declined, so re-polling an old
For detailed information about webhook setup, signature verification, and security best practices, see the Webhooks documentation.
Authentication
This endpoint requires a valid API key in the Authorization header.Path Parameters
string
default:"default"
required
The ID of the assistant to use. Use
"default" for the general Wordsmith
assistant, or specify a custom assistant ID if available.Request Body
string
required
The question to ask the assistant. Maximum length: 10,000 characters.
array
An array of file attachments (maximum 10 files). Each attachment can be either
an uploaded file or a URL.
string
The session ID to add this question to. If not provided, a new session will be
created. When adding to an existing session, the conversation context is
preserved for follow-up questions.
object
Optional permissions settings for the chat session.
string
URL to receive a webhook notification when async processing is complete. Only
used when
sync_mode is false. Optionally signed with the webhook secret if
provided when creating a new API key. Signature is in the
Wordsmith-Signature header.boolean
default:"false"
Whether to wait for the complete response synchronously.
true: Response
includes the full answer (30-second timeout). false: Returns immediately
with a session ID for async processing.Response
string
The unique identifier for this specific question. Always usable to check the
question’s status, including when
status is "filtered".string
The session ID that contains this question. This is always the same for all
questions within a conversation session.
null only when status is
"filtered", where no session was created.string
A direct URL to view this session in the Wordsmith web application. This
allows users to access the full conversation history and interact with the
assistant through the web interface.
null only when status is
"filtered", where there is no session to view.string
The current status of the question:
"in_progress": Processing is ongoing.
"completed": Answer is ready. "error": Processing failed. "filtered":
The assistant declined the question — see Filtered
questions.string
The assistant’s response to your question. Present when
status is
"completed", and also when it is "filtered" — where it carries the
decline wording, so a client that only reads answer still has something to
show. See Filtered questions.array
Array of files generated by the assistant (e.g., summary documents, analysis reports). Only present when
status is "completed".string
One sentence explaining why the assistant declined the question. Present only when
status is
"filtered", and null for every other status. It may also be null on a filtered question —
see Filtered questions — so treat it as an explanation to show when you
have one, not a field to depend on.Filtered Questions
An assistant can be configured with an intake instruction describing the work it accepts. When a new question does not match that instruction, the assistant declines it: the request returnsstatus: "filtered" and no session is created.
"filtered" is not an error. The request was well-formed and authenticated; the assistant simply decided the question was not for it. Handle it as its own outcome rather than as a failure to retry.
Three things follow from no session existing:
session_idandsession_urlarenull. They are null for this status and no other, so existing handling for"in_progress","completed"and"error"is unaffected.idis still valid. It identifies the filtered question, andGET /api/v1/assistants/{assistant_id}/questions/{id}keeps returning"filtered"for it. Nothing about the request is lost."filtered"is terminal. A filtered question never becomes"in_progress"or"completed", so polling loops must stop on it — see Get Question Status.
What you get back to show
Bothanswer and reason carry the decline wording, so a client written against answer alone keeps working without knowing the status exists:
reasonis always the assistant’s own one-sentence explanation of why this question was declined — for example, “This article is about a new UK immigration white paper and salary thresholds for skilled worker visas, not about statutory minimum wage rates.”answeris the same sentence, unless the assistant’s owner has written fixed wording to use instead. Doing so trades the per-question detail for a string you can rely on being identical every time.
status, never on this text.
answer and reason can both be null on a "filtered" response. Questions filtered before these fields existed have no stored explanation, and one is not reconstructed on later polls. Show the explanation when it is there and fall back to your own copy when it is not.id always returns what you were originally told.
Only a new question is judged. A follow-up sent with session_id continues a conversation the assistant already accepted and is never filtered.
If you supplied a callback_url, a "filtered" webhook is delivered too, so webhook-driven integrations are not left waiting for a run that will never happen.
An agent-backed assistant only accepts questions while its API intake is switched on. If it has been switched off, this endpoint returns
404 — the assistant also stops appearing in List Assistants. Questions asked before it was switched off remain pollable via Get Question Status, so an in-flight answer is never stranded.Async Processing & Webhooks
When usingsync_mode: false, you can receive notifications via webhook when processing completes:
Error Responses
See the Errors page for the full error format reference and handling guidance.Session Management
Adding Questions to Existing Sessions
When adding questions to an existing session using thesession_id parameter:
- Conversation Context: The assistant maintains context from previous questions and answers in the session
- Sequential Processing: New questions cannot be submitted until the previous question in the session has completed processing
- Error Handling: If a previous question is still processing, the API will return a 400 Bad Request error
ID vs Session ID
The response includes two important identifiers: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. For a filtered question it is an identifier of its own, naming a question no session was created for.session_id: The session ID that contains this question. This remains constant for all questions within the same conversation, and isnullwhenstatusis"filtered".
id field to check the status of individual questions, and the session_id to identify which conversation session the question belongs to. Treat id as an opaque string: it is always present and always pollable, but do not assume it equals the session_id — that only holds for the first question of an accepted session.
Best Practices
Sync vs Async Mode
Use Sync Mode (sync_mode: true) for:
- Testing and development
sync_mode: false) for:
- Complex document analysis
- Multiple file attachments
- Production applications
- Long-form research questions
File Attachments
- Supported formats: PDF, DOC, DOCX, TXT, MD, HTML, XLS, XLSX, CSV, TSV, PPT, PPTX, PNG, JPEG, WebP, TIFF, MP3, MP4, M4A, MPEG, WAV, WebM, ZIP
- Maximum file size: 50 MB per file
- Maximum attachments: 10 files per question
Question Guidelines
- Be specific: More detailed questions get better answers
- Provide context: Include relevant background information
Use Cases
1. Document Review & Analysis
- Basic Review: “Review attached document”
- Review with Specific Playbook: “Review this document using the Standard NDA playbook”
- Reference Playbook by ID: “Review this document using playbook ID: 123e4567-e89b-12d3-a456-426614174000”
2. Template Filling & Document Generation
- Fill Template: “Fill in our standardemployment agreement template using me as the employer party”
- Reference Template by ID: “Fill in template ID: 123e4567-e89b-12d3-a456-426614174000 using my company information”
3. Legal Research & Analysis
- Case Law Research: “What are the recent precedents for breach of contract cases in California?”
- Regulatory Compliance: “What are the current requirements for data protection in healthcare contracts?”
- Legal Framework: “Explain the key elements of a valid employment contract under UK law”
- Industry Standards: “What are the standard terms typically included in SaaS vendor agreements?“
4. Document Drafting & Creation
- Email Drafting: “Draft a professional email to a client explaining contract delays”
- Clause Drafting: “Draft a force majeure clause for a construction contract”
- Legal Letters: “Write a demand letter for unpaid invoices”
- Meeting Minutes: “Draft meeting minutes based on the attached audio recording”
5. Translation & Conversion
- Language Translation: “Translate this contract to Spanish while maintaining legal accuracy”
- Multi-language: “Provide this agreement in both English and French versions”
- Format Conversion: “Convert this PDF document to DOCX”
6. Presentations & Spreadsheets
- Generate Presentation: “Create a PowerPoint presentation summarizing the key findings from the review of attached NDA”
- Executive Summary: “Generate an executive summary of this legal document for senior management”
- Questionnaire Processing: “Fill in this security questionnaire in the attached XLSX”
- Spreadsheet Generation: “Extract all dates, amounts, and party names from this document into a structured spreadsheet”