Overview of API support in Azure Static Web Apps
Front end web applications often call back end APIs for data and services. Azure Static Web Apps provides built-in serverless API endpoints via integration with Azure services.
Key features of Azure Static Web Apps APIs include:
Integrated security with direct access to user authentication and role-based authorization data.
Seamless routing that makes the
/api
route available to the front-end web app without requiring custom CORS rules.
API options
The following Azure services can be integrated with Azure Static Web Apps:
Service | Managed | Bring your own |
---|---|---|
Azure Functions | ✔ | ✔ |
Azure API Management | ✔ | |
Azure App Service | ✔ | |
Azure Container Apps | ✔ |
- Managed APIs: By default, Azure Static Web Apps automatically integrates with Azure Functions as an API backend. You deploy an API with your static web app without managing a separate Azure Functions resource.
- Bring your own APIs: You can integrate your static web app with existing APIs hosted in Azure Functions, API Management, App Service, or Container Apps. You manage and deploy the API resources yourself.
Note
Bring your own APIs is only available in the Azure Static Web Apps Standard plan. Built-in, managed Azure Functions APIs are available in all Azure Static Web Apps plans.
API constraints
The following constraints apply to all API backends:
- Each static web app environment can only be configured with one type of backend API at a time.
- The API route prefix must be
/api
. - Route rules for APIs only support redirects and securing routes with roles.
- Only HTTP requests are supported for APIs. WebSocket, for example, is not supported.
- The maximum duration of each API request 45 seconds.
- Network isolated backends are not supported.
The following constraints apply to Bring your own API backends:
- An application must be deployed to your static web app before requests to the
/api
route can be resolved. - Bring your own API backends cannot be linked to a Static Web Apps pull request environment.
Next steps
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for