API Documentation

SiteDialect exposes a simple REST API for translating web pages and retrieving language configurations. All responses are returned in JSON format.

Authentication

API requests are authenticated using your site_id, which is included in each request. The server also validates the request origin against your registered domains. No separate API key is required.

Base URL

https://sitedialect.com

Endpoints

POST/api/translate

Translate a web page into the specified language.

Request Body (JSON)

ParameterTypeDescription
site_idstringYour unique site identifier
urlstringFull URL of the page to translate
langstringTarget language code (e.g., "es", "fr", "de")

Example Request

{
  "site_id": "your-site-id",
  "url": "https://example.com/about",
  "lang": "es"
}

Response

FieldTypeDescription
htmlstringThe translated HTML content
cachedbooleanWhether the result was served from cache

Example Response

{
  "html": "<!DOCTYPE html><html>...translated content...</html>",
  "cached": true
}

GET/api/languages/{site_id}

Retrieve the list of enabled languages for a site.

URL Parameters

ParameterTypeDescription
site_idstringYour unique site identifier

Example Response

{
  "site": "your-site-id",
  "languages": ["es", "fr", "de", "ja", "zh"]
}

Rate Limits

There are currently no enforced rate limits on the API. We reserve the right to introduce rate limiting in the future to ensure fair usage.

Response Format

All API responses are returned as JSON with the application/json content type. Error responses include a error field with a human-readable description.

Error Response Example

{
  "error": "Site not found"
}