google / google/generative-ai-docs

Encountering a "Permission denied" error while using an API

Open
#356 2 comments 0 reactions 0 assignees View on GitHub
component:support status:triaged type:bug
Dominant language
Jupyter Notebook
Stars
2.3k
Forks
735
PR merge metrics
No merged PRs in 30d

Description

### Description of the bug:

When encountering a "Permission denied" error while using an API, does it imply that there's an issue with my account? Could you please advise on how to resolve this problem?

```
curl \
-H 'Content-Type: application/json' \
-d '{"contents":[{"parts":[{"text":"Write a story about a magic backpack"}]}]}' \
-X POST 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=AIzaSyAhTarnL1PaQn_yu_uVf0gia9wUyJx8RSI'
{
"error": {
"code": 403,
"message": "Permission denied: Consumer 'api_key:AIzaSyAhTarnL1PaQn_yu_uVf0gia9wUyJx8RSI' has been suspended.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CONSUMER_SUSPENDED",
"domain": "googleapis.com",
"metadata": {
"service": "generativelanguage.googleapis.com",
"consumer": "projects/578829824020"
}
}
]
}
}
```

### Actual vs expected behavior:

_No response_

### Any other information you'd like to share?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.