API Credentials Setup Guide - Candidate Screening Workflow

This guide walks you through setting up all the API credentials needed for the Candidate Screening AI Agent workflow in n8n Cloud.

Prerequisites


Overview of Required Credentials

This workflow requires 3 types of credentials:

  1. Google Gemini API - For AI-powered resume analysis
  2. Gmail OAuth2 - For sending email notifications
  3. Google Sheets OAuth2 - For logging candidates to a spreadsheet

Visual Reference: When you open the Credentials section in n8n Cloud, you'll see:

Documentation: n8n Credentials Documentation - General guide on creating and editing credentials


Step 1: Set Up Google Gemini API Credentials

The Google Gemini API is used by the AI Agent to analyze resumes and rate candidates.

📸 What You'll See: The n8n credentials interface shows a searchable list of available integrations. When you search for "Google Gemini" or "Google PaLM", you'll see a credential type with a simple API key input field.

1.1 Get Your Google Gemini API Key

  1. Go to Google AI Studio or Google Cloud Console
  2. Sign in with your Google account
  3. Navigate to APIs & Services → Credentials
  4. Click + CREATE CREDENTIALS → API Key
  5. Copy your API key (you'll need this in n8n)
  6. Important: Restrict the API key to "Generative Language API" for security

1.2 Add Credentials in n8n Cloud

  1. Log in to your n8n Cloud account
  2. Click on your profile icon (top right) → Settings
  3. Navigate to Credentials in the left sidebar
  4. Click + Add Credential
  5. Search for "Google Gemini" or "Google PaLM"
  6. Select Google Gemini (PaLM) API
  7. Enter a name for your credential (e.g., "Google Gemini API Key")
  8. Paste your API key in the API Key field
  9. Click Save

✅ Test: You can test the connection by clicking "Test" if available.

📸 Visual Guide:


Step 2: Set Up Gmail OAuth2 Credentials

Gmail credentials are used to send two types of emails:

📸 What You'll See: The Gmail OAuth2 setup in n8n displays a form with OAuth Redirect URL, Client ID, and Client Secret fields. A yellow banner provides helpful instructions about using the redirect URL in Google Cloud Console.

2.1 Create OAuth 2.0 Credentials in Google Cloud Console

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Navigate to APIs & Services → Credentials
  4. Click + CREATE CREDENTIALS → OAuth client ID
  5. If prompted, configure the OAuth consent screen:
  1. Back in Credentials, click + CREATE CREDENTIALS → OAuth client ID
  2. Choose Web application as the application type
  3. Name it: "n8n Gmail OAuth"
  4. Under Authorized redirect URIs, add:
   https://app.n8n.cloud/rest/oauth2-credential/callback

(If using self-hosted n8n, use your n8n URL instead)

  1. Click Create
  2. Copy both the Client ID and Client Secret (you'll need these)

2.2 Enable Gmail API

  1. In Google Cloud Console, go to APIs & Services → Library
  2. Search for "Gmail API"
  3. Click on it and press Enable

2.3 Add Gmail Credentials in n8n Cloud

  1. In n8n Cloud, go to Settings → Credentials
  2. Click + Add Credential
  3. Search for "Gmail"
  4. Select Gmail OAuth2 API
  5. Enter a name (e.g., "My Gmail Account")
  6. Fill in the fields:
  1. Click Connect my account
  2. You'll be redirected to Google to authorize n8n
  3. Select your Gmail account and click Allow
  4. You'll be redirected back to n8n
  5. Click Save

✅ Test: The credential should now show as connected.

📸 Visual Guide:


Step 3: Set Up Google Sheets OAuth2 Credentials

Google Sheets credentials are used to automatically log candidate information and AI ratings.

📸 What You'll See: Similar to Gmail, the Google Sheets OAuth2 credential form shows the redirect URL, Client ID, and Client Secret fields. The interface includes a reminder to enable the Google Sheets API in Google Cloud Console.

3.1 Create OAuth 2.0 Credentials for Google Sheets

  1. In Google Cloud Console, go to APIs & Services → Credentials
  2. Click + CREATE CREDENTIALS → OAuth client ID
  3. Choose Web application
  4. Name it: "n8n Google Sheets OAuth"
  5. Under Authorized redirect URIs, add:
   https://app.n8n.cloud/rest/oauth2-credential/callback
  1. Click Create
  2. Copy both the Client ID and Client Secret

3.2 Enable Google Sheets API

  1. In Google Cloud Console, go to APIs & Services → Library
  2. Search for "Google Sheets API"
  3. Click on it and press Enable

3.3 Add Google Sheets Credentials in n8n Cloud

  1. In n8n Cloud, go to Settings → Credentials
  2. Click + Add Credential
  3. Search for "Google Sheets"
  4. Select Google Sheets OAuth2 API
  5. Enter a name (e.g., "My Google Sheets")
  6. Fill in the fields:
  1. Click Connect my account
  2. Authorize n8n to access Google Sheets
  3. Click Save

✅ Test: The credential should now show as connected.

📸 Visual Guide:


Step 4: Prepare Your Google Sheet

Before using the workflow, create a Google Sheet with the following columns:

  1. Open Google Sheets
  2. Create a new spreadsheet
  3. Name it: "Candidate Screening Results"
  4. Add these column headers in Row 1:
  1. Copy the Spreadsheet ID from the URL:
   https://docs.google.com/spreadsheets/d/[SPREADSHEET_ID]/edit
  1. You'll use this ID when configuring the Google Sheets node in the workflow

Step 5: Assign Credentials to Workflow Nodes

Once all credentials are set up, you need to assign them to the workflow nodes:

5.1 Import the Candidate Screening Workflow

  1. In n8n Cloud, click + Add workflow
  2. Click the ⋮ menu (three dots) → Import from File
  3. Upload the Candidate Screening.json file
  4. The workflow will import with placeholder credentials

5.2 Assign Google Gemini Credentials

  1. Click on the "Google Gemini Chat Model" node
  2. In the Credential dropdown, select your Google Gemini credential
  3. The node should now show your credential name

5.3 Assign Gmail Credentials

  1. Click on the "Confirmation of CV Submission" node
  2. In the Credential dropdown, select your Gmail OAuth2 credential
  3. Repeat for the "Inform HR New CV Received" node

5.4 Assign Google Sheets Credentials

  1. Click on the "Candidate Lists" node
  2. In the Credential dropdown, select your Google Sheets OAuth2 credential
  3. Update the Document ID field with your spreadsheet ID from Step 4

Troubleshooting

Issue: "Invalid API Key" for Google Gemini

Solution:

Issue: "OAuth2 connection failed" for Gmail/Sheets

Solution:

Issue: "Permission denied" when writing to Google Sheets

Solution:

Issue: "Email not sending" from Gmail

Solution:


Security Best Practices

  1. Restrict API Keys: Limit your Google Gemini API key to only the APIs you need
  2. Use OAuth2: Always use OAuth2 for Gmail and Google Sheets (more secure than API keys)
  3. Regular Rotation: Rotate your API keys periodically
  4. Monitor Usage: Check Google Cloud Console regularly for unexpected API usage
  5. Limit Scope: Only grant the minimum permissions needed (e.g., gmail.send only, not full Gmail access)

Quick Checklist

Before running the workflow, verify:


Next Steps

Once all credentials are set up:

  1. Test the workflow by submitting a test application through the form
  2. Customize the AI prompt in the "Using AI Analysis & Rating" node for your specific job requirements
  3. Update email addresses in the Gmail nodes to match your HR team
  4. Share the form link from the "Application Form" node with candidates

Need Help?

If you encounter issues:

  1. Check the n8n documentation
  2. Review the n8n community forum
  3. Verify all APIs are enabled in Google Cloud Console
  4. Double-check redirect URIs match exactly

Congratulations! You're now ready to use the AI Candidate Screening workflow. 🎉