Fix Access Denied When Creating a SharePoint Site Through the API
Question details
Determine why a SharePoint app receives an access denied error when creating a site through an API.

- Product
- Microsoft SharePoint Online API
- Device & OS
- not provided
- Scenario
- An application attempts to create a SharePoint site using app-only authentication.
- Observed behavior
- The site creation request returns an UnauthorizedAccessException even though app-only permissions have been configured.
Identify the exact API endpoint, authentication method, tenant, and site type used by the request. Have an administrator available to review application permissions and tenant-wide consent.
Verify API permissions, consent, and app-only support
Use this check when an app-only site creation request returns an access denied error.
Review the request URL and method in your application or API client. Consult the documentation for that exact endpoint to confirm that it supports app-only site creation and identify its required permissions.
In the Microsoft Entra admin center, open App registrations, select the app, and choose API permissions. Verify that the required application permissions are configured for the API being called, rather than relying only on delegated permissions.
On the app's API permissions page, check the consent status. If consent is missing, ask a suitably authorized administrator to select Grant admin consent for the tenant.
Acquire a new token after any permission or consent changes. Inspect its audience and roles locally or with a trusted diagnostic tool to confirm that it targets the API being called and contains the expected application roles.
Compare the request body, site type, tenant settings, and authentication method with the endpoint's documentation. Some site creation operations have additional administrative requirements or do not support every app-only authentication method.

Request help from the SharePoint development community
Use this option if permissions and endpoint requirements appear correct but the request still fails.
Work with Office documents in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with documents, spreadsheets, and presentations. Its Office format support helps you move existing files into a new workflow, though it does not fix SharePoint API permissions or create SharePoint sites.

Frequently Asked Questions
Why can site creation fail even after I add app permissions?
Adding permissions is not always sufficient. Check tenant admin consent, the token audience and roles, the endpoint's app-only support, and any site creation prerequisites in the endpoint documentation.
Where can I check whether admin consent was granted?
In the Microsoft Entra admin center, open App registrations, select your app, and go to API permissions. Review the status for the required permissions and ask an authorized administrator to grant consent if needed.
Do I need a new token after changing permissions?
Yes. Acquire a new access token after permissions or consent change, then check its audience and roles before retrying the API request.
What should I include in a SharePoint development support question?
Include the endpoint, HTTP method, site type, authentication method, permission manifest, consent status, full error message, and any correlation ID or timestamp. Remove tokens, secrets, certificates, and sensitive tenant information.




