> ## Documentation Index
> Fetch the complete documentation index at: https://help.commbox.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Object Stream

> This API allows developers to change the stream (channel and subchannel) of an existing conversation by providing the conversation’s **object_Id** in the path and numeric **channel_Id** and **subchannel_Id** in the request body. (Encrypted format can not be used in this API) 

 #### Available routes: 
  **Same-Channel Routing**

(Conversations remain within the same channel type):
-  SMS (Texting) → SMS
-  Email → Email
-  Chat → Chat

 **Cross-Channel Routing**

(Conversations transfer to different channel types):
-  SMS (Texting) → Email / Chat
- Email → SMS / Chat
-  Chat → SMS / Email
-  WhatsApp → SMS / Email / Chat
-  Any channel → Theme


 For the General subchannel ID, enter “0” in the substreamId field.

## OpenAPI

````json PATCH /objects/{OBJECT_ID}/stream
{
  "openapi": "3.0.3",
  "info": {
    "title": "CommBox API",
    "x-logo": {
      "url": "https://www.commbox.io/logo/commbox_logo_large.png"
    },
    "version": "2.07",
    "termsOfService": "https://www.commbox.io/end-user-license-agreement-eula/",
    "contact": {
      "name": "commbox",
      "url": "https://www.commbox.io",
      "email": "contactus@commbox.io"
    }
  },
  "servers": [
    {
      "url": "https://api.commbox.io/",
      "description": "Production server"
    }
  ],
  "paths": {
    "/objects/{OBJECT_ID}/stream": {
      "patch": {
        "tags": [
          "Objects"
        ],
        "summary": "Update Object Stream",
        "description": "This API allows developers to change the stream (channel and subchannel) of an existing conversation by providing the conversation’s **object_Id** in the path and numeric **channel_Id** and **subchannel_Id** in the request body. (Encrypted format can not be used in this API) \n\n #### Available routes: \n  **Same-Channel Routing**\n\n(Conversations remain within the same channel type):\n-  SMS (Texting) → SMS\n-  Email → Email\n-  Chat → Chat\n\n **Cross-Channel Routing**\n\n(Conversations transfer to different channel types):\n-  SMS (Texting) → Email / Chat\n- Email → SMS / Chat\n-  Chat → SMS / Email\n-  WhatsApp → SMS / Email / Chat\n-  Any channel → Theme\n\n\n For the General subchannel ID, enter “0” in the substreamId field.",
        "operationId": "Update_Object_Stream",
        "parameters": [
          {
            "name": "OBJECT_ID",
            "description": "Conversation Id number",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/parameters/OBJECT_ID/schema"
            }
          }
        ],
        "requestBody": {
          "description": "Enter the streamId of the **target** channel (where the conversation is routed to)\n\n**Note**: Channel ID and Subchannel Id must be numeric - Encrypted format will **not** be accepted",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "object",
                    "properties": {
                      "streamId": {
                        "type": "integer",
                        "format": "int64",
                        "description": "Enter the streamId of the target channel",
                        "example": 3172
                      },
                      "subStreamId": {
                        "type": "integer",
                        "format": "int64",
                        "description": "Enter the substreamId (subchannel) of the target channel (optional).<br> For routing conversation to the main channel set the subStreamId to “0”",
                        "example": 812
                      }
                    }
                  }
                }
              },
              "examples": {
                "Update stream": {
                  "value": {
                    "data": {
                      "streamId": 12345
                    }
                  }
                },
                "Update stream and sub-stream": {
                  "value": {
                    "data": {
                      "streamId": 12345,
                      "subStreamId": 67890
                    }
                  }
                },
                "Reset substream": {
                  "value": {
                    "data": {
                      "streamId": 12345,
                      "subStreamId": 0
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation successful or no change needed",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "integer",
                          "example": 200
                        },
                        "description": {
                          "type": "string",
                          "example": "Stream and sub-stream values unchanged"
                        },
                        "response_time": {
                          "type": "string",
                          "format": "date-time",
                          "example": "2025-04-15T07:17:54.6612907Z"
                        },
                        "data": {
                          "type": "string",
                          "example": ""
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "success": {
                    "value": {
                      "status": 200,
                      "description": "Operation successful",
                      "response_time": "2025-04-15T07:23:18.4795014Z",
                      "data": {
                        "streamId": 15524,
                        "subStreamId": 2341,
                        "updatedTime": "2025-04-15T07:23:18:479"
                      }
                    }
                  },
                  "no-change": {
                    "value": {
                      "status": 200,
                      "description": "Stream and sub-stream values unchanged",
                      "response_time": "2025-04-15T07:17:54.6612907Z",
                      "data": ""
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The server could not process the request due to missing or invalid information.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "integer",
                          "example": 400
                        },
                        "description": {
                          "type": "string"
                        },
                        "response_time": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "data": {
                          "type": "string",
                          "nullable": true
                        }
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "integer",
                          "example": 400
                        },
                        "description": {
                          "type": "string"
                        },
                        "response_time": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "errors": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "oneOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "object"
                                      }
                                    ]
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "Invalid parameters": {
                    "value": {
                      "status": 400,
                      "description": "Invalid parameters",
                      "response_time": "2025-04-15T07:04:20.6572144Z",
                      "data": ""
                    }
                  },
                  "Missing streamId": {
                    "value": {
                      "status": 400,
                      "description": "Invalid parameters - missing mandatory field - streamId",
                      "response_time": "2025-04-15T07:04:20.6572144Z",
                      "data": ""
                    }
                  },
                  "Object not found": {
                    "value": {
                      "status": 400,
                      "description": "Object not found",
                      "response_time": "2025-04-15T07:00:52.1683555Z",
                      "data": ""
                    }
                  },
                  "invalid stream": {
                    "value": {
                      "status": 400,
                      "description": "Operation failed",
                      "response_time": "2025-04-15T07:24:52.956691Z",
                      "data": {
                        "errors": [
                          {
                            "code": "INVALID_STREAM",
                            "message": "The specified stream ID does not exist"
                          }
                        ]
                      }
                    }
                  },
                  "Invalid stream transfer": {
                    "value": {
                      "status": 400,
                      "description": "Operation failed",
                      "response_time": "2025-04-15T07:24:52.956691Z",
                      "data": {
                        "errors": [
                          {
                            "code": "INVALID_STREAM_TRANSFER",
                            "message": "Transfers to 'WHATSAPP' are blocked"
                          }
                        ]
                      }
                    }
                  },
                  "Invalid stream type transfer": {
                    "value": {
                      "status": 400,
                      "description": "Operation failed",
                      "response_time": "2025-04-15T07:24:52.956691Z",
                      "data": {
                        "errors": [
                          {
                            "code": "INVALID_STREAM_TYPE_TRANSFER",
                            "message": {
                              "content": "Objects can only be transferred between allowed channel types. Allowed transfer",
                              "allowed_transfers": {
                                "SMS": [
                                  "MAILBOX_CONNECTOR",
                                  "CHAT"
                                ],
                                "MAILBOX_CONNECTOR": [
                                  "SMS",
                                  "CHAT"
                                ],
                                "CHAT": [
                                  "SMS",
                                  "MAILBOX_CONNECTOR"
                                ]
                              }
                            }
                          }
                        ]
                      }
                    }
                  },
                  "Invalid theme transfer": {
                    "value": {
                      "status": 400,
                      "description": "Operation failed",
                      "response_time": "2025-04-15T07:24:52.956691Z",
                      "data": {
                        "errors": [
                          {
                            "code": "INVALID_THEME_TRANSFER",
                            "message": "This theme channel can only be transferred to its original channel type"
                          }
                        ]
                      }
                    }
                  },
                  "Missing Email": {
                    "value": {
                      "status": 400,
                      "description": "Operation failed",
                      "response_time": "2025-04-15T07:24:52.956691Z",
                      "data": {
                        "errors": [
                          {
                            "code": "MISSING_EMAIL_ADDRESS",
                            "message": "Email address is required for EMAIL channel"
                          }
                        ]
                      }
                    }
                  },
                  "Missing phone": {
                    "value": {
                      "status": 400,
                      "description": "Operation failed",
                      "response_time": "2025-04-15T07:24:52.956691Z",
                      "data": {
                        "errors": [
                          {
                            "code": "MISSING_PHONE_NUMBER",
                            "message": "Phone number is required for SMS channel"
                          }
                        ]
                      }
                    }
                  },
                  "Invalid sub-stream": {
                    "value": {
                      "status": 400,
                      "description": "Operation failed",
                      "response_time": "2025-04-15T07:29:29.7227607Z",
                      "data": {
                        "errors": [
                          {
                            "code": "INVALID_SUBSTREAM",
                            "message": "The specified subStreamId does not belong to the provided streamId"
                          }
                        ]
                      }
                    }
                  },
                  "Inactive sub-stream": {
                    "value": {
                      "status": 400,
                      "description": "Operation failed",
                      "response_time": "2025-04-15T07:24:52.956691Z",
                      "data": {
                        "errors": [
                          {
                            "code": "INACTIVE_SUBSTREAM",
                            "message": "The specified subStreamId is inactive and cannot be assigned"
                          }
                        ]
                      }
                    }
                  },
                  "Update object's stream failed": {
                    "value": {
                      "status": 400,
                      "description": "Operation failed",
                      "response_time": "2025-04-15T07:24:52.956691Z",
                      "data": ""
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - The supplied credentials, if any, are not sufficient to access the resource",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 401
                    },
                    "description": {
                      "type": "string",
                      "example": "Unauthorized access"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource is not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 404
                    },
                    "description": {
                      "type": "string",
                      "example": "Not found"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - Too many requests have been made in a short period of time (Throttling)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 429
                    },
                    "description": {
                      "type": "string",
                      "example": "Too Many Requests"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - The server could not return the representation due to an internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 500
                    },
                    "description": {
                      "type": "string",
                      "example": "Operation failed"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                },
                "example": {
                  "status": 500,
                  "description": "Operation failed",
                  "response_time": "2025-04-15T07:24:52.956691Z"
                }
              }
            }
          }
        }
      }
    }
  }
}
````

