Skip to main content


This code is generated

These exports are not directly available in the convex package!

Instead you need to run npx convex dev to create convex/_generated/api.js and convex/_generated/api.d.ts.

These types require running code generation because they are specific to the Convex functions you define for your app.

If you aren't using code generation, you can use makeFunctionReference instead.


An object of type API describing your app's public Convex API.

Its API type includes information about the arguments and return types of your app's Convex functions.

The api object is used by client-side React hooks and Convex functions that run or schedule other functions.

import { api } from "../convex/_generated/api";
import { useQuery } from "convex/react";

const data = useQuery(api.messages.list);


Another object of type API describing your app's internal Convex API.

import { action } from "../_generated/server";
import { internal } from "../_generated/api";

export default action(async ({ runMutation }, { planId, ... }) => {
// Call out to payment provider (e.g. Stripe) to charge customer
const response = await fetch(...);
if (response.ok) {
// Mark the plan as "professional" in the Convex DB
await runMutation(internal.plans.markPlanAsProfessional, { planId });