Fix: GitHub Copilot Enterprise HTTP 421 Misdirected Request
Provider: github-copilot
Request sent to: https://api.github.com/copilot_internal/v2/token
GitHub Copilot Enterprise accounts use organization-specific API routing. OpenClaw's default Copilot configuration points to the standard endpoint which works for individual accounts but returns HTTP 421 for Enterprise accounts. The fix is to configure the organization endpoint and use an enterprise-scoped access token.
Next Step
Fix now, then reduce repeat incidents
If this issue keeps coming back, validate your setup in Doctor first, then harden your config.
Jump to Fix
Step 1: Confirm You Have a Copilot Enterprise Account
# List your Copilot access details
gh api user/copilot_business
# Or check organizations with Copilot Enterprise
gh api user/orgs --jq '.[].login' | xargs -I{} gh api orgs/{}/copilot 2>/dev/nullIf the response includes "copilot_for_business" or references an organization, you have Enterprise access and need the org-specific config below.
Step 2: Create an Enterprise-Scoped Personal Access Token
Go to github.com โ Settings โ Developer settings โ Personal access tokens โ Fine-grained tokens. Create a new token with:
- Resource owner: your organization (not personal)
- Repository access: All repositories (or specific ones)
- Permissions: Copilot Editor Chat (read) or GitHub Copilot Business
Classic PATs with copilot scope also work. Fine-grained tokens provide better auditability for enterprise accounts. Your organization admin may need to approve the token.
Step 3: Configure the Organization Endpoint in openclaw.json
{
"model": "copilot/gpt-4o",
"providers": {
"github-copilot": {
"enabled": true,
"organizationUrl": "https://api.github.com/orgs/YOUR_ORG"
}
},
"credentials": {
"github": {
"token": "github_pat_..."
}
}
}Step 4: Test the Connection
# Test with your PAT and org curl -s -H "Authorization: Bearer github_pat_..." -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/orgs/YOUR_ORG/copilot/metrics" | head -30 # Then restart the gateway openclaw gateway restart
A 200 response from the curl test confirms your token and org URL are correct. OpenClaw will use the same credentials. If you still see 421, confirm that the PAT resource owner is set to the organization, not your personal account.
Related API & auth issues
Fix It Faster With Our Tools
Did this guide solve your problem?