import type { Metadata } from "next"; import { requireUser } from "@/lib/auth"; import { prisma } from "@/lib/db"; import { env } from "@/lib/env"; import { ApiKeys } from "@/components/settings/Forms"; export const metadata: Metadata = { title: "API-Schlüssel" }; export default async function ApiPage() { const user = await requireUser("/einstellungen/api"); const keys = await prisma.apiKey.findMany({ where: { userId: user.id, revokedAt: null }, orderBy: { createdAt: "desc" }, select: { id: true, name: true, prefix: true, lastUsedAt: true, createdAt: true }, }); const example = [ 'curl -H "Authorization: Bearer " \\', ` ${env.appUrl}/api/v1/bibliothek?status=WATCHING`, ].join("\n"); return (

API-Schlüssel

Für Skripte und eigene Anwendungen. Ein Schlüssel hat dieselben Rechte wie dein Konto — gib ihn nicht weiter und zieh ihn zurück, sobald du ihn nicht mehr brauchst.

So wird er benutzt

          {example}
        

Die vollständige Beschreibung steht in{" "} openapi.json {" "} und in docs/API.md im Repository.

); }