Can’t use Cursor Admin API.
Already have admin permissions on our team.
Keep getting this response on any request from this page Admin API | Cursor Docs
{“statusCode”:401,“error”:“Unauthorized”,“message”:“Invalid API key”}
Hey there! This is most likely an issue with the API key and how it’s being passed in. From the API docs, it’s passed in as a username with no password as basic auth.
Basic auth is just an authorization header in the format: Authorization: Basic Username:Password (where user:pass is base64 encoded). Since we don’t use a password in the docs, the equivalent JS code would be:
async function getCursorUsageData() {
const response = await fetch('https://api.cursor.com/teams/members', {
headers: {
'Authorization': `Basic ${btoa(YOUR_API_KEY+':')}` //replace KEY with your key
}
});