From a2d67925ba845811e9d33289b1aef717ffcc9b6b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Jun 2026 16:08:43 +0000 Subject: [PATCH 1/3] feat(api): surface deleted/expired API keys for audit trail (KERNEL-1350) --- .stats.yml | 4 ++-- api.md | 2 +- src/client.ts | 2 ++ src/resources/api-keys.ts | 36 ++++++++++++++++++++++++++-- src/resources/index.ts | 1 + tests/api-resources/api-keys.test.ts | 9 +++++++ 6 files changed, 49 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index a1640098..3ff52d98 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 119 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-51549f813f3002e18c6ca8d850cc0c7932828d511c151e0412c73b6798d19e30.yml -openapi_spec_hash: ee77b293c4bda91c1a32cfdd12b8739e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-42074f2b600b0dc805377d6793e4bb30c959738b0f9cc44c409d094517e5e0ab.yml +openapi_spec_hash: 81c27a833d6d9637787634180dec2abd config_hash: 57567e00b41af47cef1b78e51b747aa0 diff --git a/api.md b/api.md index 79b92058..5c2fb0c5 100644 --- a/api.md +++ b/api.md @@ -399,7 +399,7 @@ Types: Methods: - client.apiKeys.create({ ...params }) -> CreatedAPIKey -- client.apiKeys.retrieve(id) -> APIKey +- client.apiKeys.retrieve(id, { ...params }) -> APIKey - client.apiKeys.update(id, { ...params }) -> APIKey - client.apiKeys.list({ ...params }) -> APIKeysOffsetPagination - client.apiKeys.delete(id) -> void diff --git a/src/client.ts b/src/client.ts index 8a94d125..cb1dd80d 100644 --- a/src/client.ts +++ b/src/client.ts @@ -23,6 +23,7 @@ import { APIKey, APIKeyCreateParams, APIKeyListParams, + APIKeyRetrieveParams, APIKeyUpdateParams, APIKeys, APIKeysOffsetPagination, @@ -1158,6 +1159,7 @@ export declare namespace Kernel { type CreatedAPIKey as CreatedAPIKey, type APIKeysOffsetPagination as APIKeysOffsetPagination, type APIKeyCreateParams as APIKeyCreateParams, + type APIKeyRetrieveParams as APIKeyRetrieveParams, type APIKeyUpdateParams as APIKeyUpdateParams, type APIKeyListParams as APIKeyListParams, }; diff --git a/src/resources/api-keys.ts b/src/resources/api-keys.ts index a855c962..49c172bb 100644 --- a/src/resources/api-keys.ts +++ b/src/resources/api-keys.ts @@ -34,8 +34,12 @@ export class APIKeys extends APIResource { * const apiKey = await client.apiKeys.retrieve('id'); * ``` */ - retrieve(id: string, options?: RequestOptions): APIPromise { - return this._client.get(path`/org/api_keys/${id}`, options); + retrieve( + id: string, + query: APIKeyRetrieveParams | null | undefined = {}, + options?: RequestOptions, + ): APIPromise { + return this._client.get(path`/org/api_keys/${id}`, { query, ...options }); } /** @@ -101,6 +105,12 @@ export interface APIKey { created_by: APIKey.CreatedBy; + /** + * When the API key was deleted (soft-deleted). Null for keys that have not been + * deleted. + */ + deleted_at: string | null; + /** * When the API key expires */ @@ -126,6 +136,13 @@ export interface APIKey { * project name is unavailable. */ project_name: string | null; + + /** + * Derived lifecycle status of the API key. `active` means usable. `expired` means + * past its expires_at. `deleted` means it was deleted (soft-deleted) and can no + * longer authenticate. Deleted takes precedence over expired. + */ + status: 'active' | 'expired' | 'deleted'; } export namespace APIKey { @@ -174,6 +191,14 @@ export interface APIKeyCreateParams { project_id?: string | null; } +export interface APIKeyRetrieveParams { + /** + * When true, return the API key even if it has been deleted (soft-deleted), for + * audit purposes. Defaults to false, which returns 404 for a deleted key. + */ + include_deleted?: boolean; +} + export interface APIKeyUpdateParams { /** * New API key name @@ -182,6 +207,12 @@ export interface APIKeyUpdateParams { } export interface APIKeyListParams extends OffsetPaginationParams { + /** + * When true, include deleted (soft-deleted) API keys in the results for audit + * purposes. Defaults to false, which returns only live keys. + */ + include_deleted?: boolean; + /** * Case-insensitive substring match against API key name, creator, and project. API * key identifiers and masked keys match by exact value or prefix. @@ -205,6 +236,7 @@ export declare namespace APIKeys { type CreatedAPIKey as CreatedAPIKey, type APIKeysOffsetPagination as APIKeysOffsetPagination, type APIKeyCreateParams as APIKeyCreateParams, + type APIKeyRetrieveParams as APIKeyRetrieveParams, type APIKeyUpdateParams as APIKeyUpdateParams, type APIKeyListParams as APIKeyListParams, }; diff --git a/src/resources/index.ts b/src/resources/index.ts index 491319db..b73f26f3 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -6,6 +6,7 @@ export { type APIKey, type CreatedAPIKey, type APIKeyCreateParams, + type APIKeyRetrieveParams, type APIKeyUpdateParams, type APIKeyListParams, type APIKeysOffsetPagination, diff --git a/tests/api-resources/api-keys.test.ts b/tests/api-resources/api-keys.test.ts index 14a45a0d..1dbeb3e7 100644 --- a/tests/api-resources/api-keys.test.ts +++ b/tests/api-resources/api-keys.test.ts @@ -41,6 +41,14 @@ describe('resource apiKeys', () => { expect(dataAndResponse.response).toBe(rawResponse); }); + // Mock server tests are disabled + test.skip('retrieve: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.apiKeys.retrieve('id', { include_deleted: true }, { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(Kernel.NotFoundError); + }); + // Mock server tests are disabled test.skip('update: only required params', async () => { const responsePromise = client.apiKeys.update('id', { name: 'new-api-name' }); @@ -76,6 +84,7 @@ describe('resource apiKeys', () => { await expect( client.apiKeys.list( { + include_deleted: true, limit: 100, offset: 0, query: 'query', From 50f1a1b61c4e415936267abbda4ae6bfd6c1d238 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Jun 2026 19:04:31 +0000 Subject: [PATCH 2/3] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3ff52d98..ab902c2f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 119 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-42074f2b600b0dc805377d6793e4bb30c959738b0f9cc44c409d094517e5e0ab.yml -openapi_spec_hash: 81c27a833d6d9637787634180dec2abd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-c98841235b0ece0591f28f7dd424339b6ef2f3e8f539b95b670ae0da2ef43df4.yml +openapi_spec_hash: c1e9456765f0743a333af297d135d5cf config_hash: 57567e00b41af47cef1b78e51b747aa0 From 9df1a523db2bb83409049d20ef493fd6841682af Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Jun 2026 19:04:58 +0000 Subject: [PATCH 3/3] release: 0.68.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 94994d4f..e5a17c22 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.67.0" + ".": "0.68.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index cd0a6963..35be76b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.68.0 (2026-06-12) + +Full Changelog: [v0.67.0...v0.68.0](https://github.com/kernel/kernel-node-sdk/compare/v0.67.0...v0.68.0) + +### Features + +* **api:** surface deleted/expired API keys for audit trail (KERNEL-1350) ([a2d6792](https://github.com/kernel/kernel-node-sdk/commit/a2d67925ba845811e9d33289b1aef717ffcc9b6b)) + ## 0.67.0 (2026-06-11) Full Changelog: [v0.66.0...v0.67.0](https://github.com/kernel/kernel-node-sdk/compare/v0.66.0...v0.67.0) diff --git a/package.json b/package.json index e2856f29..6e3d5cd4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@onkernel/sdk", - "version": "0.67.0", + "version": "0.68.0", "description": "The official TypeScript library for the Kernel API", "author": "Kernel <>", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index ed32717a..71e73403 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.67.0'; // x-release-please-version +export const VERSION = '0.68.0'; // x-release-please-version