HTTP Endpoints

HTTP endpoints let you build backend APIs that handle HTTP requests, serve data to frontend extensions, and integrate with external services. Endpoint files run on the server and can return any content type, including JSON, plain text, images, and RSS feeds.

HTTP endpoints aren't traditional extensions. Unlike other backend extension types, they have no configuration file and aren't registered in src/extensions.ts. Wix finds them from their location in the project.

Note: HTTP endpoints replace HTTP functions and web methods from the legacy Wix CLI for Apps. If your project uses either, see the migration guides for HTTP functions and web methods.

File-based routing

The location of an endpoint file in your project determines its URL. Endpoints are discovered from the file system, so there's no registration step. The folder depends on the project. In a Studio Two site or a Wix CLI app, endpoint files go in src/api/, and their routes have no /api prefix. In a Wix-managed headless project, they go in src/pages/api/, and their routes start with /api. For the full mapping from file paths to routes, see HTTP Endpoint Extension Files and Code.

How endpoints work

Each endpoint file exports one or more HTTP method handlers, such as GET or POST. A handler receives the incoming standard web Request, along with the request URL and any route parameters, and returns a standard Response.

Endpoints run server-side, so they can read environment variables, including secrets, call external services without exposing credentials to the client, and use Wix APIs with elevated permissions.

Calling endpoints from frontend extensions

Frontend extensions call endpoints using httpClient.fetchWithAuth() from @wix/essentials. This method attaches the current user's access token as an Authorization header. The endpoint can then use that token to make elevated SDK calls on behalf of the user.

Security and access control

HTTP endpoints don't have a built-in permissions model. Any caller who knows the URL can reach an endpoint. Access control is your responsibility: inspect the caller's token in the handler using getTokenInfo() from @wix/essentials and decide whether to proceed based on the caller's identity.

HTTP endpoints across development paths

The development path determines how you add HTTP endpoints:

  • Sites:
    • Studio Two: Add an HTTP endpoint to the site project from the Code tab through the Wix Extension Builder. Site code calls the site's own endpoints. See About HTTP Endpoints in Studio Two.
  • Wix-managed apps: Add HTTP endpoint files to your app project. See Add HTTP Endpoints to Your Project in Build Apps.
  • Wix-managed headless projects:
    • Full Wix integration (Astro): Add HTTP endpoint files to your headless project. See About HTTP Endpoints.
    • Other frameworks: Don't support HTTP endpoints directly. Follow the same approach as self-managed headless projects.
  • Self-managed headless projects and self-managed apps: Run their backends on infrastructure you manage, so they expose endpoints from their own stack instead. See Exposing APIs.

See also

Last updated: 11 November 2026

Did this help?