Remove of return code "40" in smartRest 1.0

Hi Community,

Due to a customer request, we noticed that a change in the SmartRest 1.0 API is planned:

Smart REST response codes

With the 10.9 GA release in April 2021, the error code “40” will be removed.

Why are we doing this? Currently, when connecting to Cumulocity IoT via SmartREST 1.0 you may receive an error “40”, often looking like this:

40,/meta/connect,402::Unknown client

This error means that the platform has restarted, the session has expired, or some other connectivity problem occurred. The number is misleading though, as according to the documentation “40” means “Template not found”.

After the error code “40” has been removed the error will look like this:


No change is required for devices integrated via our Device SDK and agents. However, be aware of this change, in case you have designed your own device integration.

I checked the official agent for C implementations on bitbucket and I wonder if it will still work with the changes planned for April. Can you confirm that the code will still work at this point: Line 69:

int registerSrTemplate(SrNetHttp &http, std::string &srv, const std::string &srt)
    // send empty SmartREST request
    if ("") <= 0)
        return -1;

    // check server response
    SrLexer lex(http.response());
    SrLexer::SrToken t =;

    if (t.second == "40")
    {   // device implementation is unknown


        // send SmartREST template for registration
        if ( <= 0)
            return -1;

        // get response code
        t =;

    if (t.second == "20")
    {   // device implementation is known

        // store "shorthand" id, can be used in X-ID header field of later requests
        srv =;

        return 0;

    return -1;

Please let me know if there are changes in the agent necessary. If yes, will it be pushed to bitbucket?

Hi Gerhard,

We won’t remove “40” completely. As in the announcement, we will keep “40” for the meaning of “template not found”.
In the Device SDKs, “40” is used for the meaning of “template not found”. The code you pasted from C++SDK is exactly checking if the SmartREST template is already registered or not. In conclusion, they won’t get affected after the changes and no change is required in the existing device SDKs.

Hi Rina,

thank you for clarification.

This topic was automatically closed after 1083 days. New replies are no longer allowed.