zulip/templates/zerver/api/api-keys.md

56 lines
1.6 KiB
Markdown
Raw Normal View History

# API keys
You can create bots on your [settings page](/#settings).
Once you have a bot, you can use its email and API key to send messages.
Create a bot:
<img class="screenshot" src="/static/images/api/create-bot.png" />
Look for the bot's email and API key:
<img class="screenshot" src="/static/images/api/bot-key.png" />
If you prefer to send messages as your own user, you can also find your API key on your [settings page](/#settings):
<img class="screenshot" src="/static/images/api/user-api-key.png" />
When using our Python bindings, you may either specify the user
and API key for each Client object that you initialize, or let the binding look for
them in your `~/.zuliprc`. An automatically generated default version can be found in
your bot's details:
<img class="screenshot" src="/static/images/api/download-zuliprc.png" />
Or you may also create it manually, as follows:
```
[api]
key=BOT_API_KEY
email=BOT_EMAIL_ADDRESS
```
Additionally, you can also specify the parameters as environment variables as follows:
```
export ZULIP_CONFIG=/path/to/zulipconfig
export ZULIP_EMAIL=BOT_EMAIL_ADDRESS
export ZULIP_API_KEY=BOT_API_KEY
```
The parameters specified in environment variables would override the parameters
provided in the config file. For example, if you specify the variable `key`
in the config file and specify `ZULIP_API_KEY` as an environment variable,
the value of `ZULIP_API_KEY` would be considered.
The following variables can be specified:
1. `ZULIP_CONFIG`
2. `ZULIP_API_KEY`
3. `ZULIP_EMAIL`
4. `ZULIP_SITE`
5. `ZULIP_CERT`
6. `ZULIP_CERT_KEY`
7. `ZULIP_CERT_BUNDLE`