Creating an access token

Access tokens permit authenticated access to the Sourcegraph API. This is required for the src command line interface to Sourcegraph to operate, and also allows other tools that integrate with Sourcegraph to issue requests on your behalf.

Creating an access token is done through your user settings. This video shows the steps, which are then described below:

  1. From any Sourcegraph page, click on your avatar at the top right of the page.

  2. Select Settings from the dropdown menu.

  3. Select Access tokens from the sidebar menu.

  4. Click Generate new token.

  5. Enter a description, such as src.

  6. Click Generate token.

  7. Sourcegraph will now display your access token. You must copy it from this screen: once this page is closed, you cannot access the token again and can only revoke it and issue a new one.

You can then set the SRC_ACCESS_TOKEN environment variable to the token to use it with src.