Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.67.0"
".": "0.68.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -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-c98841235b0ece0591f28f7dd424339b6ef2f3e8f539b95b670ae0da2ef43df4.yml
openapi_spec_hash: c1e9456765f0743a333af297d135d5cf
config_hash: 57567e00b41af47cef1b78e51b747aa0
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ Types:
Methods:

- <code title="post /org/api_keys">client.apiKeys.<a href="./src/resources/api-keys.ts">create</a>({ ...params }) -> CreatedAPIKey</code>
- <code title="get /org/api_keys/{id}">client.apiKeys.<a href="./src/resources/api-keys.ts">retrieve</a>(id) -> APIKey</code>
- <code title="get /org/api_keys/{id}">client.apiKeys.<a href="./src/resources/api-keys.ts">retrieve</a>(id, { ...params }) -> APIKey</code>
- <code title="patch /org/api_keys/{id}">client.apiKeys.<a href="./src/resources/api-keys.ts">update</a>(id, { ...params }) -> APIKey</code>
- <code title="get /org/api_keys">client.apiKeys.<a href="./src/resources/api-keys.ts">list</a>({ ...params }) -> APIKeysOffsetPagination</code>
- <code title="delete /org/api_keys/{id}">client.apiKeys.<a href="./src/resources/api-keys.ts">delete</a>(id) -> void</code>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 2 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
APIKey,
APIKeyCreateParams,
APIKeyListParams,
APIKeyRetrieveParams,
APIKeyUpdateParams,
APIKeys,
APIKeysOffsetPagination,
Expand Down Expand Up @@ -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,
};
Expand Down
36 changes: 34 additions & 2 deletions src/resources/api-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ export class APIKeys extends APIResource {
* const apiKey = await client.apiKeys.retrieve('id');
* ```
*/
retrieve(id: string, options?: RequestOptions): APIPromise<APIKey> {
return this._client.get(path`/org/api_keys/${id}`, options);
retrieve(
id: string,
query: APIKeyRetrieveParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<APIKey> {
return this._client.get(path`/org/api_keys/${id}`, { query, ...options });
}

/**
Expand Down Expand Up @@ -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
*/
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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,
};
Expand Down
1 change: 1 addition & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export {
type APIKey,
type CreatedAPIKey,
type APIKeyCreateParams,
type APIKeyRetrieveParams,
type APIKeyUpdateParams,
type APIKeyListParams,
type APIKeysOffsetPagination,
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.67.0'; // x-release-please-version
export const VERSION = '0.68.0'; // x-release-please-version
9 changes: 9 additions & 0 deletions tests/api-resources/api-keys.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Expand Down Expand Up @@ -76,6 +84,7 @@ describe('resource apiKeys', () => {
await expect(
client.apiKeys.list(
{
include_deleted: true,
limit: 100,
offset: 0,
query: 'query',
Expand Down
Loading