401 Unauthorized when accessing REST API (rest.runpod.io/v1) despite API key having ALL permissions
Hello,
We're getting a 401 Unauthorized error when using the REST API (rest.runpod.io/v1) to manage serverless endpoints, even though our API key has Read/Write permissions enabled.
What we're trying to do:
Update workersMin and workersMax for a serverless endpoint via the REST API
Using: PATCH /endpoints/{endpointId} or POST /endpoints/{endpointId}/update
What works:
The same API key works with api.runpod.ai/v2 (Serverless API) for submitting jobs
API key has "All" or "Read/Write" permissions enabled in the dashboard
What doesn't work:
GET https://rest.runpod.io/v1/endpoints/{endpointId} → 401 Unauthorized
PATCH https://rest.runpod.io/v1/endpoints/{endpointId} → 401 Unauthorized
POST https://rest.runpod.io/v1/endpoints/{endpointId}/update → 401 Unauthorized
Request format:
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.get("https://rest.runpod.io/v1/endpoints/{endpointId}", headers=headers)
Returns: 401 Unauthorized
Questions:
Does rest.runpod.io/v1 require separate permissions from api.runpod.ai?
Is REST API access included in the "All" permission level, or does it need explicit enablement?
Are there account-tier restrictions for REST API access?
Is there a different authentication method for the REST API?
We need to programmatically adjust worker counts for auto-scaling. Any guidance is appreciated.
Thanks!
We're getting a 401 Unauthorized error when using the REST API (rest.runpod.io/v1) to manage serverless endpoints, even though our API key has Read/Write permissions enabled.
What we're trying to do:
Update workersMin and workersMax for a serverless endpoint via the REST API
Using: PATCH /endpoints/{endpointId} or POST /endpoints/{endpointId}/update
What works:
The same API key works with api.runpod.ai/v2 (Serverless API) for submitting jobs
API key has "All" or "Read/Write" permissions enabled in the dashboard
What doesn't work:
GET https://rest.runpod.io/v1/endpoints/{endpointId} → 401 Unauthorized
PATCH https://rest.runpod.io/v1/endpoints/{endpointId} → 401 Unauthorized
POST https://rest.runpod.io/v1/endpoints/{endpointId}/update → 401 Unauthorized
Request format:
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.get("https://rest.runpod.io/v1/endpoints/{endpointId}", headers=headers)
Returns: 401 Unauthorized
Questions:
Does rest.runpod.io/v1 require separate permissions from api.runpod.ai?
Is REST API access included in the "All" permission level, or does it need explicit enablement?
Are there account-tier restrictions for REST API access?
Is there a different authentication method for the REST API?
We need to programmatically adjust worker counts for auto-scaling. Any guidance is appreciated.
Thanks!