# MonetizeKit — Agent Guide You are integrating with MonetizeKit, a monetization control plane (plans, entitlements, metering, credits, subscriptions). Use this guide to call the API. ## Base URL https://app.monetizekit.app ## Authentication All API requests require an API key via the `Authorization` header: Authorization: Bearer mk_live_xxx Create keys in the dashboard (Settings → API Keys). Keys are workspace-scoped and carry scopes (e.g. `catalog:view`, `customers:create`, `usage:write`). Requests are rate limited; responses include `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` headers. Mutations accept an `Idempotency-Key` header. ## Core REST endpoints (`/api/v1`) - Catalog (read+write): `/catalog/products`, `/catalog/meters`, `/catalog/addons`, `/catalog/promotions`, `/plans`, `/features` — GET (list), POST (create), GET/PATCH/DELETE on `/{id}`. - Customers: GET/POST `/customers`, GET/PATCH/DELETE `/customers/{id}`. - Subscriptions: POST `/subscriptions`, PATCH/DELETE `/subscriptions/{id}`. - Entitlements: GET `/entitlements/{customerId}` and `/entitlements/{customerId}/{featureKey}` (single check). - Usage: POST `/usage/events` (record), GET `/usage/{customerId}/{meterId}`. - Credits: GET `/credits/{customerId}`, POST `/credits/grant`, `/credits/debit`. - Budgets: GET/POST `/budgets`, GET/PATCH/DELETE `/budgets/{id}`. - Webhooks: GET/POST `/webhooks/endpoints`, `/webhooks/endpoints/{id}`, GET `/webhooks/deliveries`. - Contracts, integrations, members, audit, activity are also exposed under `/api/v1`. ## Discoverability - OpenAPI 3.1 spec: `GET https://app.monetizekit.app/api/v1/openapi.json` - GraphQL endpoint: `POST https://app.monetizekit.app/api/graphql` (same API-key auth) - MCP (JSON-RPC) endpoint: `POST https://app.monetizekit.app/api/mcp` - Concise agent brief: https://learning.monetizekit.app/llms.txt - Complete hashed route index: https://learning.monetizekit.app/llms-index.txt - Full normalized documentation corpus: https://learning.monetizekit.app/llms-full.txt - Task bundles: - quickstarts: https://learning.monetizekit.app/llms-bundles/quickstarts - errors: https://learning.monetizekit.app/llms-bundles/errors - webhooks: https://learning.monetizekit.app/llms-bundles/webhooks - sdk-node: https://learning.monetizekit.app/llms-bundles/sdk-node - metering: https://learning.monetizekit.app/llms-bundles/metering ## Webhooks Outbound events are signed. Verify with HMAC-SHA256 over `"{timestamp}.{rawBody}"` using your endpoint secret; compare against the `X-MonetizeKit-Signature` (`sha256=...`) header. The `@monetizekit/node` SDK exports `verifyWebhookSignature`. ## SDKs & tooling - Node SDK: `npm install @monetizekit/node` - CLI: `npm install -g @monetizekit/cli` then `mk` (catalog, customers, usage, etc.) ## Typical flow 1. Create a product, features, and a plan in the catalog. 2. Create a customer and a subscription to the plan. 3. Check entitlements: `GET /api/v1/entitlements/{customerId}/{featureKey}`. 4. Report usage: `POST /api/v1/usage/events` with `{ customerId, meterId, value }`. 5. Subscribe to webhooks for state changes and verify signatures. Always read the OpenAPI spec for exact request/response schemas before calling.