feat: Surface agent registration id on API key validation#1644
Merged
Conversation
POST /api_keys/validations now returns an optional agent_registration_id, present only when the validated key is assigned to an agent registration. createValidation surfaces it as an optional agentRegistrationId, omitted for non-agent keys. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The agent registration id value used the agent_registration_ prefix; the real prefix is agent_reg_. Field names are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Greptile SummaryThis PR surfaces agent registration ids from API key validation responses. The main changes are:
Confidence Score: 5/5The change is narrowly scoped to API key validation response typing and deserialization. The updated validation response contract maps the new optional server field to the SDK response shape while preserving omitted-field behavior for non-agent keys. The changed tests cover both present and absent None.
What T-Rex did
Reviews (1): Last reviewed commit: "fix(api-keys): Use correct agent_reg_ pr..." | Re-trigger Greptile |
stanleyphu
approved these changes
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adapts the SDK to workos/workos#63786, which expands the
POST /api_keys/validationsresponse with an optional top-levelagent_registration_id— present only when the validated API key is assigned to an agent registration, omitted otherwise.workos.apiKeys.createValidationnow surfaces this as an optionalagentRegistrationId:ValidateApiKeyResponsegainsagentRegistrationId?: string(and the serialized type gainsagent_registration_id?).null) for non-agent keys — mirroring the server's "present only when set" semantics and matching the existing optional-field convention (e.g.stripeCustomerIdin the organization serializer).The shared
ApiKeyobject (list/create/get) is unchanged; the new field lives on the validation response only.Testing
jest src/api-keys— 11 pass (added: agent-assigned key returns the registration id; non-agent key omits the field; existing cases untouched)tsc --noEmit,eslint, andprettier --checkall cleanCloses AUTH-6624
🤖 Generated with Claude Code