From caea28bc53321d5185fe7c710122cec2533e5c8a Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Fri, 4 Dec 2026 13:09:28 +0000 Subject: [PATCH 1/3] docs: document the personal api key cut-off setting --- .../authentication/service_accounts.md | 40 +++++++++++++++++++ user/personal_api_keys.md | 2 + 2 files changed, 42 insertions(+) diff --git a/administration/authentication/service_accounts.md b/administration/authentication/service_accounts.md index ac7fbd5..6eef62d 100644 --- a/administration/authentication/service_accounts.md +++ b/administration/authentication/service_accounts.md @@ -143,6 +143,46 @@ curl -X PATCH \ https://app.kosli.com/api/v2/organizations/<>/settings ``` +## Refuse old personal API keys + +Instead of refusing all personal API keys, an admin can refuse only those issued before a cut-off. For example, after a key leaks, ask members to create new keys, then set a cut-off so the old keys stop working in the organization. This applies to shared organizations only. Set the cut-off in one of two ways: + +- **Issued on or after a date**: Kosli accepts keys issued from 00:00 UTC on that date. The date can be at most 60 days in the past. +- **Issued no more than a number of days ago**: Kosli accepts keys issued within the last 1 to 3650 days. Each key stops working that many days after it was issued, so members need to create a new one. + + + + Sign in to Kosli as an admin and select the organization. + Navigate to **Settings → General**. + + + In the **API keys** panel, find **Oldest personal key accepted** and click **Edit**. Choose **Issued on or after a date** or **Issued no more than a number of days ago**, enter the date or number of days, and click **Save**. + + + Set **Oldest personal key accepted** to **On**. In the **Apply this cut-off?** dialog, click **Apply cut-off**. + + + +The cut-off takes effect immediately, including for the CLI and CI pipelines. Kosli rejects a request to the organization made with a personal API key issued before the cut-off with HTTP `403` and a message that says when the key was issued and asks the member to create a new key in the Kosli web app. Kosli also refuses a personal API key with no recorded issue date while the cut-off is on. + +A key's issue date is when its secret was issued: + +- A key you create or regenerate from your **Profile** page is issued at that moment. +- A key created or rotated with another API key, for example with `kosli create api-key --personal` or `kosli rotate api-key --personal`, counts as issued when that API key was. A leaked key can't create a fresh key that gets past the cut-off. +- During a rotation's grace period, the replaced secret keeps its own issue date. + +Service account keys and signing in to the Kosli app in a browser are not affected. To stop applying the cut-off, set **Oldest personal key accepted** to **Off**. The saved cut-off stays and applies again when you turn it back on. If you also [refuse all personal API keys](#refuse-personal-api-keys), that setting takes precedence. + +To set the cut-off through the API, send `PATCH` to `/api/v2/organizations//settings` with an API key that has the Admin role. Set `personal_api_key_cutoff` to an object with exactly one of `issued_on_or_after` (a `YYYY-MM-DD` date) or `issued_within_days` (a whole number), and `personal_api_key_cutoff_enabled` to `true` or `false`. Fields you leave out keep their saved values. The API can replace a saved cut-off but not clear it, so send `"personal_api_key_cutoff_enabled": false` to stop applying it. + +```shell +curl -X PATCH \ + -H "Authorization: Bearer <>" \ + -H "Content-Type: application/json" \ + -d '{"personal_api_key_cutoff": {"issued_within_days": 90}, "personal_api_key_cutoff_enabled": true}' \ + https://app.kosli.com/api/v2/organizations/<>/settings +``` + ## Rotate or revoke keys For zero-downtime rotation and the API-driven flow, see: diff --git a/user/personal_api_keys.md b/user/personal_api_keys.md index e2a94d8..5e30908 100644 --- a/user/personal_api_keys.md +++ b/user/personal_api_keys.md @@ -12,6 +12,8 @@ For CI/CD pipelines and any other automation, use a [service account](/administr An organization admin can [refuse personal API keys](/administration/authentication/service_accounts#refuse-personal-api-keys). Your personal keys then get HTTP `403` in that organization and keep working in your other organizations. Use a service account API key there instead. +An admin can also [refuse personal API keys issued before a cut-off](/administration/authentication/service_accounts#refuse-old-personal-api-keys), such as a date or a number of days ago. Your older keys then get HTTP `403` in that organization, so create a new key from your **Profile** page. + ## Create a personal API key From 6ad9059bd690040df43d463c157dcdb7b95cde35 Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Fri, 4 Dec 2026 13:15:37 +0000 Subject: [PATCH 2/3] docs: note that cli rotation keeps a personal key's issue date --- administration/authentication/service_accounts.md | 2 +- user/personal_api_keys.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/administration/authentication/service_accounts.md b/administration/authentication/service_accounts.md index 6eef62d..38846a2 100644 --- a/administration/authentication/service_accounts.md +++ b/administration/authentication/service_accounts.md @@ -148,7 +148,7 @@ curl -X PATCH \ Instead of refusing all personal API keys, an admin can refuse only those issued before a cut-off. For example, after a key leaks, ask members to create new keys, then set a cut-off so the old keys stop working in the organization. This applies to shared organizations only. Set the cut-off in one of two ways: - **Issued on or after a date**: Kosli accepts keys issued from 00:00 UTC on that date. The date can be at most 60 days in the past. -- **Issued no more than a number of days ago**: Kosli accepts keys issued within the last 1 to 3650 days. Each key stops working that many days after it was issued, so members need to create a new one. +- **Issued no more than a number of days ago**: Kosli accepts keys issued within the last 1 to 3650 days. Each key stops working that many days after it was issued. Members then need to create a new key, or regenerate one, from their **Profile** page: rotating a key from the CLI keeps its issue date. diff --git a/user/personal_api_keys.md b/user/personal_api_keys.md index 5e30908..b741a0d 100644 --- a/user/personal_api_keys.md +++ b/user/personal_api_keys.md @@ -70,6 +70,7 @@ When `--api-token` is itself a personal API key, these limits apply: - A key you create with it expires no later than that key, and is deleted along with it. - You can only rotate or delete that key and the keys created with it. +- A key you create or rotate with it counts as issued when that key was, so it doesn't get past an organization's [personal key cut-off](/administration/authentication/service_accounts#refuse-old-personal-api-keys). To get a key that outlives the one you are using, create it from your **Profile** page. See [`kosli create api-key`](/client_reference/kosli_create_api-key), [`kosli rotate api-key`](/client_reference/kosli_rotate_api-key), [`kosli list api-keys`](/client_reference/kosli_list_api-keys), [`kosli get api-key`](/client_reference/kosli_get_api-key), and [`kosli delete api-key`](/client_reference/kosli_delete_api-key) for every flag. From 19de915eb93a59ff882a58f70d17e7678ccdc2aa Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Fri, 4 Dec 2026 13:59:35 +0000 Subject: [PATCH 3/3] docs: update cut-off steps for the turn-on dialog --- administration/authentication/service_accounts.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/administration/authentication/service_accounts.md b/administration/authentication/service_accounts.md index 38846a2..ac86129 100644 --- a/administration/authentication/service_accounts.md +++ b/administration/authentication/service_accounts.md @@ -129,7 +129,7 @@ The change takes effect immediately. Kosli rejects every request to the organiza Personal API keys are turned off for organization ''. Use a service account API key instead. ``` -Before you refuse personal keys, move the CLI, CI pipelines and scripts that use them to service account keys. Personal keys keep working in the member's other organizations, and signing in to the Kosli app in a browser is not affected. To accept personal keys again, set **Personal API keys** back to **Accepted**. +Before you refuse personal keys, move the CLI, CI pipelines and scripts that use them to service account keys. Personal keys keep working in the member's other organizations, and signing in to the Kosli app in a browser is not affected. To accept personal keys again, set **Personal API keys** back to **Accepted**, and in the **Accept personal API keys?** dialog, click **Accept personal keys**. The setting restricts which type of key works, not who holds one. A member who is allowed to manage service accounts can still create one and an API key for it. @@ -155,11 +155,11 @@ Instead of refusing all personal API keys, an admin can refuse only those issued Sign in to Kosli as an admin and select the organization. Navigate to **Settings → General**. - - In the **API keys** panel, find **Oldest personal key accepted** and click **Edit**. Choose **Issued on or after a date** or **Issued no more than a number of days ago**, enter the date or number of days, and click **Save**. - - Set **Oldest personal key accepted** to **On**. In the **Apply this cut-off?** dialog, click **Apply cut-off**. + In the **API keys** panel, set **Oldest personal key accepted** to **On**. + + + In the **Turn on the cut-off?** dialog, choose **Issued on or after a date** or **Issued no more than a number of days ago**, and enter the date or number of days. The dialog opens on the saved cut-off, if there is one. Click **Save and turn on**. @@ -171,7 +171,7 @@ A key's issue date is when its secret was issued: - A key created or rotated with another API key, for example with `kosli create api-key --personal` or `kosli rotate api-key --personal`, counts as issued when that API key was. A leaked key can't create a fresh key that gets past the cut-off. - During a rotation's grace period, the replaced secret keeps its own issue date. -Service account keys and signing in to the Kosli app in a browser are not affected. To stop applying the cut-off, set **Oldest personal key accepted** to **Off**. The saved cut-off stays and applies again when you turn it back on. If you also [refuse all personal API keys](#refuse-personal-api-keys), that setting takes precedence. +Service account keys and signing in to the Kosli app in a browser are not affected. To change the cut-off, click **Edit** next to **Oldest personal key accepted**, enter the new date or number of days, and click **Save**. While the cut-off is on, confirm the change in the **Apply this cut-off?** dialog by clicking **Apply cut-off**. To stop applying the cut-off, set **Oldest personal key accepted** to **Off**, and in the **Turn off the cut-off?** dialog, click **Turn off**. The saved cut-off stays and applies again when you turn it back on. If you also [refuse all personal API keys](#refuse-personal-api-keys), that setting takes precedence. To set the cut-off through the API, send `PATCH` to `/api/v2/organizations//settings` with an API key that has the Admin role. Set `personal_api_key_cutoff` to an object with exactly one of `issued_on_or_after` (a `YYYY-MM-DD` date) or `issued_within_days` (a whole number), and `personal_api_key_cutoff_enabled` to `true` or `false`. Fields you leave out keep their saved values. The API can replace a saved cut-off but not clear it, so send `"personal_api_key_cutoff_enabled": false` to stop applying it.