CircleCI API doesn't work as documented

In the CircleCI documentation, for API v2, the examples given show to use just the “Authorization” header to authenticate. But this doesn’t work.

For example, in listing checkout keys (CircleCI API), it says that this command should work:

curl --request GET \
  --url \
  --header 'authorization: Basic REPLACE_BASIC_AUTH'

But in fact what you get back is:

  "message" : "Project not found"

You actually have to pass the old v1 API’s “Circle-Token” header, and then your request works:

curl -H "Circle-Token: your-token-here"
  "next_page_token" : null,
  "items" : [ {
    "type" : "deploy-key",
    "preferred" : true,
    "created_at" : "2019-07-25T23:48:32.315Z",
    "fingerprint" : "00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff"
  } ]

Tested using BitBucket with private repositories.

Hi @pwillis-eiq,

The Circle-Token is in no way “old”. It’s also listed in the CircleCI API v2 documentation (CircleCI API).

When using the 'authorization: Basic REPLACE_BASIC_AUTH' header, REPLACE_BASIC_AUTH should be the base64-encoded value of the raw personal API token.