API Reference


import { createNextRouteHandler } from "uploadthing/next";
import { ourFileRouter } from "./uploadthing.ts";
export const { GET, POST } = createNextRouteHandler({
  router: ourFileRouter,
  config: {
    uploadthingId: "someId",
    uploadthingSecret: "someSecret",

config Object

This configuration is entirely optional, but may be useful if you would like to programmatically set your UploadThing credentials. If you do not specify a config we will use the UPLOADTHING_SECRET and UPLOADTHING_APP_ID environment variables.

uploadthingIdstringNoThe App ID for your uploadthing app
uploadthingSecretstringNoThe API key for your uploadthing app
callbackUrlstringNoCustom callback URL to use instead of <BASE_URL>/api/uploadthing.

Note: This same configuration object is also available for the createNextPageApiHandler function if you are using /pages.