> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # CreateAppPermission # Package: appPermissions # Namespace: AppPermissionsService # Method link: https://dev.wix.com/docs/api-reference/app-management/app-permissions/create-app-permission.md ## Permission Scopes: Write Dev Center App Permissions: SCOPE.DEV_CENTER.WRITE_PERMISSIONS ## Introduction Adds a permission to the specified app. When users install your app on a site, it requests this permission. > **Important**: Disregard the **Authentication** note below. You can only call this method by authenticating with an account-level [API key](https://dev.wix.com/docs/rest/articles/get-started/api-keys.md). --- ## REST API ### Schema ``` Method: createAppPermission Description: Adds a permission to the specified app. When users install your app on a site, it requests this permission. > **Important**: Disregard the **Authentication** note below. You can only call this method by authenticating with an account-level [API key](https://dev.wix.com/docs/rest/articles/get-started/api-keys.md). URL: https://www.wixapis.com/apps/v1/app-permissions Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: appPermission, appPermission.appId, appPermission.permission, appPermission.permission.permissionId Method parameters: param name: appPermission | type: AppPermission | required: true - name: appId | type: string | description: App GUID. You can find the app GUID in the app's dashboard's [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home). | required: true - name: permission | type: Permission | description: Permission the app requests when installed on a site. Learn more [about permissions for Wix apps](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-permissions.md). | required: true - name: permissionId | type: string | description: Permission GUID. To find the permission GUID, navigate to the [Permissions page](https://dev.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%2Fdev-center-permissions/add) in the app's dashboard and search for the [permission you want to configure](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/configure-permissions-for-your-app.md#step-1--identify-required-permissions). | required: true Return type: CreateAppPermissionResponse - name: appPermission | type: AppPermission | description: Details of permission that was added to the app. - name: appId | type: string | description: App GUID. You can find the app GUID in the app's dashboard's [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home). - name: permission | type: Permission | description: Permission the app requests when installed on a site. Learn more [about permissions for Wix apps](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-permissions.md). - name: permissionId | type: string | description: Permission GUID. To find the permission GUID, navigate to the [Permissions page](https://dev.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%2Fdev-center-permissions/add) in the app's dashboard and search for the [permission you want to configure](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/configure-permissions-for-your-app.md#step-1--identify-required-permissions). - name: createdDate | type: string | description: When the permission was created. - name: updatedDate | type: string | description: When the permission was last updated. ``` ### Examples ### Add a permission to an app ```curl curl -X POST \ 'https://www.wixapis.com/apps/v1/app-permissions/v1/app-permissions' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -H 'wix-account-id: ' \ -d '{ "appPermission": { "appId": "73k98f4e-a8f3-4b7c-9d87-23fc55g793ec", "permission": { "permissionId": "SCOPE.DC-EVENTS.MANAGE-EVENTS" } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.appPermissions.AppPermissionsService.createAppPermission(appPermission) Description: Adds a permission to the specified app. When users install your app on a site, it requests this permission. > **Important**: Disregard the **Authentication** note below. You can only call this method by authenticating with an account-level [API key](https://dev.wix.com/docs/rest/articles/get-started/api-keys.md). # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: appPermission, appPermission.appId, appPermission.permission, appPermission.permission.permissionId Method parameters: param name: appPermission | type: AppPermission | required: true - name: appId | type: string | description: App GUID. You can find the app GUID in the app's dashboard's [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home). | required: true - name: permission | type: Permission | description: Permission the app requests when installed on a site. Learn more [about permissions for Wix apps](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-permissions.md). | required: true - name: permissionId | type: string | description: Permission GUID. To find the permission GUID, navigate to the [Permissions page](https://dev.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%2Fdev-center-permissions/add) in the app's dashboard and search for the [permission you want to configure](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/configure-permissions-for-your-app.md#step-1--identify-required-permissions). | required: true Return type: PROMISE - name: appId | type: string | description: App GUID. You can find the app GUID in the app's dashboard's [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home). - name: permission | type: Permission | description: Permission the app requests when installed on a site. Learn more [about permissions for Wix apps](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-permissions.md). - name: permissionId | type: string | description: Permission GUID. To find the permission GUID, navigate to the [Permissions page](https://dev.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%2Fdev-center-permissions/add) in the app's dashboard and search for the [permission you want to configure](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/configure-permissions-for-your-app.md#step-1--identify-required-permissions). - name: _createdDate | type: Date | description: When the permission was created. - name: _updatedDate | type: Date | description: When the permission was last updated. ``` ### Examples ### createAppPermission ```javascript import { appPermissions } from '@wix/app-management'; async function createAppPermission(appPermission) { const response = await appPermissions.createAppPermission(appPermission); }; ``` ### createAppPermission (with elevated permissions) ```javascript import { appPermissions } from '@wix/app-management'; import { auth } from '@wix/essentials'; async function myCreateAppPermissionMethod(appPermission) { const elevatedCreateAppPermission = auth.elevate(appPermissions.createAppPermission); const response = await elevatedCreateAppPermission(appPermission); } ``` ### createAppPermission (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { appPermissions } from '@wix/app-management'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { appPermissions }, // Include the auth strategy and host as relevant }); async function createAppPermission(appPermission) { const response = await myWixClient.appPermissions.createAppPermission(appPermission); }; ``` ---