--- title: "Doc Translation" slug: "ai-naver-papagodoctranslation" tags: ["Papago Translation"] updated: 2026-09-17T09:57:14Z published: 2026-09-17T09:57:14Z canonical: "api.ncloud-docs.com/ai-naver-papagodoctranslation" --- > ## Documentation Index > Fetch the complete documentation index at: https://api.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # Doc Translation Classic/VPC環境で利用できます。 Papago Doc Translation APIのユースケースを紹介します。 ## 文書を翻訳 文書翻訳のユースケースを説明します。 ### Python Pythonベースの APIのサンプルコードは次の通りです。 ``` import requests from requests_toolbelt import MultipartEncoder import uuid data = { 'source': 'ko', 'target': 'en', 'file': ('a.docx', open('a.docx', 'rb'), 'application/octet-stream', {'Content-Transfer-Encoding': 'binary'}) } m = MultipartEncoder(data, boundary=uuid.uuid4()) headers = { "Content-Type": m.content_type, "X-NCP-APIGW-API-KEY-ID": ユーザー_クライアント_ID, "X-NCP-APIGW-API-KEY": ユーザー_クライアント_シークレット } url = "https://papago.apigw.ntruss.com/doc-trans/v1/translate" res = requests.post(url, headers=headers, data=m.to_string()) print(res.text) ``` ## 文書の翻訳状態を確認 文書翻訳の状態確認のユースケースを説明します。 ### Python Pythonベースの APIのサンプルコードは次の通りです。 ``` import requests headers = { "X-NCP-APIGW-API-KEY-ID": ユーザー_クライアント_ID, "X-NCP-APIGW-API-KEY": ユーザー_クライアント_シークレット } url = "https://papago.apigw.ntruss.com/doc-trans/v1/status?requestId=" + RequestId res = requests.get(url, headers=headers) print(res.text) ``` ## 文書翻訳の結果をダウンロード 文書翻訳結果のダウンロードのユースケースを説明します。 ### Python Pythonベースの APIのサンプルコードは次の通りです。 ``` import urllib.request url = "https://papago.apigw.ntruss.com/doc-trans/v1/download?requestId=" + RequestId opener = urllib.request.build_opener() opener.addheaders = [('X-NCP-APIGW-API-KEY-ID', ユーザー_クライアント_ID), ('X-NCP-APIGW-API-KEY', ユーザー_クライアント_シークレット)] urllib.request.install_opener(opener) urllib.request.urlretrieve(url, "b.docx") ```