register
Obtain an API key for QR code generation by providing your email address. This enables access to dynamic QR code creation and tracking features.
Instructions
Register for an API key. Provide your email to get a key immediately.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | Your email address. | ||
| label | No | An optional label to identify this API key. |
Implementation Reference
- packages/mcp/src/tools.ts:699-712 (handler)The "register" tool definition and its handler, which triggers a POST request to "/api/register".
register: { description: "Register for an API key. Provide your email to get a key immediately.", inputSchema: z.object({ email: z.string().email().describe("Your email address."), label: z .string() .optional() .describe("An optional label to identify this API key."), }), handler: async (input: { email: string; label?: string }) => { return apiRequest("/api/register", { method: "POST", body: input }); }, }, - src/modules/auth/auth.routes.ts:19-95 (handler)The backend implementation of the /api/register endpoint which corresponds to the MCP 'register' tool handler.
app.post( "/api/register", { config: { rateLimit: { max: 3, timeWindow: "1 hour", }, }, schema: { tags: ["Auth"], summary: "Register for an API key", description: "Self-service endpoint to obtain an API key. Provide your email address and receive a key immediately. Store the key securely — it will not be shown again. Rate-limited to 3 requests per hour per IP.", body: { type: "object" as const, required: ["email"], properties: { email: { type: "string", format: "email", description: "Your email address. Used to identify the key owner.", }, label: { type: "string", maxLength: 100, description: "Optional human-readable label for this API key (e.g., your app name). Defaults to the email address if not provided.", }, }, }, response: { 201: { type: "object", description: "The newly created API key. Store it securely.", properties: { key: { type: "string", description: "Your API key. Include it in the X-API-Key header for all authenticated requests.", }, label: { type: "string", description: "The label associated with this key.", }, message: { type: "string", description: "Important reminder about key storage.", }, }, }, }, }, }, async (request, reply) => { const parsed = registerBodySchema.safeParse(request.body); if (!parsed.success) { return sendError(reply, 400, { error: "Invalid request body.", code: "VALIDATION_ERROR", hint: "Provide a valid email address in the 'email' field. Optionally include a 'label' (max 100 characters).", }); } const { email, label } = parsed.data; const result = generateApiKey(label || email, email); sendWelcomeEmail(email, result.key, result.label); return reply.status(201).send({ key: result.key, label: result.label, message: "Store this key securely — it won't be shown again.", }); } );