Authenticate every API request with a Personal Access Token (PAT) in the Authorization header.
Get a PAT
-
Sign in to the Qoder CN console.
-
Go to Settings > API Tokens.
-
Click Create Token, then set a name and permission scopes.
-
Copy the token immediately — it is shown only once.
A PAT uses the pt- prefix (for example, pt-your-token-here). Never commit tokens to source control or share them publicly.
Bearer header format
Pass the PAT in the Authorization header using the Bearer scheme:
Authorization: Bearer pt-your-token-here
Example — list agents:
curl -s "https://api.qoder.com.cn/api/v1/cloud/agents" \
-H "Authorization: Bearer $QODER_PAT"
Store the PAT in an environment variable
Avoid hard-coding your token. Export it as an environment variable instead:
# Add to ~/.bashrc or ~/.zshrc
export QODER_PAT="pt-your-token-here"
# Quick verification
curl -s "https://api.qoder.com.cn/api/v1/cloud/agents?limit=1" \
-H "Authorization: Bearer $QODER_PAT"
Security best practices
-
Issue separate tokens for development, staging, and production.
-
Rotate tokens on a regular schedule.
-
Grant only the scopes each token actually needs (least privilege).
-
Revoke any compromised token immediately from the console.