Note that you will need to be a repository Administrator in order to generate an access token. If you do not have access to your repository's settings, then contact one of your repository's admins to help you with this.
From the API & Security section of the Settings menu, you can set your API as Private. If you set your API as private, your application will need an access token for any request.
To generate a token, follow these steps:
- Go to your repository's Settings / API & Security
- At the bottom find the section called "Generate an Access Token"
- Add an application name. This doesn't matter much, you can add something like "My Website"
- Click the "Add this application" button
This will generate the tokens which you can find under the "Permanent access tokens" section.