Menú

How to Configure Google Cloud Translation API v3 & Download JSON Credentials

Here is a step-by-step guide to configuring the Google Cloud Translation API v3 and generating the necessary Service Account JSON key.

This guide is designed for the Google Cloud Console interface as of late 2025.

Prerequisites

  • A Google Cloud Platform (GCP) account.
  • Billing must be enabled on your Google Cloud project (even though the API has a free tier, Google requires a linked billing instrument to enable the service).

Step 1: Create a New Project

If you already have a project, skip to Step 2.

  • Go to the Google Cloud Console.
  • Click the Project Dropdown at the top left of the page (next to the Google Cloud logo).
  • Click New Project.
  • Enter a Project Name (e.g., Translation-App).
  • Click Create.

Important: Once the notification says the project is ready, click Select Project to ensure you are working inside the correct workspace.

Step 2: Enable the Cloud Translation API

You must explicitly turn on the API for your specific project.

  • In the left sidebar, go to APIs & Services > Library.
  • In the search bar, type Cloud Translation API and press Enter.
  • Click on the result named Cloud Translation API.
  • Click the blue Enable button.

Step 3: Create a Service Account

The Service Account acts as a "robot user" that allows your application to access the API securely.

In the left sidebar, navigate to IAM & Admin > Service Accounts.

Click the + CREATE SERVICE ACCOUNT button at the top of the page.

Fill in the Service account details:

  • Service account name: Enter a descriptive name. Example: translation-app-connector
  • Service account ID: This field automatically generates the email address for the bot. You can stick with the default. Example preview: translation-app-connector@chrome-orb-460001.iam.gserviceaccount.com
  • Description (Optional): You can write "Used for Translation API v3 integration".

Click CREATE AND CONTINUE.

Step 4: Grant Permissions 

You must define what this specific "robot user" is allowed to do. Without this step, your API calls will fail with a "Permission Denied" error.

  • You will see the "Permissions" section.
  • Click the Select a role field (it looks like a search box).
  • Type Cloud Translation in the filter.
  • Select the role Cloud Translation API User from the list.
  • Click CONTINUE.
  • Click DONE at the bottom (you can safely skip the "Principals with access" step).

Step 5: Create and Download the JSON Key

This is the final step to generate the credential file required for your code.

  • You will be redirected back to the Service Accounts list. You should see your new account listed there.
  • Look for the Service Account ID created in Step 3, for example: translation-app-connector@chrome-orb-460001.iam.gserviceaccount.com
  • Click on that email address to open the details page.
  • Click the KEYS tab in the top navigation bar (next to "DETAILS" and "PERMISSIONS").
  • Click the ADD KEY drop-down button and select Create new key.
  • Select JSON as the Key type (this is the default selection).
  • Click CREATE.

 

Result: A file will immediately download to your computer. Example filename: chrome-orb-460001-57e86663afb8.json

File content preview: If you open this file with a text editor (like Notepad or VS Code), it will look like this:

{

  "type": "service_account",

  "project_id": "chrome-orb-460001",

  "private_key_id": "57e86663afb8...",

  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAaS...\n-----END PRIVATE KEY-----\n",

  "client_email": "translation-app-connector@chrome-orb-460001.iam.gserviceaccount.com",

  "client_id": "11223344556677889900",

  "auth_uri": "https://accounts.google.com/o/oauth2/auth",

  "token_uri": "https://oauth2.googleapis.com/token"

}

⚠️ Important Security Note

This JSON file contains your private key. Do not share it, do not take a screenshot of its content, and never commit it to a public GitHub repository.

Recuento de vistas: 49 vistas