An idiomatic C++ client library for the Cloud IoT API, a service to register and manage IoT (Internet of Things) devices that connect to the Google Cloud Platform.
While this library is GA, please note Google Cloud C++ client libraries do not follow Semantic Versioning.
Quickstart
The following shows the code that you'll run in the google/cloud/iot/quickstart/ directory, which should give you a taste of the Cloud IoT API C++ client library API.
#include "google/cloud/iot/v1/device_manager_client.h"
#include "google/cloud/project.h"
#include <iostream>
int main(int argc, char* argv[]) try {
if (argc != 3) {
std::cerr << "Usage: " << argv[0] << " project-id location-id\n";
return 1;
}
namespace iot = ::google::cloud::iot_v1;
auto client = iot::DeviceManagerClient(iot::MakeDeviceManagerConnection());
auto const project = google::cloud::Project(argv[1]);
auto const parent = project.FullName() + "/locations/" + argv[2];
for (auto dr : client.ListDeviceRegistries(parent)) {
if (!dr) throw std::move(dr).status();
std::cout << dr->DebugString() << "\n";
}
return 0;
} catch (google::cloud::Status const& status) {
std::cerr << "google::cloud::Status thrown: " << status << "\n";
return 1;
}
Main classes
The main class in this library is iot_v1::DeviceManagerClient. All RPCs are exposed as member functions of this class. Other classes provide helpers, configuration parameters, and infrastructure to mock iot_v1::DeviceManagerClient when testing your application.
More Information
Error Handling - describes how the library reports errors.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis is the Cloud IoT API C++ Client Library, designed for managing IoT devices that connect to the Google Cloud Platform.\u003c/p\u003e\n"],["\u003cp\u003eThe library's primary class is \u003ccode\u003eiot_v1::DeviceManagerClient\u003c/code\u003e, which provides access to all Remote Procedure Calls (RPCs).\u003c/p\u003e\n"],["\u003cp\u003eWhile the library is generally available (GA), it does not use Semantic Versioning.\u003c/p\u003e\n"],["\u003cp\u003eThe quickstart guide offers code examples in the \u003ccode\u003egoogle/cloud/iot/quickstart/\u003c/code\u003e directory, demonstrating the library's usage.\u003c/p\u003e\n"],["\u003cp\u003eThe library offers the capability to override default endpoints, authentication credentials, retry policies, and also allows for the use of environment variables to configure the library.\u003c/p\u003e\n"]]],[],null,["Version 2.13.0keyboard_arrow_down\n\n- [2.15.0-rc (latest)](/cpp/docs/reference/iot/latest)\n- [2.14.0](/cpp/docs/reference/iot/2.14.0)\n- [2.13.0](/cpp/docs/reference/iot/2.13.0)\n- [2.12.0](/cpp/docs/reference/iot/2.12.0)\n- [2.11.0](/cpp/docs/reference/iot/2.11.0) \n\nCloud IoT API C++ Client Library\n================================\n\nAn idiomatic C++ client library for the [Cloud IoT API](https://cloud.google.com/iot), a service to register and manage IoT (Internet of Things) devices that connect to the Google Cloud Platform.\n\nWhile this library is **GA** , please note Google Cloud C++ client libraries do **not** follow [Semantic Versioning](https://semver.org/).\n\n### Quickstart\n\nThe following shows the code that you'll run in the `google/cloud/iot/quickstart/` directory, which should give you a taste of the Cloud IoT API C++ client library API. \n\n #include \"google/cloud/iot/v1/device_manager_client.h\"\n #include \"google/cloud/project.h\"\n #include \u003ciostream\u003e\n\n int main(int argc, char* argv[]) try {\n if (argc != 3) {\n std::cerr \u003c\u003c \"Usage: \" \u003c\u003c argv[0] \u003c\u003c \" project-id location-id\\n\";\n return 1;\n }\n\n namespace iot = ::google::cloud::iot_v1;\n auto client = iot::DeviceManagerClient(iot::MakeDeviceManagerConnection());\n\n auto const project = google::cloud::Project(argv[1]);\n auto const parent = project.FullName() + \"/locations/\" + argv[2];\n for (auto dr : client.ListDeviceRegistries(parent)) {\n if (!dr) throw std::move(dr).status();\n std::cout \u003c\u003c dr-\u003eDebugString() \u003c\u003c \"\\n\";\n }\n\n return 0;\n } catch (google::cloud::Status const& status) {\n std::cerr \u003c\u003c \"google::cloud::Status thrown: \" \u003c\u003c status \u003c\u003c \"\\n\";\n return 1;\n }\n\n### Main classes\n\nThe main class in this library is [`iot_v1::DeviceManagerClient`](/cpp/docs/reference/iot/2.13.0/classgoogle_1_1cloud_1_1iot__v1_1_1DeviceManagerClient). All RPCs are exposed as member functions of this class. Other classes provide helpers, configuration parameters, and infrastructure to mock [`iot_v1::DeviceManagerClient`](/cpp/docs/reference/iot/2.13.0/classgoogle_1_1cloud_1_1iot__v1_1_1DeviceManagerClient) when testing your application.\n\n### More Information\n\n- [Error Handling](https://cloud.google.com/cpp/docs/reference/common/latest/common-error-handling.html) - describes how the library reports errors.\n- [How to Override the Default Endpoint](/cpp/docs/reference/iot/2.13.0/iot-override-endpoint) - describes how to override the default endpoint.\n- [How to Override the Authentication Credentials](/cpp/docs/reference/iot/2.13.0/iot-override-authentication) - describes how to change the authentication credentials used by the library.\n- [Override Retry, Backoff, and Idempotency Policies](/cpp/docs/reference/iot/2.13.0/iot-override-retry) - describes how to change the default retry policies.\n- [Environment Variables](/cpp/docs/reference/iot/2.13.0/iot-env) - describes environment variables that can configure the behavior of the library."]]