AI Writing API Documentation
Complete reference for the AI Writing & Text Processing API
Authentication
Authorization: Bearer sk_live_your_key_here
POST /v1/ai/process
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| action | string | Yes | rewrite, summarize, translate, grammar, expand, simplify, keywords, tone_detect |
| text | string | Yes | Input text (max 10,000 characters) |
| tone | string | No | For rewrite: professional, casual, formal, friendly, persuasive, academic, creative, humorous, empathetic, authoritative |
| style | string | No | For summarize: concise, detailed, bullet_points, one_sentence, key_takeaways |
| target_language | string | No | For translate: target language name or code (default: en) |
| source_language | string | No | For translate: source language (default: auto-detect) |
| count | integer | No | For keywords: number of keywords to extract (1-30, default: 10) |
Example: Rewrite
bash
curl -X POST "https://snapapis.com/api/v1/ai/process" \
-H "Authorization: Bearer YOUR_KEY" \
-d "action=rewrite&tone=casual&text=The quarterly financial results exceeded expectations."
Example: Translate
bash
curl -X POST "https://snapapis.com/api/v1/ai/process" \
-H "Authorization: Bearer YOUR_KEY" \
-d "action=translate&target_language=Spanish&text=Hello, how are you?"
Response
{
"success": true,
"data": {
"action": "rewrite",
"result": "The rewritten text appears here...",
"input_length": 52,
"output_length": 48,
"model": "gpt-4o-mini",
"tone": "casual",
"duration_ms": 1250
}
}