Skip to main content

Using 'Basic' Authentication in CircleCI API Calls

Basic Authentication

You can use Basic Authentication for our CircleCI V2 APIs:

Please note that this would require you to:

  • set the username value to your CircleCI user API token, and

  • (optional) set the password as empty

Examples

The following examples use `curl` , but you can adjust according to your HTTP library.

curl -X GET -u "${CIRCLE_TOKEN}:" https://circleci.com/api/v2/me
BASIC_AUTH=$(echo -n "${CIRCLE_TOKEN}:" | base64)curl -H "Authorization: Basic ${BASIC_AUTH}" https://circleci.com/api/v2/me
# example without setting password for Basic Authentication
# Note the `:` is not set here
curl -H "Authorization: Basic $(echo -n $CIRCLE_TOKEN | base64)" https://circleci.com/api/v2/me
Did this answer your question?