--- title: Getting started with the GitHub API keywords: fastai sidebar: home_sidebar nb_path: "tutorial_api.ipynb" ---
{% raw %}
{% endraw %}

Initial setup

To get started, you need a GitHub personal access token, which is a secret code used to access your account. If you don't have one, click here to create one. You'll be asked to enter a name -- choose anything you like, for instance "ghapi". You'll also be asked to choose "scopes"; this limits what you'll be able to do with the API using this token. If you're not sure, click "repo" "gist", "notifications", and "workflow". Then click "Generate Token" at the bottom of the screen, and copy the token (the long string of letters and numbers shown). You can easily do that by clicking the little clipboard icon next to the token.

You'll need to pass that token to GhApi. Rather than pasting it into every script, it's easiest to save it as an environment variable. If you save it as $GITHUB_TOKEN then it will be most convenient, so add this to the end of your .bashrc or .zshrc file:

export GITHUB_TOKEN=xxx

...replacing the xxx with the token you just copied. Don't forget to source that file after you change it.