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

FieldTypeRequiredDescription
textstringYesThe AI-generated text to optimize

Constraints

  • text must 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

FieldTypeDescription
optimizedstringThe optimized version of the input text
successbooleanAlways 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

FieldTypeDescription
errorstringA human-readable description of the error
successbooleanAlways 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:

HeaderExampleDescription
Content-Typeapplication/jsonResponse format
X-RateLimit-Limit20Max requests per window
X-RateLimit-Remaining18Requests 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.