Request & Response Format
Detailed JSON schema for SALZ API requests and responses -- field descriptions, data types, constraints, and example payloads.
This page documents the exact structure of SALZ API requests and responses, including every field, its type, and constraints.
Request Body
Send a POST request to /api/v1/optimize with a JSON body:
{
"text": "Your AI-generated text to optimize."
}
Fields
| Field | Type | Required | Description |
|---|---|---|---|
text | string | Yes | The AI-generated text to optimize |
Constraints
textmust be a non-empty string.- Maximum length: 10,000 characters (free tier: 5,000).
- The text must be UTF-8 encoded.
- Leading and trailing whitespace is preserved.
Example Request
curl -X POST https://add-salz.io/api/v1/optimize \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "It is important to note that the utilization of advanced methodologies in the context of modern software development facilitates the creation of robust and scalable applications that meet the ever-growing demands of today'\''s digital landscape."
}'
Success Response
HTTP Status: 200 OK
{
"optimized": "Modern development practices help you build apps that scale and hold up under real-world use.",
"success": true
}
Fields
| Field | Type | Description |
|---|---|---|
optimized | string | The optimized version of the input text |
success | boolean | Always true for successful responses |
The optimized field contains the rewritten text. It may be shorter or longer than the input -- SALZ focuses on making the text sound natural, not on matching a specific length.
Error Response
HTTP Status: 4xx or 5xx
{
"error": "Description of what went wrong",
"success": false
}
Fields
| Field | Type | Description |
|---|---|---|
error | string | A human-readable description of the error |
success | boolean | Always false for error responses |
Common Error Responses
Missing text field (400):
{
"error": "Text is required",
"success": false
}
Text too long (400):
{
"error": "Text exceeds maximum length of 10000 characters",
"success": false
}
Invalid API key (401):
{
"error": "Invalid or missing API key",
"success": false
}
Rate limit exceeded (429):
{
"error": "Rate limit exceeded. Try again in 45 seconds.",
"success": false
}
Server error (500):
{
"error": "Internal server error",
"success": false
}
Response Headers
Every response includes these headers:
| Header | Example | Description |
|---|---|---|
Content-Type | application/json | Response format |
X-RateLimit-Limit | 20 | Max requests per window |
X-RateLimit-Remaining | 18 | Requests remaining in window |
Content Type
Both requests and responses use application/json. Sending a request with a different Content-Type header will result in a 400 error.
Character Encoding
All text must be UTF-8 encoded. SALZ handles standard Unicode characters including accented letters, CJK characters, and common symbols.