Skip to main content
Every request to the RollingGo API must be authenticated with your API Key passed as a Bearer token in the Authorization header. Requests that are missing this header, or that supply an invalid key, are rejected with a 401 response before any processing occurs.

How to Authenticate

Add your API Key to the Authorization header of every request using the Bearer scheme.

Raw HTTP

JavaScript (Fetch)

auth-example.js

Python

auth-example.py

API Key Format

RollingGo API Keys follow a consistent naming convention that makes it easy to identify their environment at a glance:
China Mainland keys use the same rg_live_ and rg_test_ prefixes but are bound exclusively to the .cn endpoints (https://api.rollinggo.cn/v1). Using a China key against the international endpoint — or vice versa — results in an invalid_key error.

Authentication Errors

The table below covers every authentication-related error you may encounter, along with its root cause and the recommended fix.

Security Best Practices

Follow these practices to keep your API Keys secure:
  • Use environment variables. Store keys in environment variables or a secrets manager — never hardcode them in source files.
  • Keep keys server-side. Never include an API Key in code that is bundled or served to end users.
  • Rotate compromised keys immediately. If a key is exposed, regenerate it in your dashboard under Settings → API Keys and revoke the old one.
  • Use one key per environment. Create separate keys for development, staging, and production to limit blast radius if one is compromised. You can create additional keys in your dashboard under Settings → API Keys.
Do not include your API Key in client-side JavaScript served to end users. Keys embedded in frontend bundles are publicly visible and can be extracted, stolen, and misused. Always make RollingGo API calls from your server or a secure backend function.

Next Steps

Manage API Keys

Find, create, and regenerate your API Keys in the Partner Center.

API Overview

Review base URLs, response formats, and all available endpoints.