MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / registerAPIKeys

Method registerAPIKeys

internal/httpapi/apikeys.go:70–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68type deleteAPIKeyOutput struct{ Status int }
69
70func (s *Server) registerAPIKeys() {
71 huma.Register(s.API, huma.Operation{
72 OperationID: "listApiKeys", Method: http.MethodGet, Path: "/v1/account/api-keys",
73 Summary: "List API keys", Tags: []string{"account"},
74 Description: "API keys for the account (metadata only — secrets are shown once, at creation). Account scope only: an agent-scoped credential cannot manage keys.",
75 Security: []map[string][]string{{"bearer": {}}},
76 }, s.handleListAPIKeys)
77
78 huma.Register(s.API, huma.Operation{
79 OperationID: "createApiKey", Method: http.MethodPost, Path: "/v1/account/api-keys",
80 Summary: "Create an API key", Tags: []string{"account"},
81 Description: "Mint a new API key; the plaintext key is returned once. scope=account is workspace admin (agent/domain/key management); scope=agent binds the key to one inbox so it can act only as that agent. Account scope only.",
82 Security: []map[string][]string{{"bearer": {}}}, DefaultStatus: http.StatusCreated,
83 }, s.handleCreateAPIKey)
84
85 huma.Register(s.API, huma.Operation{
86 OperationID: "deleteApiKey", Method: http.MethodDelete, Path: "/v1/account/api-keys/{id}",
87 Summary: "Revoke an API key", Tags: []string{"account"},
88 Description: "Revoke a key by id. Integrations using it stop authenticating immediately. Account scope only.",
89 Security: []map[string][]string{{"bearer": {}}}, DefaultStatus: http.StatusNoContent,
90 }, s.handleDeleteAPIKey)
91}
92
93func (s *Server) handleListAPIKeys(ctx context.Context, _ *struct{}) (*listAPIKeysOutput, error) {
94 user, err := s.requireAccountUser(ctx)

Callers 1

registerOperationsMethod · 0.95

Calls 1

RegisterMethod · 0.80

Tested by

no test coverage detected