Upload a list of devices to create a new batch for the specified customer

Applies To

  • Partner Center
  • Partner Center for Microsoft Cloud Germany

How to upload a list of information about devices to create a new batch for the specified customer. This creates a device batch for enrollment in zero-touch deployment, and associates the devices and the device batch with the specified customer.


  • Credentials as described in Partner Center authentication. This scenario supports authentication with both standalone App and App+User credentials.
  • The customer identifier.
  • The list of device resources that provide the information about the individual devices.


To upload a list of devices to create a new device batch, first, instantiate a new List of type Device and populate the list with the devices. The following combinations of populated properties are required at a minimum for identifying each device:

Next, instantiate a DeviceBatchCreationRequest object and set the BatchId property to a unique name of your choosing, and the Devices property to the list of devices to upload. Then, to process the device batch creation request, call the IAggregatePartner.Customers.ById method with the customer identifier to retrieve an interface to operations on the specified customer. Finally, call the DeviceBatches.Create or CreateAsync method with the device batch creation request to create the batch.

IAggregatePartner partnerOperations;
string selectedCustomerId;       

List<Device> devicesToBeUploaded = new List<Device>
    new Device
        HardwareHash = "DummyHash123",
        ProductKey = "00329-00000-0003-AA606",
        SerialNumber = "1R9-ZNP67"

    newDeviceBatch = new DeviceBatchCreationRequest
    BatchId = "SDKTestDeviceBatch",
    Devices = devicesToBeUploaded

var trackingLocation = 

Sample: Console test app. Project: Partner Center SDK Samples Class: CreateDeviceBatch.cs


Request syntax

Method Request URI
POST {baseURL}/v1/customers/{customer-id}/deviceBatches HTTP/1.1

URI parameter

Use the following path parameters when creating the request.

Name Type Required Description
customer-id string Yes A GUID-formatted string that identifies the customer.

Request headers

Request body

The request body must contain a DeviceBatchCreationRequest resource.

Request example

POST https://api.partnercenter.microsoft.com/v1/customers/c7f3c849-129f-4b85-a96d-4f8e88b315a3/deviceBatches HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: c245d5f2-1de3-4ae0-9e42-95e38e3cb8ff
MS-CorrelationId: e3f26e6a-044f-4371-ad52-0d91ce4200be
X-Locale: en-US
MS-PartnerCenter-Application: Partner Center .NET SDK Samples
Content-Type: application/json
Host: api.partnercenter.microsoft.com
Content-Length: 340
Expect: 100-continue
Connection: Keep-Alive
    "BatchId": "SDKTestDeviceBatch",
    "Devices": [{
            "Id": null,
            "SerialNumber": "1R9-ZNP67",
            "ProductKey": "00329-00000-0003-AA606",
            "HardwareHash": "DummyHash123",
            "Policies": null,
            "CreatedBy": null,
            "UploadedDate": "0001-01-01T00:00:00",
            "AllowedOperations": null,
            "Attributes": {
                "ObjectType": "Device"
    "Attributes": {
        "ObjectType": "DeviceBatchCreationRequest"


If successful, the response contains a Location header that has a URI that can be used to retrieve device upload status. Save this URI for use with other related REST APIs.

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 REST error codes.

Response example

HTTP/1.1 202 Accepted
Content-Length: 0
Location: /customers/c7f3c849-129f-4b85-a96d-4f8e88b315a3/batchJobStatus/beba2053-5401-46ff-9223-7e841ed78fbf
MS-CorrelationId: 772871a9-399b-4f3b-b8c7-38f550e4f22a
MS-RequestId: cb82f7d6-f0d9-44d4-82f9-f6eee6e68390
MS-CV: iqOqN0FnaE2y0HcD.0
MS-ServerId: 030020525
Date: Thu, 28 Sep 2017 20:35:35 GMT