MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / createApiKey

Method createApiKey

frontend/src/api/api-keys.ts:62–80  ·  view source on GitHub ↗

* Create a new API key * @param input - Key name, optional active-window bounds, and optional * org binding (see ``CreateApiKeyInput.org_id``).

(
    input: CreateApiKeyInput,
  )

Source from the content-addressed store, hash-verified

60 * org binding (see ``CreateApiKeyInput.org_id``).
61 */
62 static async createApiKey(
63 input: CreateApiKeyInput,
64 ): Promise<CreateApiKeyResponse> {
65 // Forward the raw ``org_id`` field as-is so that an explicit ``null``
66 // ("All orgs" / unbound key) is preserved through the JSON request.
67 const body: Record<string, unknown> = {
68 name: input.name,
69 not_before: input.not_before ?? undefined,
70 expires_at: input.expires_at ?? undefined,
71 };
72 if ("org_id" in input) {
73 body.org_id = input.org_id;
74 }
75 const { data } = await openHands.post<CreateApiKeyResponse>(
76 "/api/keys",
77 body,
78 );
79 return data;
80 }
81
82 /**
83 * Delete an API key

Callers 1

useCreateApiKeyFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected