SiteChat API
Embed an AI-powered chatbot on your website in minutes
Getting Started
SiteChat lets you add an intelligent chatbot to your website that can answer questions using your own documents and content. Here's how to get started:
- Create a SiteChat configuration in your account
- Upload documents or crawl URLs to build your knowledge base
- Add the widget script to your website
- Your visitors can now chat with your content!
Quick Embed
Add this script tag to your website's HTML, just before the closing </body> tag:
<script src="https://netwrck.com/api/sitechat/embed.js"
data-sitechat-id="YOUR_API_KEY"></script>
Customization Options
You can customize the widget appearance using data attributes:
<script src="https://netwrck.com/api/sitechat/embed.js"
data-sitechat-id="YOUR_API_KEY"
data-primary-color="#6366f1"
data-text-color="#ffffff"
data-position="right"
data-welcome="Hi! How can I help you today?"
data-placeholder="Type your message..."></script>
| Attribute | Description | Default |
|---|---|---|
data-primary-color | Main color for bubble and buttons | #6366f1 |
data-text-color | Text color on primary backgrounds | #ffffff |
data-position | Bubble position: "left" or "right" | right |
data-welcome | Initial welcome message | Hi! How can I help you today? |
data-placeholder | Input placeholder text | Type your message... |
API Endpoints
Configuration
Create a new SiteChat configuration
{
"name": "My Website Chat",
"custom_system_prompt": "You are a helpful assistant for...",
"allowed_domains": ["example.com", "*.example.com"],
"theme": {
"primary_color": "#6366f1",
"text_color": "#ffffff",
"bubble_position": "right",
"welcome_message": "Hi! How can I help?",
"placeholder_text": "Type here..."
}
}
List all your SiteChat configurations
Get a specific configuration
Update a configuration
Delete a configuration
Documents
Upload a document file (PDF, DOCX, TXT, MD, HTML, CSV, JSON)
curl -X POST https://netwrck.com/api/sitechat/upload-doc \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "config_id=123" \
-F "[email protected]"
Crawl a URL and index its content
{
"config_id": 123,
"url": "https://example.com/docs/getting-started"
}
List all documents for a configuration
Chat
Send a chat message (public endpoint, uses API key)
{
"config_id": "sc_abc123...",
"session_id": "user_session_id",
"message": "What features do you offer?"
}
Response:
{
"response": "We offer several features including...",
"session_id": "user_session_id",
"tokens_used": 150,
"credits_used": 1
}
Usage
Get usage statistics for a configuration
Supported File Formats
- PDF - Portable Document Format
- DOCX - Microsoft Word documents
- HTML - Web pages
- Markdown - .md files with frontmatter support
- TXT - Plain text files
- CSV - Comma-separated values
- JSON - JSON data files
Pricing
SiteChat uses your Netwrck credits. Pricing is based on token usage:
| Operation | Cost |
|---|---|
| Input tokens | 1 credit per 1,000 tokens |
| Output tokens | 3 credits per 1,000 tokens |
| Document indexing | 0.5 credits per 1,000 characters |
Average cost per chat message: 1-2 credits depending on response length.
Domain Restrictions
You can restrict which domains are allowed to use your chat widget by setting allowed_domains in your configuration. This prevents unauthorized use of your API key.
- Use
*to allow all domains (not recommended for production) - Use
example.comto allow a specific domain - Use
*.example.comto allow all subdomains
Ready to add AI chat to your website?
Create your first SiteChat configuration and start engaging with your visitors.
Get Started
Netwrck