docsTranslation APITranslate Text

    Translate Text API

    This API translates text, with or without HTML tags, and returns the translation in the response.

    Basics

    • Method: POST
    • Endpoint: https://api.bluente.com/api/20250924/blu_translate/text
    • Auth: Authorization: Bearer $BLUENTE_API_KEY

    Body Parameters

    FieldTypeRequiredDescription
    fromstringYesSource language code
    tostringYesTarget language code
    textstringYesText of translation

    Limits

    • text can be at most 10,000 characters per request. Characters are counted, not bytes, so each Chinese character counts as one.
    • Free accounts get 10 successful text translations in total, shared with text translation in the Bluente web app. Failed requests do not count. Paid accounts have no limit.

    Examples

    Start Translation

    curl -X POST "https://api.bluente.com/api/20250924/blu_translate/text" \
      -H "Authorization: Bearer $BLUENTE_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "from": "en",
        "to": "zh",
        "text": "<a href=\"https://example.com\" target=\"_blank\" rel=\"noopener\">Link text</a>\n<div class=\"container\" id=\"main\" data-value=\"123\">Content</div>"
      }'

    Response Examples

    Success:

    {
      "message": "success",
      "code": 0,
      "data": {
            "text":"<html><head></head><body><a href=\"https://example.com\" rel=\"noopener\" target=\"_blank\">链接文字</a>\n<div class=\"container\" id=\"main\" data-value=\"123\">内容</div></body></html>"
      }
    }

    Errors:

    Check code to tell errors apart; data is always 40 on errors and has no meaning.

    Invalid language code:

    {
        "message": "source language is not valid",
        "code": 500,
        "data": 40
    }

    Text longer than 10,000 characters:

    {
        "message": "text exceeds 10000 characters",
        "code": 40,
        "data": 40
    }

    Free account has used all 10 text translations:

    {
        "message": "the free plan includes 10 text translations; upgrade to continue",
        "code": 70,
        "data": 40
    }