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

# Get or Create Omnichannel Rooms

> Get the data of an existing room of a visitor. If a room doesn't exist for the visitor, a new room is created.

## OpenAPI

````json GET /api/v1/livechat/room
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Omnichannel"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "tags": [
    {
      "name": "Omnichannel Users"
    },
    {
      "name": "Omnichannel Agents"
    },
    {
      "name": "Omnichannel Monitors"
    },
    {
      "name": "Omnichannel Visitors"
    },
    {
      "name": "Omnichannel Contacts"
    },
    {
      "name": "Omnichannel Rooms"
    },
    {
      "name": "Omnichannel Departments"
    },
    {
      "name": "Omnichannel Custom Fields"
    },
    {
      "name": "Omnichannel Business Hours"
    },
    {
      "name": "Omnichannel Priorities"
    },
    {
      "name": "Omnichannel Tags"
    },
    {
      "name": "Omnichannel Units"
    },
    {
      "name": "SLA Policies"
    },
    {
      "name": "Canned Responses"
    },
    {
      "name": "Omnichannel Transcript"
    },
    {
      "name": "Omnichannel Statistics"
    },
    {
      "name": "Omnichannel Agent Stats"
    },
    {
      "name": "Omnichannel Dashboards"
    },
    {
      "name": "Reports"
    },
    {
      "name": "Omnichannel Inquiries"
    },
    {
      "name": "Omnichannel Webhooks"
    },
    {
      "name": "Livechat"
    },
    {
      "name": "Livechat Appearance"
    },
    {
      "name": "Livechat Triggers"
    },
    {
      "name": "Livechat Messages"
    },
    {
      "name": "Livechat Page Visited"
    }
  ],
  "paths": {
    "/api/v1/livechat/room": {
      "get": {
        "summary": "Get or Create Omnichannel Rooms",
        "description": "Get the data of an existing room of a visitor. If a room doesn't exist for the visitor, a new room is created.",
        "operationId": "get-api-v1-livechat-room",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "description": "The visitor token.",
            "required": "true",
            "schema": {
              "type": "string"
            },
            "example": "iNKE8a6k6cjbqWhWd"
          },
          {
            "name": "rid",
            "in": "query",
            "description": "The room ID.",
            "schema": {
              "type": "string"
            },
            "example": "kCJDd5peKiZnGJLPq"
          },
          {
            "name": "agentId",
            "in": "query",
            "description": "The agent ID.",
            "schema": {
              "type": "string"
            },
            "example": "XycfA5CetCPuEjqxw"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "room": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "fname": {
                          "type": "string"
                        },
                        "t": {
                          "type": "string"
                        },
                        "v": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "username": {
                              "type": "string"
                            },
                            "token": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string"
                            },
                            "lastMessageTs": {
                              "type": "string"
                            }
                          }
                        },
                        "departmentId": {
                          "type": "string"
                        },
                        "default": {
                          "type": "boolean"
                        },
                        "ro": {
                          "type": "boolean"
                        },
                        "sysMes": {
                          "type": "boolean"
                        },
                        "open": {
                          "type": "boolean"
                        },
                        "msgs": {
                          "type": "integer"
                        },
                        "ts": {
                          "type": "string"
                        },
                        "_updatedAt": {
                          "type": "string"
                        },
                        "lm": {
                          "type": "string"
                        },
                        "customFields": {
                          "type": "object",
                          "properties": {
                            "salesforceCrmContactId": {
                              "type": "string"
                            }
                          }
                        },
                        "usersCount": {
                          "type": "integer"
                        },
                        "cl": {
                          "type": "boolean"
                        },
                        "departmentAncestors": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "lastMessage": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "rid": {
                              "type": "string"
                            },
                            "msg": {
                              "type": "string"
                            },
                            "token": {
                              "type": "string"
                            },
                            "alias": {
                              "type": "string"
                            },
                            "ts": {
                              "type": "string"
                            },
                            "u": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string"
                                },
                                "username": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              }
                            },
                            "_updatedAt": {
                              "type": "string"
                            },
                            "urls": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "mentions": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "channels": {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            },
                            "md": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string"
                                        },
                                        "value": {
                                          "type": "string"
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "newRoom": {
                              "type": "boolean"
                            },
                            "showConnecting": {
                              "type": "boolean"
                            }
                          }
                        },
                        "metrics": {
                          "type": "object",
                          "properties": {
                            "reaction": {
                              "type": "object",
                              "properties": {
                                "fd": {
                                  "type": "string"
                                },
                                "ft": {
                                  "type": "number"
                                },
                                "tt": {
                                  "type": "number"
                                }
                              }
                            },
                            "response": {
                              "type": "object",
                              "properties": {
                                "avg": {
                                  "type": "number"
                                },
                                "fd": {
                                  "type": "string"
                                },
                                "ft": {
                                  "type": "number"
                                },
                                "total": {
                                  "type": "integer"
                                },
                                "tt": {
                                  "type": "number"
                                }
                              }
                            },
                            "v": {
                              "type": "object",
                              "properties": {
                                "lq": {
                                  "type": "string"
                                }
                              }
                            },
                            "servedBy": {
                              "type": "object",
                              "properties": {
                                "lr": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        },
                        "servedBy": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "username": {
                              "type": "string"
                            },
                            "ts": {
                              "type": "string"
                            }
                          }
                        },
                        "waitingResponse": {
                          "type": "boolean"
                        }
                      }
                    },
                    "newRoom": {
                      "type": "boolean"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  }
                },
                "examples": {
                  "Success Example": {
                    "value": {
                      "room": {
                        "_id": "kCJDd5peKiZnGJLPq",
                        "fname": "Mary",
                        "t": "l",
                        "v": {
                          "_id": "47Dajwh9DjpnTAugW",
                          "username": "guest-165",
                          "token": "8s7e9ony6ctl27e1qf8kue",
                          "status": "offline",
                          "lastMessageTs": "2021-07-09T20:20:58.755Z"
                        },
                        "departmentId": "CAJioQNAvLnYWTy8i",
                        "default": "false",
                        "ro": "false",
                        "sysMes": "true",
                        "open": "true",
                        "msgs": "7",
                        "ts": "2021-07-09T20:12:19.795Z",
                        "_updatedAt": "2021-07-09T20:21:07.334Z",
                        "lm": "2021-07-09T20:20:58.755Z",
                        "customFields": {
                          "salesforceCrmContactId": "0032y000009mtOIAAY"
                        },
                        "usersCount": "2",
                        "cl": "false",
                        "departmentAncestors": [
                          "sriw2wmP2Zz2pPrre"
                        ],
                        "lastMessage": {
                          "_id": "SgrsSm3HNGrG5xTmk",
                          "rid": "kCJDd5peKiZnGJLPq",
                          "msg": "d",
                          "token": "8s7e9ony6ctl27e1qf8kue",
                          "alias": "Mary",
                          "ts": "2021-07-09T20:20:58.755Z",
                          "u": {
                            "_id": "47Dajwh9DjpnTAugW",
                            "username": "guest-165",
                            "name": "Mary"
                          },
                          "_updatedAt": "2021-07-09T20:20:58.896Z",
                          "urls": [],
                          "mentions": [],
                          "channels": [],
                          "md": [
                            {
                              "type": "PARAGRAPH",
                              "value": [
                                {
                                  "type": "PLAIN_TEXT",
                                  "value": "d"
                                }
                              ]
                            }
                          ],
                          "newRoom": "false",
                          "showConnecting": "true"
                        },
                        "metrics": {
                          "reaction": {
                            "fd": "2021-07-09T20:19:53.243Z",
                            "ft": "23.821",
                            "tt": "24.006"
                          },
                          "response": {
                            "avg": "226.4365",
                            "fd": "2021-07-09T20:19:53.243Z",
                            "ft": "452.688",
                            "total": "2",
                            "tt": "452.873"
                          },
                          "v": {
                            "lq": "2021-07-09T20:20:58.755Z"
                          },
                          "servedBy": {
                            "lr": "2021-07-09T20:19:53.077Z"
                          }
                        },
                        "servedBy": {
                          "_id": "XycfA5CetCPuEjqxw",
                          "username": "jane.doe",
                          "ts": "2021-07-09T20:19:29.422Z"
                        },
                        "waitingResponse": "true"
                      },
                      "newRoom": "false",
                      "success": "true"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "success": "false",
                      "error": "Match error: Missing key 'token'"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Omnichannel Rooms"
        ]
      }
    }
  }
}
````

