DEVELOPER

Youdao Translate API Developer Guide

From registration to your first API call — a complete integration tutorial

The Youdao Translate API (Youdao AI Cloud Translation Service) is NetEase Youdao's machine translation interface service for developers, supporting text translation, speech translation, image translation, and document translation. Whether you're an independent developer, startup team, or enterprise client, you can integrate Youdao's translation capabilities into your applications, websites, or workflows through simple HTTP API calls. This guide walks you through the entire process from registration to your first successful API call.

The Youdao Translate API provides HTTP endpoints for machine translation workflows. Supported languages, free quota, pricing, and model details can change, so developers should verify the current API documentation before implementation.

Registration & API Key Setup

Before using the Youdao Translate API, you need to register on the Youdao AI Cloud platform and create an application to obtain your API credentials:

1

Register an Account

Visit the Youdao AI Cloud website (ai.youdao.com) and register using your phone number or email address. Users with existing NetEase accounts can log in directly.

2

Create an Application

After logging in, navigate to the console and click "Create Application." Fill in the application name and description, then select the service types you need (text translation, speech translation, etc.).

3

Obtain API Credentials

Once the application is created, the system automatically generates an App ID and App Key (secret). These credentials are viewable on the application details page. Keep them secure and never expose them publicly.

4

Make Your First Call

Using your App ID and App Key, construct request parameters following the API documentation's signing rules and start making translation API calls.

Making API Calls

Request Parameters

The core text translation endpoint is https://openapi.youdao.com/api. The key request parameters are:

Python Example

Here's a complete Python example for calling the Youdao Translate API:

import hashlib
import uuid
import time
import requests

YOUDAO_URL = 'https://openapi.youdao.com/api'
APP_KEY = 'your_app_key'
APP_SECRET = 'your_app_secret'

def translate(text, from_lang='auto', to_lang='ja'):
    salt = str(uuid.uuid4())
    curtime = str(int(time.time()))
    sign_str = APP_KEY + truncate(text) + salt + curtime + APP_SECRET
    sign = hashlib.sha256(sign_str.encode('utf-8')).hexdigest()

    params = {
        'q': text,
        'from': from_lang,
        'to': to_lang,
        'appKey': APP_KEY,
        'salt': salt,
        'sign': sign,
        'signType': 'v3',
        'curtime': curtime,
    }
    response = requests.post(YOUDAO_URL, data=params)
    return response.json()

def truncate(text):
    if len(text) <= 20:
        return text
    return text[:10] + str(len(text)) + text[-10:]

result = translate('Hello, how are you?', 'en', 'zh-CHS')
print(result['translation'])

Node.js Example

const crypto = require('crypto');
const axios = require('axios');
const { v4: uuidv4 } = require('uuid');

const APP_KEY = 'your_app_key';
const APP_SECRET = 'your_app_secret';
const API_URL = 'https://openapi.youdao.com/api';

function truncate(q) {
  if (q.length <= 20) return q;
  return q.substring(0, 10) + q.length + q.substring(q.length - 10);
}

async function translate(text, from = 'auto', to = 'zh-CHS') {
  const salt = uuidv4();
  const curtime = Math.round(Date.now() / 1000).toString();
  const signStr = APP_KEY + truncate(text) + salt + curtime + APP_SECRET;
  const sign = crypto.createHash('sha256').update(signStr).digest('hex');

  const { data } = await axios.post(API_URL, null, {
    params: { q: text, from, to, appKey: APP_KEY, salt, sign, signType: 'v3', curtime }
  });
  return data;
}

translate('Hello World').then(res => console.log(res.translation));

Pricing & Plans

The Youdao Translate API offers both pay-as-you-go and prepaid pricing:

Speech translation, image translation, and document translation have separate pricing models — refer to the official Youdao AI Cloud documentation for details. The API console provides detailed usage statistics and billing breakdowns, making it easy to monitor and manage your consumption.

Developer Best Practices

  • Secure Your Keys: Never hardcode App Key and App Secret in frontend code or public repositories. Use environment variables or a secret management service
  • Rate Limiting: The API has per-second request limits (10 QPS on free tier). Implement request queuing and retry logic in your client
  • Caching Strategy: Cache translation results locally for repeated content to reduce API calls and costs
  • Error Handling: Always handle API error codes (e.g., 101 for missing parameters, 108 for rate limiting) to ensure application stability
  • Batch Requests: For large volumes, combine text into single requests (respect the current per-request limit shown in the API documentation) to improve throughput

Frequently Asked Questions

What is the API response time?
The Youdao Translate API averages 200-500 milliseconds response time, depending on text length and network conditions. Short texts (under 100 characters) typically return within 200 milliseconds. The service is deployed across multiple data centers ensuring stable, low-latency access. The API maintains a 99.9% availability SLA, making it suitable for production environments with high reliability requirements.
Which programming languages are supported?
The Youdao Translate API is a standard HTTP RESTful interface, callable from any programming language that supports HTTP requests. Official SDKs and code samples are provided for Python, Java, Node.js, PHP, C#, and Go, available in the Youdao AI Cloud documentation center. For other languages (Ruby, Rust, Swift, etc.), simply construct request parameters following the API documentation's signing rules.
How do I troubleshoot signature verification failures?
Signature verification failures (error code 202) typically result from: 1) Extra whitespace copied with App Key or App Secret; 2) Incorrect concatenation order in the sign string (correct order: appKey + input + salt + curtime + appSecret); 3) Incorrect truncate function implementation (for text longer than 20 characters: first 10 chars + length + last 10 chars); 4) curtime not reflecting the current timestamp. We recommend validating with the signing function from the official SDK.

Start Using the Youdao Translate API

1 million characters free monthly — integrate in minutes

⬇ Free Download