An HTTP 403: Forbidden error means the API understood the request, but is refusing to authorize it. This is distinct from an authentication error (401: Unauthorized), in that the authentication credentials are correct, but there is some other reason the request is not authorized.
This happens when the API token doesn't have the scope the call needs. Every API call needs one scope:
| Scope | API calls |
|---|---|
account:read | Listing and reading plans, spaces and releases |
clusters:read | Listing and reading clusters |
clusters:write | Creating, updating and deleting clusters |
Example
A call that needs a scope the token doesn't have results in a response like this one, from a token without clusters:write trying to create a cluster:
The message names the missing scope. The "status": 403 key indicates that the error is indeed an HTTP 403: Forbidden error.
Troubleshooting
If the error names a missing scope, the token can't be changed to add it: create a new token with that scope, switch your application to it, then revoke the old one. Your role on the account limits which scopes you can give a token; for example, only admins can give a token clusters:write. If the scope is disabled on the new token form, ask an admin of the account to create the token.
If the error doesn't name a scope, it says This action is not available to API tokens. Please reach out to us with the request you made.
Ready to power your search with AI?
Launch a fully managed Elasticsearch or OpenSearch cluster, with built-in vector search and AI capabilities.