---
title: "nuxt-backend/http"
description: "Every export of nuxt-backend/http, with its signature and where it is defined."
canonical_url: "https://nuxt-backend.dev/docs/reference/api/http"
---
# nuxt-backend/http

## Interfaces

### RegisterBackendRoutesOptions

Defined in: [src/convex/integrations/http.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts)

One call to mount every inbound route the backend handles on your Convex
HTTP router: the auth routes, the agent (MCP) token exchange, the guarded
billing events endpoint (entitlement refresh + gift fulfilment), the
guarded email delivery-events endpoint (status tracking), and the metered
AI stream endpoint. Each part is required: a route left unmounted fails
only when a provider or a client first calls it.

The webhook endpoints share one fail-closed policy (see `webhook-guard.ts`):
missing secret → 503, invalid signature → 403 (±5 min replay tolerance),
oversized → 413, authentic-but-unknown type → 202, handler throw → 500 so
the provider retries, redelivery of a processed id → 200. Every request's
outcome lands in the component's delivery log.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="auth">
        
      </a>
      
       <code>
        auth
      </code>
    </td>
    
    <td>
      { <code>
        authComponent
      </code>
      
      : { <code>
        registerRoutes
      </code>
      
      : (...<code>
        args
      </code>
      
      ) => <code>
        void
      </code>
      
      ; }; <code>
        createAuth
      </code>
      
      : <code>
        unknown
      </code>
      
      ; <code>
        mcp
      </code>
      
      : { <code>
        exchangeHandler
      </code>
      
      : (<code>
        ctx
      </code>
      
      , <code>
        request
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Response
      </code>
      
      >; }; }
    </td>
    
    <td>
      From <code>
        setupAuth
      </code>
      
      : mounts the auth HTTP routes, and the agent token exchange (its <code>
        mcp
      </code>
      
       export) at <a href="#mcpexchangepath">
        RegisterBackendRoutesOptions.mcpExchangePath
      </a>
      
      , where the Nuxt MCP gate trades agents' OAuth Bearers for short-lived Convex JWTs.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        auth.authComponent
      </code>
    </td>
    
    <td>
      { <code>
        registerRoutes
      </code>
      
      : (...<code>
        args
      </code>
      
      ) => <code>
        void
      </code>
      
      ; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        auth.authComponent.registerRoutes
      </code>
    </td>
    
    <td>
      (...<code>
        args
      </code>
      
      ) => <code>
        void
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        auth.createAuth
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        auth.mcp
      </code>
    </td>
    
    <td>
      { <code>
        exchangeHandler
      </code>
      
      : (<code>
        ctx
      </code>
      
      , <code>
        request
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Response
      </code>
      
      >; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        auth.mcp.exchangeHandler
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        request
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Response
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="billing">
        
      </a>
      
       <code>
        billing
      </code>
    </td>
    
    <td>
      { <code>
        webhookHandler
      </code>
      
      : (<code>
        ctx
      </code>
      
      , <code>
        request
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Response
      </code>
      
      >; }
    </td>
    
    <td>
      From <code>
        setupBilling
      </code>
      
      : mounts the guarded billing events webhook at <a href="#billingpath">
        RegisterBackendRoutesOptions.billingPath
      </a>
      
       (fail-closed statuses, redelivery dedupe, delivery logging — pass the whole <code>
        billing
      </code>
      
       instance).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing.webhookHandler
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        request
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Response
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="email">
        
      </a>
      
       <code>
        email
      </code>
    </td>
    
    <td>
      { <code>
        webhookHandler
      </code>
      
      : (<code>
        ctx
      </code>
      
      , <code>
        request
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Response
      </code>
      
      >; }
    </td>
    
    <td>
      From <code>
        setupEmail
      </code>
      
      : mounts the email events webhook at <a href="#emailpath">
        RegisterBackendRoutesOptions.emailPath
      </a>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email.webhookHandler
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        request
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Response
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="ai">
        
      </a>
      
       <code>
        ai
      </code>
    </td>
    
    <td>
      { <code>
        httpHandler
      </code>
      
      : <code>
        unknown
      </code>
      
      ; <code>
        corsOrigin
      </code>
      
      : <code>
        string
      </code>
      
      ; }
    </td>
    
    <td>
      From <code>
        setupAi
      </code>
      
      : mounts the metered stream endpoint at <a href="#aipath">
        RegisterBackendRoutesOptions.aiPath
      </a>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ai.httpHandler
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ai.corsOrigin
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="billingpath">
        
      </a>
      
       <code>
        billingPath?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Route for the billing events webhook. Default <code>
        /billing/events
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="emailpath">
        
      </a>
      
       <code>
        emailPath?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Route for the email events webhook. Default <code>
        /email/events
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="aipath">
        
      </a>
      
       <code>
        aiPath?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Route for the AI stream endpoint. Default <code>
        /ai/stream
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="mcpexchangepath">
        
      </a>
      
       <code>
        mcpExchangePath?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Route for the agent token exchange. Default <code>
        /mcp/exchange
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts" rel="nofollow">
        src/convex/integrations/http.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Functions

### registerBackendRoutes()

```ts
function registerBackendRoutes(http, options): void;
```

Defined in: [src/convex/integrations/http.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/http.ts)

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        http
      </code>
    </td>
    
    <td>
      <code>
        HttpRouter
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options
      </code>
    </td>
    
    <td>
      <a href="#registerbackendroutesoptions">
        <code>
          RegisterBackendRoutesOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

`void`

#### Example

```ts
// convex/http.ts
import { registerBackendRoutes } from 'nuxt-backend/http'
import { httpRouter } from 'convex/server'
import { components } from './_generated/api'
import { ai } from './ai'
import { authComponent, createAuth, mcp } from './auth'
import { billing } from './billing'
import { email } from './email'

const http = httpRouter()
registerBackendRoutes(http, { auth: { authComponent, createAuth, mcp }, billing, email, ai })
export default http
```


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
