[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[],[],null,["# Global and multi-regional endpoints\n===================================\n\nCloud Translation - Advanced offers a global endpoint as well as EU and US\nmulti-regional endpoints:\n\n- `translate.googleapis.com` (global)\n- `translate-eu.googleapis.com`\n- `translate-us.googleapis.com`\n\nIf you use a multi-regional endpoint, your data at-rest and machine learning\nprocessing stays within the continental boundaries of the EU or US. These\nmulti-regional endpoints are important if your data's location must be\ncontrolled to comply with local regulatory requirements.\n\nIf you don't specify an endpoint, Cloud Translation - Advanced uses the global\nendpoint by default.\n\nGlobal versus multi-regional endpoints\n--------------------------------------\n\nWhen using a multi-regional endpoint, there are some difference when compared to\nusing the global endpoint:\n\n- Text translations that use custom AutoML models are not supported. You can use only the pre-trained NMT model.\n- Features that are not GA (still in [Preview](/products#product-launch-stages)) are not supported.\n- Calls through the global endpoint cannot access resources that were created by using a multi-regional endpoint. Similarly, calls through a multi-regional endpoint cannot access resources that were created by using the global endpoint.\n\nRestricting resource locations\n------------------------------\n\nOrganization policy administrators can restrict the regions available for\nCloud Translation - Advanced resources by [creating a resource locations\nconstraint](/resource-manager/docs/organization-policy/defining-locations). If\nset, Cloud Translation - Advanced users would be able to create resources only in a\nparticular location.\n\nRestricting global API endpoint usage\n-------------------------------------\n\nTo help enforce the use of regional endpoints, organization policy\nadministrators can use the `constraints/gcp.restrictEndpointUsage` organization\npolicy constraint to block requests to the global API endpoint. For more\ninformation, see [Restricting endpoint\nusage](/assured-workloads/docs/restrict-endpoint-usage).\n\nSpecify an endpoint\n-------------------\n\nThe following example shows a text translation that uses a multi-regional\nendpoint. If you use the client libraries, set the API endpoint as part of the\nclient options. For some examples, see [Setting the location using client\nlibraries](/natural-language/docs/locations#setting_the_location_using_client_libraries)\nin the Cloud Natural Language API guide. \n\n### REST\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_NUMBER_OR_ID\u003c/var\u003e: the numeric or alphanumeric ID of your Google Cloud project\n- \u003cvar translate=\"no\"\u003eENDPOINT\u003c/var\u003e: Regional endpoint, which determines where your data resides. For example, `translate-eu.googleapis.com`.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: Region where you want to run this operation. You must pick a region inside the continental boundary of the regional endpoint. For example, if you use the `translate-eu.googleapis.com` endpoint, specify a region in Europe such as `europe-west1`.\n\n\nHTTP method and URL:\n\n```\nPOST https://ENDPOINT/v3/projects/PROJECT_NUMBER_OR_ID/locations/LOCATION:translateText\n```\n\n\nRequest JSON body:\n\n```\n{\n \"model\": \"projects/PROJECT_NUMBER_OR_ID/locations/LOCATION/models/general/base\",\n \"sourceLanguageCode\": \"en\",\n \"targetLanguageCode\": \"de\",\n \"contents\": [\"Come here!\"]\n}\n```\n\nTo send your request, choose one of these options: \n\n#### curl\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) , or by using [Cloud Shell](/shell/docs), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\ncurl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"x-goog-user-project: PROJECT_NUMBER_OR_ID\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @request.json \\\n \"https://ENDPOINT/v3/projects/PROJECT_NUMBER_OR_ID/locations/LOCATION:translateText\"\n```\n\n#### PowerShell\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\"; \"x-goog-user-project\" = \"PROJECT_NUMBER_OR_ID\" }\n\nInvoke-WebRequest `\n -Method POST `\n -Headers $headers `\n -ContentType: \"application/json; charset=utf-8\" `\n -InFile request.json `\n -Uri \"https://ENDPOINT/v3/projects/PROJECT_NUMBER_OR_ID/locations/LOCATION:translateText\" | Select-Object -Expand Content\n```\n\nYou should receive a JSON response similar to the following:\n\n```\n{\n \"translations\": [\n {\n \"translatedText\": \"Komm her!\",\n \"model\": \"projects/PROJECT_NUMBER_OR_ID/locations/LOCATION/models/general/base\"\n }\n ]\n}\n```\n\n\u003cbr /\u003e"]]