feat(apikeys): create keys with the signed-in session - #273
Merged
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 4 |
| Duplication | 36 |
TIP This summary will be updated as you push new changes.
LorrisSaintGenez
marked this pull request as ready for review
July 27, 2026 17:50
LorrisSaintGenez
requested review from
a team and
NatanTechofNY
and removed request for
a team
July 27, 2026 18:28
LorrisSaintGenez
force-pushed
the
feat/api-keys-search-get-create
branch
from
July 27, 2026 19:42
c940e41 to
6de9ed3
Compare
LorrisSaintGenez
force-pushed
the
feat/api-keys-search-get-create
branch
from
July 27, 2026 19:53
6de9ed3 to
557d2e4
Compare
dylantientcheu
approved these changes
Jul 28, 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.
What
algolia apikeys createno longer requires an admin API key: being signed in with an application selected is enough.apikeys rotate.--api-key,--admin-api-keyorALGOLIA_API_KEYis set, so--validityand existing scripts keep working.acls: adminannotation, which made the command unreachable for a signed-in user: the CLI-managed key carriesWriteACL, withoutadmin.403/404: missing--acl,--validityon the session path, unknown application, non-admin explicit key, no session.Minor breaking change:
--aclis now required on both paths.algolia apikeys createwith no ACL previously went through on the admin-key path and produced a key that grants nothing; the Public API rejects it outright sinceaclis a required param. Validating it in the CLI means the error arrives before the call rather than as a raw server response, and the validation no longer depends on whetherstate.tomlholds a key UUID.The Public API accepts
acl,description,indexesandreferers, and requires a non-empty description — hence theCreated with the Algolia CLIdefault. It has novalidityfield, so expiring keys still need an admin key.apikeys listis unchanged: the Public API has no collection endpoint yet.apikeys get <key>already worked without an admin key.Test
Sign in first, with an application selected:
Create a key with several ACLs and restrictions:
Expect a JSON payload with
uuid,value,acl: ["search","browse"],indexesandreferers.Default description:
Expect
"description": "Created with the Algolia CLI".Error paths:
Expect, in order:
--acl is required,--validity requires an admin API key,application devDOESNOTEXIST doesn't exist, or your account doesn't have access to it, and a403followed byThis API key isn't an admin key.Admin key path still honours
--validity:Follow-up
Unit tests for this change are intentionally not in this PR — they land in a separate follow-up. Production code shipping uncovered here: the
keyalias that makes-o jsonpath '{.key}'resolve on the session path, resolving the printer before the API call,--aclenforcement on the Search API path, and theauth.Remediationguidance on credential errors.GROUT-438