Prerequisites
Before you begin, make sure you have:- A Wordsmith account (sign up here)
- An API key (see Authentication)
- A tool to make HTTP requests (curl, Postman, or your preferred programming language)
Step 1: Test Your Authentication
First, let’s verify your API key works by getting your user information:Step 2: Ask Your First Question
Now let’s ask the AI assistant a legal question:Step 3: Upload and Analyze a Document
You can also upload documents for analysis. First, get an upload URL:Sync vs Async Mode
Sync Mode (sync_mode: true
)
- Response includes the complete answer immediately
- Limited to 30 seconds processing time
- Best for simple questions without attachments
- Good for testing and development
Async Mode (sync_mode: false
)
- Returns immediately with
status: "in_progress"
- Longer processing time for complex questions
- Requires polling or callback URL for results
- Recommended for production use
Error Handling
Always check for errors in your responses:400
- Bad Request (invalid parameters)401
- Unauthorized (invalid API key)429
- Too Many Requests (rate limit exceeded)500
- Internal Server Error
Next Steps
Now that you’ve made your first API calls:- Explore the API Reference - See all available endpoints and parameters
- Set up webhooks - Use callback URLs to receive async results
- Integrate with your app - Build Wordsmith into your workflow
- Monitor usage - Keep track of your API usage and rate limits
SDK and Libraries
While we don’t currently provide official SDKs, the API works with any HTTP client library in your preferred programming language:- Python:
requests
,httpx
- JavaScript/Node.js:
fetch
,axios
- PHP:
cURL
,Guzzle
- Ruby:
net/http
,Faraday
- Java:
OkHttp
,Apache HttpClient
Need Help?
If you run into issues:- Check the API Reference for detailed endpoint documentation
- Email us at support@wordsmith.ai