Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
api-docs: Move zuliprc file documentation to API keys article.
Lauryn Menard214008e92d29
diff --git a/api_docs/api-keys.md b/api_docs/api-keys.mdindex dcf8f718ae3..eb6593af25e 100644--- a/api_docs/api-keys.md+++ b/api_docs/api-keys.md@@ -1,12 +1,26 @@-# API keys+# API keys and `zuliprc` files-An **API key** is how a bot identifies itself to Zulip. For the official-clients, such as the Python bindings, we recommend [downloading a `zuliprc`-file](/api/configuring-python-bindings#download-a-zuliprc-file). This file-contains an API key and other necessary configuration values for using the-Zulip API with a specific account on a Zulip server.+An **API key** is how a user or bot can identify their account to Zulip.-## Get API key+A **`zuliprc` file** is a configuration file written in the [INI file+format](https://en.wikipedia.org/wiki/INI_file), which contains key-value+pairs, such as an API key and other configuration values, that are+necessary for using the Zulip API with a specific user or bot account on+a Zulip server, for example:++```+[api]+key=<bot API key>+email=<bot email address>+site=<Zulip server's URL>+...+```++For the official+clients, such as the [Python bindings](/api/configuring-python-bindings),+we recommend [downloading a `zuliprc` file](#download-a-zuliprc-file).++## Get an API key{start_tabs}@@ -74,6 +88,66 @@ new API key will immediately log you out of this account on all mobile devices.{end_tabs}+### Download a `zuliprc` file++{start_tabs}++{tab|for-a-bot}++{settings_tab|your-bots}++1. In the **Actions** column, click the **manage bot**+ (<i class="zulip-icon zulip-icon-user-cog"></i>) icon,+ and scroll down to **Zuliprc configuration**.++1. Click the **download**+ (<i class="zulip-icon zulip-icon-download"></i>) icon+ to download the bot's `zuliprc` file, or the **copy**+ (<i class="zulip-icon zulip-icon-copy"></i>) icon to+ copy the file's content to your clipboard.++!!! warn ""++ Anyone with a bot's API key can impersonate the bot, so be careful with it!++{tab|for-yourself}++{settings_tab|account-and-privacy}++1. Under **API key**, click **Manage your API key**.++1. Enter your password, and click **Get API key**. If you don't know your+ password, click **reset it** and follow the+ instructions from there.++1. Click **Download zuliprc** to download your `zuliprc` file.++1. (optional) If you'd like your credentials to be used by default+ when using the Zulip API on your computer, move the `zuliprc` file+ to `~/.zuliprc` in your home directory.++!!! warn ""++ Anyone with your API key can impersonate you, so be doubly careful with it.++{end_tabs}++### Configuration keys and environment variables++The keys you can use in a `zuliprc` file (and their equivalent+[environment variables](https://en.wikipedia.org/wiki/Environment_variable))+can be found in the following table:++| `zuliprc` key | Environment variable | Required | Description |+| --- | --- | --- | --- |+| `key` | `ZULIP_API_KEY` | Yes | The user's [API key](#get-an-api-key). |+| `email` | `ZULIP_EMAIL` | Yes | The email address of the user who owns the API key mentioned above. |+| `site` | `ZULIP_SITE` | No | URL where the Zulip server is located. |+| `client_cert_key` | `ZULIP_CERT_KEY` | No | Path to the SSL/TLS private key that the binding should use to connect to the server. |+| `client_cert`| `ZULIP_CERT` | No* | The public counterpart of `client_cert_key`/`ZULIP_CERT_KEY`. _*This setting is required if a cert key has been set._ |+| `client_bundle` | `ZULIP_CERT_BUNDLE` | No | Path where the server's PEM-encoded certificate is located. CA certificates are also accepted, in case those CA's have issued the server's certificate. Defaults to the built-in CA bundle trusted by Python. |+| `insecure` | `ZULIP_ALLOW_INSECURE` | No | Allows connecting to Zulip servers with an invalid SSL/TLS certificate. Please note that enabling this will make the HTTPS connection insecure. Defaults to `false`. |+## Related articles* [Configuring the Python bindings](/api/configuring-python-bindings)diff --git a/api_docs/configuring-python-bindings.md b/api_docs/configuring-python-bindings.mdindex 42170dd18ab..1cbe1bd25c3 100644--- a/api_docs/configuring-python-bindings.md+++ b/api_docs/configuring-python-bindings.md@@ -9,157 +9,19 @@ In order to use them, you need to configure them with your identity(account, API key, and Zulip server URL). There are a few ways toachieve that:-- Using a `zuliprc` file, referenced via the `--config-file` option or- the `config_file` option to the `zulip.Client` constructor- (recommended for bots).-- Using a `zuliprc` file in your home directory at `~/.zuliprc`- (recommended for your own API key).+- Using a [`zuliprc` file](/api/api-keys#download-a-zuliprc-file), referenced via+ the `--config-file` option or the `config_file` option to the+ `zulip.Client` constructor (recommended for bots).+- Using a [`zuliprc` file](/api/api-keys#download-a-zuliprc-file) in your home+ directory at `~/.zuliprc` (recommended for your own API key).- Using the [environmentvariables](https://en.wikipedia.org/wiki/Environment_variable)- documented below.+ documented [here](/api/api-keys#configuration-keys-and-environment-variables).- Using the `--api-key`, `--email`, and `--site` variables as commandline parameters.- Using the `api_key`, `email`, and `site` parameters to the`zulip.Client` constructor.-## Download a `zuliprc` file--{start_tabs}--{tab|for-a-bot}--{settings_tab|your-bots}--1. In the **Actions** column, click the **manage bot**- (<i class="zulip-icon zulip-icon-user-cog"></i>) icon,- and scroll down to **Zuliprc configuration**.--1. Click the **download**- (<i class="zulip-icon zulip-icon-download"></i>) icon- to download the bot's `zuliprc` file, or the **copy**- (<i class="zulip-icon zulip-icon-copy"></i>) icon to- copy the file's content to your clipboard.--!!! warn ""-- Anyone with a bot's API key can impersonate the bot, so be careful with it!--{tab|for-yourself}--{settings_tab|account-and-privacy}--1. Under **API key**, click **Manage your API key**.--1. Enter your password, and click **Get API key**. If you don't know your- password, click **reset it** and follow the- instructions from there.--1. Click **Download zuliprc** to download your `zuliprc` file.--1. (optional) If you'd like your credentials to be used by default- when using the Zulip API on your computer, move the `zuliprc` file- to `~/.zuliprc` in your home directory.--!!! warn ""-- Anyone with your API key can impersonate you, so be doubly careful with it.--{end_tabs}--## Configuration keys and environment variables--`zuliprc` is a configuration file written in the-[INI file format](https://en.wikipedia.org/wiki/INI_file),-which contains key-value pairs as shown in the following example:--```-[api]-key=<API key from the web interface>-email=<your email address>-site=<your Zulip server's URI>-...-```--The keys you can use in this file (and their equivalent environment variables)-can be found in the following table:--<table class="table">- <thead>- <tr>- <th><code>zuliprc</code> key</th>- <th>Environment variable</th>- <th>Required</th>- <th>Description</th>- </tr>- </thead>- <tr>- <td><code>key</code></td>- <td><code>ZULIP_API_KEY</code></td>- <td>Yes</td>- <td>- <a href="/api/api-keys">API key</a>, which you can get through- Zulip's web interface.- </td>- </tr>- <tr>- <td><code>email</code></td>- <td><code>ZULIP_EMAIL</code></td>- <td>Yes</td>- <td>- The email address of the user who owns the API key mentioned- above.- </td>- </tr>- <tr>- <td><code>site</code></td>- <td><code>ZULIP_SITE</code></td>- <td>No</td>- <td>- URL where your Zulip server is located.- </td>- </tr>- <tr>- <td><code>client_cert_key</code></td>- <td><code>ZULIP_CERT_KEY</code></td>- <td>No</td>- <td>- Path to the SSL/TLS private key that the binding should use to- connect to the server.- </td>- </tr>- <tr>- <td><code>client_cert</code></td>- <td><code>ZULIP_CERT</code></td>- <td>No*</td>- <td>- The public counterpart of <code>client_cert_key</code>/- <code>ZULIP_CERT_KEY</code>. <i>This setting is required if a cert- key has been set.</i>- </td>- </tr>- <tr>- <td><code>client_bundle</code></td>- <td><code>ZULIP_CERT_BUNDLE</code></td>- <td>No</td>- <td>- Path where the server's PEM-encoded certificate is located. CA- certificates are also accepted, in case those CA's have issued the- server's certificate. Defaults to the built-in CA bundle trusted- by Python.- </td>- </tr>- <tr>- <td><code>insecure</code></td>- <td><code>ZULIP_ALLOW_INSECURE</code></td>- <td>No</td>- <td>- Allows connecting to Zulip servers with an invalid SSL/TLS- certificate. Please note that enabling this will make the HTTPS- connection insecure. Defaults to <code>false</code>.- </td>- </tr>-</table>-## Related articles* [Installation instructions](/api/installation-instructions)diff --git a/api_docs/http-headers.md b/api_docs/http-headers.mdindex fcf94f45f37..24bdae825fc 100644--- a/api_docs/http-headers.md+++ b/api_docs/http-headers.md@@ -28,7 +28,7 @@ Otherwise, to authenticate an API request:- A bot's credentials can be obtained through the web and desktop apps'[bot management UI](/help/manage-a-bot) or by [downloading the bot's- zuliprc file](/api/configuring-python-bindings#download-a-zuliprc-file).+ `zuliprc` file](/api/api-keys#download-a-zuliprc-file).- See [fetch an API key (production)](/api/fetch-api-key) for thepassword-based authentication flow for getting a user's credentials.diff --git a/api_docs/sidebar_index.md b/api_docs/sidebar_index.mdindex 8af8de9fd79..c07a07695e7 100644--- a/api_docs/sidebar_index.md+++ b/api_docs/sidebar_index.md@@ -2,7 +2,7 @@* [Overview](/api/rest)* [Installation instructions](/api/installation-instructions)-* [API keys](/api/api-keys)+* [API keys and zuliprc files](/api/api-keys)* [Configuring the Python bindings](/api/configuring-python-bindings)* [HTTP headers](/api/http-headers)* [Error handling](/api/rest-error-handling)diff --git a/starlight_help/src/content/docs/protect-your-account.mdx b/starlight_help/src/content/docs/protect-your-account.mdxindex e2cc664d46a..e23d4c451e8 100644--- a/starlight_help/src/content/docs/protect-your-account.mdx+++ b/starlight_help/src/content/docs/protect-your-account.mdx@@ -19,8 +19,7 @@ situations:* Accidentally sharing your password or API key with someone else.* Losing a device where you're logged in to Zulip (e.g., a cell phone or laptop).* Losing a device that has a downloaded copy of your [`zuliprc`- file](/api/configuring-python-bindings#download-a-zuliprc-file), which- includes your API key.+ file](/api/api-keys#download-a-zuliprc-file), which includes your API key.Changing your API key will immediately log you out of Zulip on all mobiledevices.diff --git a/starlight_help/src/content/docs/running-bots.mdx b/starlight_help/src/content/docs/running-bots.mdxindex 183d73a8c3b..b24e3fed793 100644--- a/starlight_help/src/content/docs/running-bots.mdx+++ b/starlight_help/src/content/docs/running-bots.mdx@@ -31,7 +31,7 @@ You'll need:1. [Create a bot](/help/add-a-bot-or-integration), making sure to select**Generic bot** as the **Bot type**.- 1. [Download the bot's `zuliprc` file](/api/configuring-python-bindings#download-a-zuliprc-file).+ 1. [Download the bot's `zuliprc` file](/api/api-keys#download-a-zuliprc-file).1. Use the following command to install the[`zulip_bots` Python package](https://pypi.org/project/zulip-bots/):diff --git a/web/templates/settings/edit_bot_form.hbs b/web/templates/settings/edit_bot_form.hbsindex 80cbf35110b..4d71e501168 100644--- a/web/templates/settings/edit_bot_form.hbs+++ b/web/templates/settings/edit_bot_form.hbs@@ -79,7 +79,7 @@{{#if (and is_active is_bot_owner_current_user)}}<div id="zuliprc-section" class="input-group"><div class="zuliprc-container">- <label class="modal-field-label">{{t "Zuliprc configuration" }} {{> ../help_link_widget link="/api/configuring-python-bindings" }}</label>+ <label class="modal-field-label">{{t "Zuliprc configuration" }} {{> ../help_link_widget link="/api/api-keys" }}</label><div class="buttons-container"><span><a type="submit" download="zuliprc" data-email="{{email}}" data-user-id="{{user_id}}" class="hidden-zuliprc-download" hidden></a>