Add API Keys support (create, list, delete)#1
Open
blackmad-cradle wants to merge 6 commits intomainfrom
Open
Conversation
Adds full API key management to the SDK based on PR workos#508 with review feedback addressed: - Organizations: create_api_key and list_api_keys with pagination - ApiKeys: delete_api_key - Removed organization_id from list filters (it's a URL path param, not a query param) per reviewer feedback - Used functools.partial for list_method to properly support auto-pagination without sending organization_id as query param Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
710a861 to
0ad0abe
Compare
* chore(deps): update dependency node to v24 * Update Node.js version to 24.x in workflow --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Garen Torikian <gjtorikian@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Garen Torikian <gjtorikian@users.noreply.github.com>
* Add 21 missing event and webhook types from WorkOS docs Add support for the following event types that were documented but missing from the SDK: - api_key.created, api_key.revoked - authentication.email_verification_failed, authentication.mfa_failed, authentication.passkey_failed, authentication.passkey_succeeded, authentication.radar_risk_detected - connection.saml_certificate_renewed, connection.saml_certificate_renewal_required - flag.created, flag.updated, flag.deleted, flag.rule_updated - invitation.resent - organization_role.created, organization_role.deleted, organization_role.updated - permission.created, permission.deleted, permission.updated New payload models: ApiKeyPayload, ConnectionSamlCertificate payloads, FlagPayload, OrganizationRolePayload, PermissionPayload. New auth payloads for email_verification_failed, mfa_failed, passkey, and radar_risk_detected. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * adjust requiredness * Add context field to flag.rule_updated event and webhook The backend flag.rule_updated event includes a context object (with actor, access_type, configured_targets, and previous_attributes) as a sibling of the data field. Without this, the context was silently dropped during deserialization. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Make sso field required on SSO auth event payloads Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Garen J. Torikian <gjtorikian@users.noreply.github.com>
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
create_api_key(organization_id, name, permissions)andlist_api_keys(organization_id, ...)with full pagination supportdelete_api_key(api_key_id)to delete an API keyorganization_idfromApiKeyListFilters— it's a URL path parameter, not a query parameterorganization_idfromlist_paramsdict in both sync and asynclist_api_keysfunctools.partialto bindorganization_idto the list method for proper auto-pagination supportTest plan
delete_api_key(sync + async)create_api_keywith and without permissions (sync + async)list_api_keysbasic listing and pagination params (sync + async)list_api_keysauto-pagination across multiple pages (sync + async)ruff check) passesruff format --check) passesmypy) passes with no issues🤖 Generated with Claude Code