Synthora API Documentation
Here for you to learn about our API.

API Documentation
# Synthora AI API Documentation
## Overview
The Synthora AI API provides programmatic access to our AI chat capabilities. This documentation covers authentication, available endpoints, rate limits, and usage examples.
**Base URL:** `https://your-synthora-instance.replit.app`
---
## Authentication
All API requests require authentication using a Bearer token (your API key).
### Getting Your API Key
1. Log in to your Synthora account
2. Navigate to **Settings** → **API Access**
3. Click **Generate API Key** (Premium or Enterprise subscription required)
4. Copy and securely store your API key
### Using Your API Key
Include your API key in the `Authorization` header:
```
Authorization: Bearer YOUR_API_KEY
```
**Important:**
- Keep your API key secure and never share it publicly
- API keys are only available for Premium and Enterprise users
- Free tier users do not have API access
---
## Subscription Tiers & Limits
| Feature | Free | Premium | Enterprise |
|---------|------|---------|------------|
| API Access | No | Yes | Yes |
| Daily Chat Messages | 25 | Unlimited | Unlimited |
| API Credits | N/A | Pay-per-use | Unlimited |
| Cost per API Call | N/A | 0.05 credits | Free |
---
## Endpoints
### 1. Chat Completion (OpenAI-Compatible Format)
Generate AI responses using an OpenAI-compatible messages format.
**Endpoint:** `POST /api/v1/chat`
**Headers:**
```
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```
**Request Body:**
```json
{
"messages": [
{
"role": "user",
"content": "Hello, how are you?"
}
],
"model": "synthora-default"
}
```
**Parameters:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `messages` | array | Yes | Array of message objects with `role` and `content` |
| `model` | string | No | Model to use (defaults to "synthora-default") |
**Message Object:**
| Field | Type | Description |
|-------|------|-------------|
| `role` | string | Either "user" or "assistant" |
| `content` | string | The message content |
**Response:**
```json
{
"id": "synth-1701936000000",
"object": "chat.completion",
"created": 1701936000,
"model": "synthora-default",
"response": "Hello! I'm doing great, thank you for asking. How can I help you today?",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm doing great, thank you for asking. How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 6,
"completion_tokens": 15,
"total_tokens": 21
}
}
```
---
### 2. Simple AI Request
A simplified endpoint for basic AI queries.
**Endpoint:** `POST /api/ai`
**Headers:**
```
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```
**Request Body:**
```json
{
"message": "What is the capital of France?"
}
```
**Parameters:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `message` | string | Yes | Your question or prompt |
**Response:**
```json
{
"response": "The capital of France is Paris."
}
```
---
### 3. Text Generation
Generate creative text content.
**Endpoint:** `POST /api/v1/generate`
**Headers:**
```
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```
**Request Body:**
```json
{
"prompt": "Write a short poem about the ocean",
"maxTokens": 200
}
```
**Cost:** 0.25 credits per request
---
### 4. Text Summarization
Summarize long text content.
**Endpoint:** `POST /api/v1/summarize`
**Headers:**
```
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```
**Request Body:**
```json
{
"text": "Your long text to summarize goes here...",
"length": "short"
}
```
**Parameters:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `text` | string | Yes | The text to summarize |
| `length` | string | No | Summary length: "short", "medium", or "long" |
**Cost:** 0.25 credits per request
---
### 5. Text Translation
Translate text between languages.
**Endpoint:** `POST /api/v1/translate`
**Headers:**
```
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```
**Request Body:**
```json
{
"text": "Hello, how are you?",
"targetLanguage": "es"
}
```
**Parameters:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `text` | string | Yes | The text to translate |
| `targetLanguage` | string | Yes | Target language code (e.g., "es", "fr", "de") |
**Cost:** 0.25 credits per request
---
### 6. Sentiment Analysis
Analyze the sentiment of text.
**Endpoint:** `POST /api/v1/sentiment`
**Headers:**
```
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```
**Request Body:**
```json
{
"text": "I love this product! It's amazing."
}
```
**Cost:** 0.25 credits per request
---
## Supported Languages
Synthora supports multi-language responses. The following language codes are supported:
| Code | Language |
|------|----------|
| `en` | English |
| `es` | Spanish |
| `fr` | French |
| `de` | German |
| `it` | Italian |
| `pt` | Portuguese |
| `nl` | Dutch |
| `ru` | Russian |
| `zh` | Chinese |
| `ja` | Japanese |
| `ko` | Korean |
| `ar` | Arabic |
---
## Error Responses
The API uses standard HTTP status codes to indicate success or failure.
### Common Error Codes
| Status Code | Meaning |
|-------------|---------|
| 200 | Success |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid or missing API key |
| 402 | Payment Required - Insufficient API credits |
| 403 | Forbidden - Account suspended or no API access |
| 404 | Not Found - Resource doesn't exist |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error |
### Error Response Format
```json
{
"error": "Error code or type",
"message": "Human-readable error description"
}
```
### Example Error Responses
**Invalid API Key:**
```json
{
"error": "Invalid API key"
}
```
**Insufficient Credits:**
```json
{
"error": "Insufficient API credits"
}
```
**No API Access:**
```json
{
"error": "Your subscription does not include API access"
}
```
---
## Rate Limits
| Tier | Requests per Minute | Daily Limit |
|------|---------------------|-------------|
| Premium | 60 | Based on credits |
| Enterprise | Unlimited | Unlimited |
---
## Code Examples
### JavaScript/Node.js
```javascript
const response = await fetch('https://your-synthora-instance.replit.app/api/v1/chat', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
messages: [
{ role: 'user', content: 'What is machine learning?' }
]
})
});
const data = await response.json();
console.log(data.choices[0].message.content);
```
### Python
```python
import requests
url = "https://your-synthora-instance.replit.app/api/v1/chat"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"messages": [
{"role": "user", "content": "What is machine learning?"}
]
}
response = requests.post(url, json=payload, headers=headers)
data = response.json()
print(data["choices"][0]["message"]["content"])
```
### cURL
```bash
curl -X POST https://your-synthora-instance.replit.app/api/v1/chat \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "What is machine learning?"}
]
}'
```
---
## Best Practices
1. **Secure Your API Key**
- Never expose your API key in client-side code
- Use environment variables to store your key
- Rotate your API key if you suspect it's been compromised
2. **Handle Errors Gracefully**
- Always check the response status code
- Implement retry logic for transient errors (5xx)
- Don't retry on authentication errors (401, 403)
3. **Optimize Your Requests**
- Keep prompts concise but clear
- Use the appropriate endpoint for your use case
- Cache responses when appropriate
4. **Monitor Your Usage**
- Track your API credit balance
- Set up alerts for low credit warnings
- Review your API call history in the dashboard
---
## Discord Bot Integration
Synthora also provides a Discord bot for server-based AI interactions. Contact support or visit the Discord Bot section in your dashboard to set up the bot for your Discord server.
### Features:
- `/ask` command for AI queries
- Channel monitoring for automatic responses
- Per-server API key configuration
- Enterprise-level server support
---
## Support
For API-related questions or issues:
- **Email:** Contact through the Synthora platform
- **Support Tickets:** Available via Discord login at `/support`
- **Discord:** Join our community server for real-time help
---
## Changelog
**December 2025**
- Initial API documentation release
- OpenAI-compatible chat completions endpoint
- Multi-language support
- Content moderation integration
---
*This documentation is subject to change. Always refer to the latest version for accurate information.*Join our Synthora Community
Join our Discord community if you need help.
Last updated
Was this helpful?