Google APItranslate.google.com ↗
Translate text between any supported languages using the Google Translate API on Parse. Handles inputs of any length with automatic pagination across 5000-char pages.
What is the Google API?
This API exposes one endpoint, translate_text, which translates a block of text from one language to another using Google Translate, returning 10 structured response fields per page including translated_text, source_lang, target_lang, and pagination metadata. Inputs of any length are automatically split into consecutive pages of up to 5000 characters each, so long documents are fully accessible across multiple requests without manual chunking.
curl -X GET 'https://api.parse.bot/scraper/bb9f8819-dbd0-4662-9f4c-ea4162d6638c/translate_text?text=Hello+world%2C+how+are+you+today%3F+I+hope+everything+is+going+well+with+your+project.&source_lang=en&target_lang=pt' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace translate-google-com-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: Google Translate SDK — translate text with page control."""
from parse_apis.translate_google_com_api import GoogleTranslate, InputFormatInvalid
client = GoogleTranslate()
# Translate a short English sentence to Portuguese (defaults).
result = client.translations.translate(text="Hello world, how are you today?")
print(result.translated_text)
print(f" {result.source_lang} → {result.target_lang}")
# Use auto-detection and a different target language.
result = client.translations.translate(
text="Bonjour le monde",
source_lang="auto",
target_lang="es",
)
print(result.translated_text)
print(f" detected: {result.detected_source_lang}")
# For long texts the API splits into pages; check total_pages and iterate.
long_text = "A very long document... " * 300
first_page = client.translations.translate(text=long_text)
print(f"page {first_page.page}/{first_page.total_pages} chars: {first_page.page_char_count}")
if first_page.has_more:
second_page = client.translations.translate(text=long_text, page=2)
print(f"page {second_page.page}/{second_page.total_pages}")
# Requesting a page beyond the text raises InputFormatInvalid.
try:
client.translations.translate(text="Short text", page=99)
except InputFormatInvalid:
print("caught: page out of range")
print("exercised: translations.translate (default / auto-detect / paging / error)")
Translates a block of text from a source language to a target language. Google Translate accepts at most 5000 characters per request, so the input text is split into consecutive pages of at most 5000 characters (cut at a newline, sentence end, or space when possible) and one page is translated per call. The response carries the translated text of the requested page, the exact source slice it corresponds to, its character offset in the full input, the total page count, and has_more; when has_more is true, call again with the same text and page+1 to continue. page defaults to 1; a page beyond total_pages returns a stale_input error. Paragraph breaks (newlines) in the input are preserved in the translation. source_lang defaults to English (en) and target_lang defaults to Portuguese (pt); source_lang may be 'auto' to let the site detect the language, in which case source_lang/detected_source_lang in the response report the detected code. An unsupported target code is not rejected by the site and returns the text unchanged. One round trip per page.
| Param | Type | Description |
|---|---|---|
| page | integer | 1-based page of the input to translate, each page covering at most 5000 characters of the input. Omitted = first page. |
| textrequired | string | The text to translate. Any length; texts longer than 5000 characters are served across several pages. |
| source_lang | string | ISO language code of the input text (e.g. en, fr, pt-BR) or 'auto' for automatic detection. |
| target_lang | string | ISO language code of the desired output language (e.g. pt, es, pt-BR). |
{
"type": "object",
"fields": {
"page": "integer, the page translated",
"has_more": "boolean, true when further pages remain",
"source_lang": "language code the translation was made from (detected code when source_lang was auto)",
"source_text": "the exact slice of the input text this page covers",
"target_lang": "language code of the translation",
"total_pages": "integer, number of pages the full input spans",
"page_char_count": "integer, characters of input covered by this page",
"translated_text": "translation of this page's source slice, newlines preserved",
"total_char_count": "integer, length of the full input text",
"max_chars_per_page": "integer, the site's per-request character limit (5000)",
"source_char_offset": "integer, 0-based offset of this page's slice in the full input",
"detected_source_lang": "language code the site detected for the input, or null when not reported"
},
"sample": {
"data": {
"page": 1,
"has_more": false,
"source_lang": "en",
"source_text": "Hello world, how are you today? I hope everything is going well with your project.",
"target_lang": "pt",
"total_pages": 1,
"page_char_count": 82,
"translated_text": "Olá mundo, como você está hoje? Espero que tudo esteja indo bem com seu projeto.",
"total_char_count": 82,
"max_chars_per_page": 5000,
"source_char_offset": 0,
"detected_source_lang": "en"
},
"status": "success"
}
}About the Google API
What the API Returns
The translate_text endpoint accepts a required text parameter of any length and returns the translated output in translated_text, along with the source_lang and target_lang codes used for that page. When source_lang is set to auto, the response reflects the detected language in the source_lang field. Each response also includes page_char_count (how many input characters this page covers) and total_char_count (the full input length).
Pagination for Long Texts
Because Google Translate enforces a 5000-character limit per request, the API handles this transparently through a page-based model. The total_pages field tells you how many pages the full input spans, and has_more is true whenever further pages remain. Request each subsequent page by passing the page parameter (1-based). Page boundaries are cut at newlines, sentence ends, or spaces where possible to avoid mid-word splits. The max_chars_per_page field in every response confirms the 5000-character ceiling.
Language Codes
Both source_lang and target_lang accept standard ISO language codes such as en, fr, pt, or regional variants like pt-BR and zh-CN. Omitting source_lang or passing auto triggers automatic language detection. The detected code is always returned in the response source_lang field, making it useful for language identification workflows independently of translation needs.
The Google API is a managed, monitored endpoint for translate.google.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when translate.google.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official translate.google.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Translating user-submitted content into a target language for multilingual product interfaces using
target_lang - Detecting the language of incoming text by passing
source_lang: autoand reading thesource_langfield in the response - Paginating through a long-form document by iterating
pageuntilhas_morereturns false - Building a batch translation pipeline that uses
total_pagesandtotal_char_countto pre-calculate job size - Localizing news articles or blog posts into multiple languages by calling
translate_textwith differenttarget_langvalues - Identifying whether user input is in the expected language before processing it downstream
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 200 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
| Team | $300/mo | 20,000 | 300 req/min |
| Company | $1,000/mo | 100,000 | 500 req/min |
Each endpoint has a fixed posted price per successful call — most fall between 1 and 10 credits — shown on this API's page before you run it. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does Google Translate have an official developer API?+
What does the `has_more` field tell me, and when do I need the `page` parameter?+
has_more is true in any page response where subsequent pages exist. Pass the page parameter (starting at 1) to retrieve each page in sequence. total_pages tells you the exact number of requests needed to cover the full input.Does the API return word-level or sentence-level translation confidence scores?+
translated_text string for each page along with the detected or specified source_lang, but does not expose per-word, per-sentence, or aggregate confidence scores. You can fork this API on Parse and revise it to add a confidence or quality-scoring endpoint if that data becomes accessible.Can I translate HTML or rich-text content and preserve formatting tags?+
text parameter accepts plain strings. The API preserves newlines in translated_text as documented, but HTML tag preservation behavior depends on how the underlying service handles markup in the input. Structured document translation with guaranteed tag fidelity is not a defined feature of this endpoint. You can fork it on Parse and revise to add an endpoint that handles HTML-mode translation.Is automatic language detection reliable for short inputs?+
source_lang: auto, provide at least a full sentence. The detected code is always returned in the source_lang response field regardless of input length.