Developer API

PageTranslate.ai API

Programmatic access to our AI-powered translation service. Integrate book translation into your workflows, apps, and services.

Secure API Keys

SHA-256 hashed keys with instant revocation. Maximum 10 active keys per account.

RESTful API

Simple REST endpoints with JSON responses. Standard HTTP status codes.

Rate Limiting

Configurable rate limits with clear headers. 5 uploads/hour by default.

Quick Start

1. Create an API Key

  1. Log in to your PageTranslate.ai account
  2. Navigate to Dashboard → API Keys
  3. Click "Create API Key" and give it a name
  4. Copy and securely store your key (shown only once!)

2. Make Your First Request

curl -X POST "https://api.pagetranslate.ai/api/v1/upload" \
  -H "Authorization: Bearer pt_live_YOUR_API_KEY" \
  -F "[email protected]" \
  -F "requested_language=es" \
  -F "layout_mode=layout_preserving"

Code Examples

Python

import requests

API_KEY = "pt_live_YOUR_KEY"
BASE_URL = "https://api.pagetranslate.ai/api/v1"

# Upload document
with open("book.docx", "rb") as f:
    response = requests.post(
        f"{BASE_URL}/upload",
        headers={"Authorization": f"Bearer {API_KEY}"},
        files={"file": f},
        data={
            "requested_language": "es",
            "layout_mode": "layout_preserving"
        }
    )
    job_id = response.json()["job_id"]

# Start translation
requests.post(
    f"{BASE_URL}/jobs/{job_id}/translate",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={"target_lang": "es", "model": "gpt-4o"}
)

JavaScript

const axios = require("axios");
const FormData = require("form-data");
const fs = require("fs");

const API_KEY = "pt_live_YOUR_KEY";
const BASE_URL = "https://api.pagetranslate.ai/api/v1";

// Upload document
const formData = new FormData();
formData.append("file", fs.createReadStream("book.docx"));
formData.append("requested_language", "es");
formData.append("layout_mode", "layout_preserving");

const upload = await axios.post(
    `${BASE_URL}/upload`,
    formData,
    {
        headers: {
            "Authorization": `Bearer ${API_KEY}`,
            ...formData.getHeaders()
        }
    }
);

const jobId = upload.data.job_id;

Key Endpoints

POST/api/v1/api-keys

Create a new API key. The full key is shown only once during creation.

GET/api/v1/api-keys

List all API keys (masked). Full keys are never returned in list responses.

DELETE/api/v1/api-keys/{key_id}

Revoke an API key immediately. Returns 204 No Content on success.

POST/api/v1/upload

Upload a document (DOCX, PDF, EPUB) for translation. Returns a job ID.

Required: file, requested_language
Optional: layout_mode (default: layout_preserving)
POST/api/v1/jobs/{job_id}/translate

Start translation for an uploaded job. Specify target language and model.

GET/api/v1/jobs/{job_id}

Check translation status. Returns progress, status, and download URL when ready.

GET/api/v1/jobs/{job_id}/download

Download the translated document once translation is complete.

GET/api/v1/pricing/catalog

Get pricing information including plan limits and per-word rates.

Base URLs

Production
https://api.pagetranslate.ai/api/v1
Staging
https://staging.api.pagetranslate.ai/api/v1

Authentication

Include your API key in the Authorization header:

Authorization: Bearer pt_live_...

Supported Formats

DOCX

Microsoft Word documents with full formatting preservation

PDF

PDF documents with text extraction and layout preservation

EPUB

eBook format with structure and metadata preservation

Rate Limits & Best Practices

Rate Limits

  • •Upload: 5 requests/hour per user/IP
  • •Login: 10 requests/minute per IP
  • •Rate limit headers included in responses
  • •429 status code when limit exceeded

Best Practices

  • •Store API keys in environment variables
  • •Implement exponential backoff for retries
  • •Poll status every 10-30 seconds
  • •Handle errors gracefully with try/catch

Ready to Get Started?

Create a free account to get your API key and start translating documents programmatically.