Render API "401 Unauthorized" (API key) in CI
A CI call to the Render API was rejected with 401 because the bearer token was absent or invalid. Render API requests must send a valid API key in the Authorization header.
What this error means
A curl or action that triggers a Render deploy returns HTTP 401 with a body like {"message":"Unauthorized"}.
< HTTP/2 401
{"message":"Unauthorized"}Common causes
Missing or invalid API key
The RENDER_API_KEY was not set in the step, or the key is wrong or revoked, so Render returns 401.
The key cannot access the service
The key belongs to a different account or workspace than the service, so the authenticated request is still unauthorized for it.
How to fix it
Send a valid API key
- Create an API key in Render Account Settings, API Keys.
- Store it as a CI secret named
RENDER_API_KEY. - Send it as a Bearer token in the Authorization header.
curl -X POST \
-H "Authorization: Bearer $RENDER_API_KEY" \
https://api.render.com/v1/services/$SERVICE_ID/deploysUse the right account and service
Confirm the key belongs to the account that owns the service ID you target.
How to prevent it
- Keep
RENDER_API_KEYin CI secrets. - Use a key from the account that owns the service.
- Rotate the key on a schedule and update the secret centrally.