From 279a5bec2aaa6641f4217945f78a080fb38fef57 Mon Sep 17 00:00:00 2001 From: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 17:11:54 +0000 Subject: [PATCH 1/2] fix: Restore owner.organization_id on user-owned API keys 10.8.0 started remapping a user owner to `organizationId`, which silently changed the runtime shape returned by `apiKeys.createValidation()` and the list endpoints for user-owned keys. Consumers validating the deserialized object against a schema began rejecting valid keys. Emit both keys so the pre-10.8.0 shape keeps working; `organization_id` is deprecated and can be dropped in the next major. --- src/api-keys/api-keys.spec.ts | 1 + src/api-keys/interfaces/api-key.interface.ts | 5 +++++ src/api-keys/serializers/api-key.serializer.ts | 1 + 3 files changed, 7 insertions(+) diff --git a/src/api-keys/api-keys.spec.ts b/src/api-keys/api-keys.spec.ts index f7229a194..c9a531664 100644 --- a/src/api-keys/api-keys.spec.ts +++ b/src/api-keys/api-keys.spec.ts @@ -64,6 +64,7 @@ describe('ApiKeys', () => { type: 'user', id: 'user_01H5JQDV7R7ATEYZDEG0W5PRYS', organizationId: 'org_01H5JQDV7R7ATEYZDEG0W5PRYS', + organization_id: 'org_01H5JQDV7R7ATEYZDEG0W5PRYS', }, name: 'Test User Api Key', obfuscatedValue: 'sk_…PRYS', diff --git a/src/api-keys/interfaces/api-key.interface.ts b/src/api-keys/interfaces/api-key.interface.ts index 15444eb1d..0094861a7 100644 --- a/src/api-keys/interfaces/api-key.interface.ts +++ b/src/api-keys/interfaces/api-key.interface.ts @@ -14,6 +14,11 @@ export interface ApiKey { type: 'user'; id: string; organizationId: string; + /** + * @deprecated Use `organizationId`. Retained for compatibility with + * releases before 10.8.0, which returned the raw API field name. + */ + organization_id: string; }; /** A descriptive name for the API Key. */ name: string; diff --git a/src/api-keys/serializers/api-key.serializer.ts b/src/api-keys/serializers/api-key.serializer.ts index 3b924bbb9..0ccbbca3a 100644 --- a/src/api-keys/serializers/api-key.serializer.ts +++ b/src/api-keys/serializers/api-key.serializer.ts @@ -10,6 +10,7 @@ export function deserializeApiKey(apiKey: SerializedApiKey): ApiKey { type: 'user', id: apiKey.owner.id, organizationId: apiKey.owner.organization_id, + organization_id: apiKey.owner.organization_id, } : apiKey.owner, name: apiKey.name, From 28229bbe1524ec2bbff2d8aeb46c2f202772a12f Mon Sep 17 00:00:00 2001 From: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 17:14:56 +0000 Subject: [PATCH 2/2] fix: Make the deprecated organization_id alias optional --- src/api-keys/interfaces/api-key.interface.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api-keys/interfaces/api-key.interface.ts b/src/api-keys/interfaces/api-key.interface.ts index 0094861a7..64283f29d 100644 --- a/src/api-keys/interfaces/api-key.interface.ts +++ b/src/api-keys/interfaces/api-key.interface.ts @@ -18,7 +18,7 @@ export interface ApiKey { * @deprecated Use `organizationId`. Retained for compatibility with * releases before 10.8.0, which returned the raw API field name. */ - organization_id: string; + organization_id?: string; }; /** A descriptive name for the API Key. */ name: string;