Skip to main content

Overview

When you try to use a Google Workspace API that hasn’t been enabled in your Google Cloud project, you’ll receive a 403 error with the reason accessNotConfigured.
API enablement can take 10-30 seconds to propagate. Wait briefly before retrying your command.

Error Example

When running a command like gws gmail users messages list, you might see:
{
  "error": {
    "code": 403,
    "message": "Gmail API has not been used in project 549352339482 ...",
    "reason": "accessNotConfigured",
    "enable_url": "https://console.developers.google.com/apis/api/gmail.googleapis.com/overview?project=549352339482"
  }
}
The CLI also prints a helpful hint to stderr:
💡 API not enabled for your GCP project.
   Enable it at: https://console.developers.google.com/apis/api/gmail.googleapis.com/overview?project=549352339482
   After enabling, wait a few seconds and retry your command.

Solution 1: Use the Enable URL

The error response includes a direct link to enable the API:
  1. Copy the enable_url from the error JSON (or click the link in your terminal)
  2. In the Google Cloud Console, click the Enable button
  3. Wait approximately 10-30 seconds for the change to propagate
  4. Retry your gws command
The enable_url field is automatically generated by Google and includes your project ID.

Solution 2: Run gws auth setup

The gws auth setup command automates enabling all required APIs for your project:
gws auth setup
This interactive wizard will:
  • Create a Google Cloud project (if needed)
  • Enable all commonly-used Google Workspace APIs
  • Configure OAuth consent screen
  • Walk you through authentication
Requires the gcloud CLI to be installed and authenticated.

Solution 3: Manual Console Setup

If you prefer to enable APIs manually:
  1. Navigate to the API Library in your Google Cloud project
  2. Search for the API you need (e.g., “Gmail API”, “Google Drive API”)
  3. Click on the API and press Enable
  4. Repeat for any other APIs you plan to use

Common APIs

  • Gmail API - Email operations
  • Google Drive API - File storage and management
  • Google Calendar API - Calendar events
  • Google Sheets API - Spreadsheet operations
  • Google Chat API - Chat messages and spaces
  • Admin SDK - User and domain management

Verification

After enabling the API, verify it works:
# For Gmail
gws gmail users messages list --params '{"userId": "me", "maxResults": 1}'

# For Drive
gws drive files list --params '{"pageSize": 1}'

Still Having Issues?

If you continue to see accessNotConfigured errors after enabling the API:
  1. Check your project ID - Ensure you’re using the correct Google Cloud project
  2. Wait longer - API enablement can occasionally take up to 5 minutes
  3. Clear cache - The CLI caches Discovery documents for 24 hours; restart your terminal
  4. Verify permissions - Ensure your account has the roles/serviceusage.serviceUsageAdmin role on the project
See Common Issues for additional troubleshooting steps.