API Reference
Complete REST API documentation for Classy Comments
Authentication
All API requests require an API key passed in the X-API-Key
header.
curl https://api.classycomments.com/api/refine \
-H "X-API-Key: cc_live_sk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"text": "THIS IS GREAT!!!"}'
API Key Format
cc_live_sk_*
- Production API keyscc_demo_sk_*
- Demo API keys (limited features)
Base URL
https://api.classycomments.com
Rate Limits
Endpoint | Limit |
---|---|
General endpoints | 100 requests per 15 minutes |
Classification endpoint | 20 requests per minute |
Authentication endpoints | 5 requests per 15 minutes |
Refine Comment
POST /api/refine
Refine a comment using AI or demo mode.
Config comes from your dashboard
The config
parameter is optional. If omitted, the API uses the settings you configured in your dashboard. This is the recommended approach—configure once, use everywhere!
Request Body
{
"text": "THIS IS AWESOME!!! ur plugin is the best",
// Optional: Override dashboard settings
"config": {
"formalityLevel": 3,
"tone": "friendly",
"profanityHandling": "soften",
"emojiHandling": "remove",
"capsCorrection": true,
"punctuationCleanup": true,
"grammarStrictness": 3,
"lengthPreference": "keep"
},
"mode": "ai", // or "demo"
"domain": "example.com"
}
Response
{
"success": true,
"data": {
"id": 123,
"originalText": "THIS IS AWESOME!!! ur plugin is the best",
"refinedText": "This is awesome! Your plugin is the best.",
"status": "completed",
"processingTimeMs": 1234,
"provider": "openai",
"model": "gpt-4",
"changeScore": 0.42
}
}
Parameters
Field | Type | Required | Description |
---|---|---|---|
text | string | Yes | Comment text to refine |
config | object | No | Refinement configuration (uses defaults if omitted) |
mode | string | No | "ai" or "demo" (default: uses client config) |
domain | string | No | Origin domain for analytics |
Classify Comment
POST /api/classify
Classify a comment's toxicity, sentiment, and language.
Request Body
{
"text": "Great article! Thanks for sharing."
}
Response
{
"toxicity": 0.02,
"sentiment": "positive",
"language": "en",
"needsRefinement": false
}
Get Statistics
GET /api/users/me/clients/:clientId/stats
Retrieve usage statistics for your client account.
Response
{
"totalComments": 1234,
"monthlyUsage": 456,
"quota": 1000,
"quotaRemaining": 544,
"domains": 3,
"apiKeys": 2
}
Error Codes
Code | Description |
---|---|
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Quota exceeded or domain not allowed |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error |
Error Response Format
{
"success": false,
"error": "Invalid API key",
"code": "INVALID_API_KEY"
}
JavaScript Client
For client-side integration, use the @classy-comments/core package:
npm install @classy-comments/core
import { ClassyComments } from '@classy-comments/core'
import '@classy-comments/core/styles.css'
const classy = new ClassyComments({
apiBaseUrl: 'https://api.classycomments.com',
apiKey: 'cc_live_sk_your_api_key',
formalityLevel: 3,
tone: 'friendly',
profanityHandling: 'soften',
emojiHandling: 'remove',
capsCorrection: true,
punctuationCleanup: true
})
await classy.init()
// Process a comment
const result = await classy.processCommentManual('THIS IS GREAT!!!', {
onApprove: (refined) => console.log('Approved:', refined),
onCancel: () => console.log('Cancelled')
})
Need Help?
For API support and questions: