All Products
Search
Document Center

:Authentication

Last Updated:Jul 15, 2026

Authenticate every API request with a Personal Access Token (PAT) in the Authorization header.

Get a PAT

  1. Sign in to the Qoder CN console.

  2. Go to Settings > API Tokens.

  3. Click Create Token, then set a name and permission scopes.

  4. 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.