Check inventory by resource type using Partner Center APIs

How to check the inventory for catalog items filtered by a specific resource type.

Prerequisites

  • Credentials as described in Partner Center authentication. This scenario supports authentication with both standalone App and App+User credentials.

  • Product IDs (optional). SKU IDs (optional).

  • A valid resourceType value (required). See Supported resource types for the full list of accepted values.

  • Any additional context needed for verifying the inventory of the SKUs referenced by the provided product/SKU IDs. These requirements might vary by type of product/SKU and can be determined from the SKU's InventoryVariables property.

REST request

Request syntax

Method Request URI
POST {baseURL}/v1/extensions/product/checkinventorybyresourcetype?country={country-code}&resourceType={resourceTypeValue} HTTP/1.1

URI parameters

Use the following query parameters to check inventory by resource type.

Name Type Required Description
country-code string Yes A country/region ID.
resourceTypeValue string Yes The resource type to filter inventory results. See Supported resource types for valid values.

Supported resource types

Resource type value Description Region Required?
AppService App Service Yes
Avs Azure VMware Solution Yes
AzureDataExplorer Azure Data Explorer No - exclude Region to avoid a 400 bad request error
AzureFiles Azure Files Yes
Backup Azure Backup Yes
BlockBlob Block Blob Storage Yes
CopilotCredit Copilot Credit No - exclude Region to avoid a 400 bad request error
CosmosDb Azure Cosmos DB No - exclude Region to avoid a 400 bad request error
Databricks Azure Databricks No - exclude Region to avoid a 400 bad request error
DataFactory Azure Data Factory Yes
DedicatedHost Azure Dedicated Host Yes
FabricCapacity Microsoft Fabric Capacity Yes
FoundryAgent Foundry Agent No - exclude Region to avoid a 400 bad request error
GitHubAICredit GitHub AI Credit No - exclude Region to avoid a 400 bad request error
GitHubP3 GitHub P3 No - exclude Region to avoid a 400 bad request error
ManagedDisk Azure Managed Disk Yes
MariaDB Azure Database for MariaDB Yes
MDC Microsoft Defender for Cloud No - exclude Region to avoid a 400 bad request error
MySql Azure Database for MySQL Yes
NetAppStorage Azure NetApp Files Yes
Nutanix Nutanix Yes
OpenAIPTU Azure OpenAI PTU Yes
PostgreSql Azure Database for PostgreSQL Yes
RedHat Red Hat No - exclude Region to avoid a 400 bad request error
RedHatOsa Red Hat OpenShift on Azure No - exclude Region to avoid a 400 bad request error
RedisCache Azure Cache for Redis Yes
SapHana SAP HANA on Azure Yes
Sentinel Microsoft Sentinel No - exclude Region to avoid a 400 bad request error
SqlDatabases Azure SQL Databases Yes
SqlDataWarehouse Azure SQL Data Warehouse Yes
SuseLinux SUSE Linux No - exclude Region to avoid a 400 bad request error
Synapse Azure Synapse Analytics No - exclude Region to avoid a 400 bad request error
VirtualMachines Azure Virtual Machines Yes
VMwareCloudSimple VMware CloudSimple Yes

Request headers

For more information, see Partner Center REST headers.

Request body

The inventory request details, consisting of an InventoryCheckRequest resource containing one or more InventoryItem resources.

Ensure the Azure Subscription specified in the request body is registered and enabled to purchase Azure RIs. See Register a Subscription for details on the registration process.

TargetItems is optional. If you exclude it or set it to null or [], the response includes all items for the resource type. If you include it, the response filters to those product IDs. Each TargetItems entry must have a non-blank ProductId, or the request returns a 400.

Best practice: Pass TargetItems with only the product IDs you need to keep the responses smaller, faster, and relevant. Otherwise, broad resource types such as VirtualMachines can return thousands of items.

Request example

POST https://api.partnercenter.microsoft.com/v1/extensions/product/checkinventorybyresourcetype?country=US&resourceType=VirtualMachines HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: d1b1981a-e088-4610-870a-eebec96d6bcd
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
X-Locale: en-US
Content-Type: application/json

{"TargetItems":[{"ProductId":"DZH318Z0BQ3P"}],"InventoryContext":{"customerId":"d6bf25b7-e0a8-4f2d-a31b-97b55cfc774d","azureSubscriptionId":"3A231FBE-37FE-4410-93FD-730D3D5D4C75","armRegionName":"westeurope"}}

REST response

If successful, the response body contains a collection of InventoryItem objects populated with the restriction details, if any apply.

Note

If an input InventoryItem represents an item that could not be found in the catalog, or does not correspond to the specified resource type, it will not be included in the output collection.

Response success and error codes

Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters. For the full list, see Partner Center error codes.

Response example

HTTP/1.1 200 OK
Content-Length: 1021
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: d1b1981a-e088-4610-870a-eebec96d6bcd
X-Locale: en-US
[
    {
        "productId": "DZH318Z0BQ3P",
        "skuId": "0039",
        "isRestricted": true,
        "restrictions": [
            {
                "reasonCode": "NotAvailableForSubscription",
                "description": "Restriction identified of type 'Location' with values 'japanwest'.",
                "properties": {
                    "type": "Location",
                    "values": "japanwest"
                }
            }
        ]
    },
    {
        "productId": "DZH318Z0BQ3P",
        "skuId": "0038",
        "isRestricted": false,
        "restrictions": []
    }
]

Products not returned in response

If a product or SKU is available for the specified subscription and region but is subject to restrictions, the response includes the product with isRestricted: true and the applicable restriction details.

If a product isn't available for the specified subscription and region, the response omits the product entirely.

Important

Treat a product that's missing from the response as unavailable for the specified subscription and region only.

Scenario CheckInventoryByResourceType response
Product not available for subscription/region Product omitted from response
SKU available isRestricted: false
SKU restricted in region Returned with isRestricted: true