Skip to main content
Glama

api-key-rotate

Rotate platform API keys to maintain security by revoking old keys and generating new ones. Save the new key immediately after rotation.

Instructions

Rotate a platform API key — revokes the old key and returns a new one. Save the new key immediately.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hashYesAPI key hash to rotate

Implementation Reference

  • Handler function for the api-key-rotate tool.
    async (params) => {
      try {
        const result = await client.settings.rotateApiKey(params.hash);
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      } catch (err) {
        const message = err instanceof Error ? err.message : String(err);
        return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
      }
    },
  • Registration of the api-key-rotate tool.
    server.tool(
      "api-key-rotate",
      "Rotate a platform API key — revokes the old key and returns a new one. Save the new key immediately.",
      {
        hash: z.string().describe("API key hash to rotate"),
      },
      async (params) => {
        try {
          const result = await client.settings.rotateApiKey(params.hash);
          return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
        } catch (err) {
          const message = err instanceof Error ? err.message : String(err);
          return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
        }
      },
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ebenezer-isaac/llmconveyors-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server