---
schema_version: "1"
id: f8767769e9b937e8e2f63dff044368902ea3cd7bb5ad7656b6c561e0381d89fa
title: Assign Licenses Using the API
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/package_license_api.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.package_license_api.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: de65fc7f8a1cf1e85746d7889328949988d73590c2a225d79c002683e0259eaa
description: Admins can use the API to assign or revoke licenses for any managed package installed in their org.
products:
  - Salesforce Platform
  - Cross Cloud
release: "264"
---
# Assign Licenses Using the API

Admins can use the API to assign or revoke licenses for any managed package installed in their org.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Salesforce Classic (not available in all orgs)</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Group</strong>, <strong>Professional</strong>, <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
      <colgroup>
        <col style="width:50%">
        <col style="width:50%">
      </colgroup>
      <thead class="slds-text-title_caps ">
        <tr class="">
          <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d16086e78">User Permissions Needed</th>
        </tr>
      </thead>
      <tbody>
        <tr class="">
          <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d16086e78 ">To manage licenses for an AppExchange app:</td>

          <td class="slds-cell-wrap" style="vertical-align:top;" headers="d16086e78 ">Manage Package Licenses</td>

        </tr>
      </tbody>
    </table>

License information for a package is stored in two objects, PackageLicense and UserPackageLicense, which are also accessible from the Manage Licenses page under Setup. These objects are also accessible as standard objects, so an admin can assign licenses to specific users via API calls. This makes managing package licenses in a subscriber org faster and easier, especially for large-scale deployments.

For example, suppose an admin installs an app for use by all 200 salespeople in the company. Assigning a license to each salesperson from the UI is inefficient and time-consuming. Using the API, the administrator can assign licenses to all salespeople, based on their profile, in one step.

Here are some common licensing tasks that administrators can use the API to do.

- Determine the number of package licenses in use and available.
- Verify if a specific user has a license for the package.
- Get a list of all users who have a license for the package.
- Assign a package license to a user or group of users.
- Revoke a package license that was previously assigned to a user.

For details of the PackageLicense and UserPackageLicense objects and a code sample, see the [Object Reference for Salesforce and Lightning Platform](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/).