Skip to content
Latchkey

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"}.

Render API
< 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

  1. Create an API key in Render Account Settings, API Keys.
  2. Store it as a CI secret named RENDER_API_KEY.
  3. Send it as a Bearer token in the Authorization header.
Terminal
curl -X POST \
  -H "Authorization: Bearer $RENDER_API_KEY" \
  https://api.render.com/v1/services/$SERVICE_ID/deploys

Use 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_KEY in CI secrets.
  • Use a key from the account that owns the service.
  • Rotate the key on a schedule and update the secret centrally.

Frequently asked questions

What causes "Render API "401 Unauthorized""?
The RENDER_API_KEY was not set in the step, or the key is wrong or revoked, so Render returns 401.
How do I fix Render API "401 Unauthorized"?
Send a valid API key

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card