Authentication
The Jules REST API uses API keys for authentication. You’ll need a valid API key to make API requests.
Getting Your API Key
Section titled “Getting Your API Key”- Go to jules.google.com/settings
- Find the API Key section
- Click Generate API Key (or copy your existing key)
- Store the key securely — it won’t be shown again
Keep your API key secret. Don’t commit it to version control or share it publicly.
Using Your API Key
Section titled “Using Your API Key”Include the API key in the x-goog-api-key header with every request:
curl -H "x-goog-api-key: YOUR_API_KEY" \ https://jules.googleapis.com/v1alpha/sessionsEnvironment Variable (Recommended)
Section titled “Environment Variable (Recommended)”Store your API key in an environment variable:
export JULES_API_KEY="your-api-key-here"Then use it in requests:
curl -H "x-goog-api-key: $JULES_API_KEY" \ https://jules.googleapis.com/v1alpha/sessionsExample: Create a Session
Section titled “Example: Create a Session”curl -X POST \ -H "x-goog-api-key: $JULES_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "Add unit tests for the utils module", "sourceContext": { "source": "sources/github-owner-repo", "githubRepoContext": { "startingBranch": "main" } } }' \ https://jules.googleapis.com/v1alpha/sessionsExample: List Sessions
Section titled “Example: List Sessions”curl -H "x-goog-api-key: $JULES_API_KEY" \ https://jules.googleapis.com/v1alpha/sessionsTroubleshooting
Section titled “Troubleshooting””API key not valid”
Section titled “”API key not valid””- Verify you copied the entire key without extra spaces
- Check that the key hasn’t been revoked in settings
- Generate a new key if needed
”Permission denied”
Section titled “”Permission denied””- Verify your account has access to Jules
- Check that you have access to the requested resources (sessions, sources)
“Quota exceeded”
Section titled ““Quota exceeded””- You may have hit rate limits