Creating devices
This page explains how to create devices.
Before you begin
Perform the following tasks before proceeding with the information on this page:
Read the Devices API overview.
Creating a device
The following examples show how to create a device.
REST
To create a device, call
devices.create()
with the name of the customer (organization) and a
Device object.
Python
The following example shows how to create a device by using the Python client library:
"""Example script to use the create method of the Devices API."""
from google.oauth2 import service_account
from googleapiclient.discovery import build
SCOPES = ['https://www.googleapis.com/auth/cloud-identity.devices']
# Change this to the location of the service account key
SA_FILE = ''
# Enter the administrator to call as here.
ADMIN_EMAIL = ''
if not SA_FILE:
print('Please specify the location of the service account key file')
if not ADMIN_EMAIL:
print('Please specify the email of the administrator to call as')
if not SA_FILE or not ADMIN_EMAIL:
exit(-1)
credentials = service_account.Credentials.from_service_account_file(
SA_FILE, scopes=SCOPES, subject=ADMIN_EMAIL)
service = build('cloudidentity', 'v1', credentials=credentials)
device = {
'serialNumber': 'someSerial', # the serial number of your device.
# see values in
# https://cloud.google.com/identity/docs/reference/rest/v1/devices#DeviceType
'deviceType': 'LINUX'
}
request = service.devices().create(body=device)
response = request.execute()
print(response)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-12-03 UTC.