API authentication

1 minute readReference

CloudBees CI requires authentication tokens for users to access the API endpoints. These tokens can be generated in the CloudBees CI UI.

To generate an API authentication token:

  1. From the dashboard, select your user name on the right of the top navigation bar.

  2. Select Configure from the left pane.

  3. Select Add new Token under API Token.

  4. Enter a name to distinguish the token.

  5. Select the copy icon and save the token in a safe place so you can use it later.

    Once you leave the page, the token will no longer be visible so you will not be able to copy it again.

You can use the same token to access CloudBees CI APIs and the CLI. The keys are valid until the user revokes them in the UI.

You can create multiple keys. You may want multiple keys for instance if you supply a token to an external "less trusted" service which you will want to regenerate more often.

Authorization for requests depends on the API you are accessing and is set at the user level.

Sample API request using token

curl --user "admin:rG57xFa2eFrCeWjG4NKU5QMJeW9TzfSkym" -XGET "https://<my-operation-center.com>/cjoc/casc-bundle/list"

Sample CLI command using token

java -jar jenkins-cli.jar -auth admin:rG57xFa2eFrCeWjG4NKU5QMJeW9TzfSkym -s https://<my-operation-center.com>/cjoc/ -webSocket casc-bundle-list