Skip to content

Chat API

The Chat API allows integration clients to create chat rooms, add members to them, post messages into chat rooms and mark chat rooms as synchronized or read up to a certain message.

Chat rooms are identified by a client-generated identifier called roomxtid. It is the client's responsibility to ensure that roomxtid is unique for all chat rooms.

Chat rooms may have up to 100 members (instantCMR users identified by their userxtid) at any single moment. Chat rooms are only visible to their members and only members are allowed to post messages into a chat room. If a member is removed from a chat room, the given chat room and all of its messages are removed from the list of chat rooms of the former member. Messages posted by former members of a chat room are retained however even after their authors have been removed from the chat room. Chat rooms maintain a list of their current members and do not keep track of former members.

Chat rooms are versioned by their etagroom field, a gapless sequence number represented as a hexadecimal string. This sequence number is also used in the ETag header of GET chat room and PUT chat room requests as well as in If-Match and If-None-Match headers of a PUT chat room request to avoid lost updates.

Messages posted into a chat room are stored sequentially in the order these messages are received by the instantCMR Chat API. Messages are identified by the combination of the roomxtid of the chat room they belong to and the sequence number of the message representing the order of the message in the chat room. The sequence number of the message is represented as a hexadecimal string and is stored in the etagpost field of the message. It is also used in the ETag and If-Match headers of the PUT message request to avoid lost updates or duplicate postings of the same message.

In addition to the roomxtid and etagpost pair, individual messages are required to have a unique postxtid generated by the client. This is necessary so that the Chat API can differentiate between two messages posted by the same author with identical contents.

For each message, the chat room stores the contents and the author (identified by its userxtid) the sequence number and the date/time the message has been received. The chat room also stores the sequence number of the most recent message in its etagpost field.

Chat rooms may optionally have a conversation title that is displayed to the members of the chat room. If a chat room does not have its conversation title set, a generic one will be displayed to its members, listing the names of the first few members of the chat room.

For each current member the chat room keeps track of the most recent message delivered to the given member along with the date/time the given message was delivered. This is represented by the owetagdtuSync field, storing the etagpost of the most recently delivered message and the date/time of the delivery. This field can be updated by sending a PUT delivery receipt request to the Chat API.

Similarly, the chat room keeps track of the most recent message (represented by the etagpost of the message) read by the given member along with the date/time when the member read the message in the owetagdtuRead field. This field can be updated by sending a PUT read receipt request to the Chat API.

GET chat room

Retrieves a chat room entity identified by its roomxtid.

Request

GET /v3/igr/room/{copid}/{roomxtid} HTTP/1.1  
Host: api.instantcmr.com  
x-icmr-auth-1: {authentication-token}  
copidCompany identifier assigned by instantCMR
roomxtidClient-generated identifier of the chat room
authentication-tokenSee Authentication.

Response

HTTP/1.1 200 OK  
Date: Thu, 23 Jan 2020 16:29:47 GMT  
Content-Type: application/json; charset=UTF-8  
ETag: {ETag} 
Content-Length: 1386  

{roomed}

Response codes

200 OKRequest was successful. Response body contains the chat room entity. The ETag response header contains the etagroom of the chat room.
401 UnauthorizedMissing or invalid authentication-token.
403 ForbiddenAuthenticated user does not have sufficient permission to access chat rooms of the company designated by copid.
404 Not FoundChat room with id of roomxtid not found.
429 Too Many RequestsRequest has been throttled as user exceeded API quota.

Response headers

ETagstringEntity version tag of the chat room (etagroom). Must be supplied in subsequent PUT chat room requests in the If-Match header.

Response body

roomedroomedChat room response entity.

PUT chat room

Stores a chat room entity, optionally replacing any previous chat entity stored under roomxtid.

Request

To create a new chat room, send a PUT chat room request to the url below, making sure that you generate a globally unique roomxtid for the entity. To ensure that you do not accidentally overwrite an existing chat room, send the request with an If-None-Match: * http header.

To update an existing chat room, send a PUT chat room request to the same url (using the same roomxtid) with the updated data in the request body. Send the request with an If-Match: ETag http header to avoid overwriting updates performed by others. The data sent in the request body will fully replace the data stored by the instantCMR Chat API. This also means that any data (e.g. a membership of the chat room) you skip from the request body will be deleted.

The request will succeed if

  • The chat room entity version provided in the If-Match header matches the current entity version (etagroom) stored by instantCMR, or
  • The chat room does not exist and an If-None-Match: * header is sent with the request, or
  • The chat room sent in the request body matches exactly the current entity stored by instantCMR.

In all of the above cases the update will succeed and the response body will contain the updated chat room entity and the ETag http response header will contain the new etagroom of the chat room. If none of the above conditions are met, the update will be rejected and the response will contain a 412 PreconditionFailed http status code.

Conflict avoidance

To ensure that lost updates are avoided it is recommended that all PUT chat room requests are accompanied by either an If-Match or an If-None-Match header. This way the request is guaranteed to be idempotent and is thus safe to be retried should it fail due to a network outage or backend error.

In case of a conflicting update it is recommended to retrieve the most recent version of the chat room entity using a GET chat room request which will also return the etagroom corresponding to the chat room in the ETag header of the response. The client should then merge its intended changes with the most recent version of the chat room and retry the request with the updated etagroom in the If-Match header. The update should typically succeed, but should it not, repeat the GET chat room & merge & resolve conflicts & PUT chat room process until the system arrives at a fixpoint.

Stable identity

Once set, the chat room identifier (roomxtid) cannot be updated.

Chat rooms can not be deleted either, although it is possible to remove all members from a chat room by sending a PUT chat room request with an empty rgboma field. Note however, that removing all members from a chat room will not remove previous messages posted into the chat room. When the chat room is reanimated later (by adding new members into it) all the new members will see the entire chat history of the chat room.

Muted members

Members of the chat room can be optionally muted. Muted members of a chat room are unable to post messages via the instantCMR App or Hub, although messages can still be posted in a muted member’s name via PUT message request. In addition to the above muted members do not see read and delivery receipts of other muted members in the chat room.

Quotas and limits

A chat room can have up to 100 distinct members. Sending a PUT chat room request with more than 100 members in the rgboma field will fail with a 400 BadRequest http status code.

Although a user may be a member of an unlimited number of chat rooms, only the most recently updated 100 chat rooms will be displayed and synchronized to their devices.

When the member list of a chat room is modified (either by adding new members, removing previous members or both) the instantCMR API might require additional processing to administer joining or departing members. This processing might take from a few milliseconds up to a few seconds and is performed asynchronously after the PUT chat room request has finished. During this time amending the member list of the same chat room is prohibited and any such request will yield a 429 TooManyRequests http status code. As usually with similar responses the client is expected to perform a randomized exponential backoff (honoring any timeouts specified in the Retry-After response header) and retry the request later.

The title of a chat room may not exceed 2048 characters. Exceeding this limit in a PUT chat room request will yield a 400 BadRequest http status code.

PUT /v3/igr/room/{copid}/{roomxtid[?silent]} HTTP/1.1  
Host: api.instantcmr.com  
x-icmr-auth-1: {authentication-token}  
Content-Type: application/json  
[If-Match: {etagroom}]  
[If-None-Match: *]  
Content-Length: 1779  

{roomeu}
copidCompany identifier assigned by instantCMR
roomxtidClient-generated chat room identifier
etagroomChat room entity version tag. Provide previous chat room entity version tag when updating an already existing chat room. When creating a new chat room pass ‘*’ in the If-None-Match header.
authentication-tokenSee Authentication.
roomeuChat room update entity.
silentIf the optional silent URL parameter is set, changes are populated to the clients without generating additional announcements in the message flow.
For example, when the room title is updated, a system message is shown saying “X changed the room title to B”. These can be suppressed by adding the silent parameter.

Response

HTTP/1.1 200 OK  
Date: Thu, 23 Jan 2020 16:29:47 GMT  
Content-Type: application/json; charset=UTF-8  
ETag: {ETag} 
Content-Length: 1386  

{roomed}  

Response codes

200 OKRequest was successful. Response contains an updated chat room entity in the response body and its corresponding etagroom in the ETag response header.
400 BadRequestMalformed request or API quota violation. See also Quotas and limits.
401 UnauthorizedMissing or invalid authentication-token.
403 ForbiddenThe authenticated user does not have sufficient permission to access chat rooms of the company designated by copid.
404 Not FoundEither the chat room with id of roomxtid not found (only returned when updating an existing chat room) or one of the members (specified by the rguserxtid field) was not found.
412 PreconditionFailedETag specified in If-Match or If-None-Match headers did not match the current etagroom of the chat room. Retrieve the current chat room entity using GET chat room, reapply the changes, and retry the PUT chat room request with updated ETag.
429 Too Many RequestsRequest has been throttled as the user exceeded API quota. Retry the request with a randomized exponential backoff, honoring any timeout specified in the Retry-After response header if provided.

Response headers

ETagstringEntity version tag (etagroom) after the update.

Response body

roomedroomedChat room response entity.

PUT message

Posts a new message into a chat room.

Request

To post a new message, send a PUT message request to the url below, making sure that you generate a postxtid that is unique within the chat room. Postxtid needs to be unique for each message, even for messages having the same contents sent by the same author, thus applying a hash function on the message contents will not suffice.

Conflict avoidance

To ensure that lost updates are avoided, the client must provide an If-Match header with the etagpost of the most recent known message in the chat room.

The request will succeed if

  • The sequence number of the last message posted in the chat room specified by roomxtid matches the etagpost submitted in the If-Match header of the PUT message request, or
  • The message immediately following the message denoted by the sequence number submitted as etagpost in the If-Match header of the PUT message is identical to the message sent in the request body, including the message content, author and the client-generated message id (postxtid).

If the request fails due to a network outage or backend error, the request should be retried with the same postxtid in the url and same etagpost in the If-Match header using exponential backoff.

Due to technical limitations the Chat API might be temporarily unable to determine if the message would cause a lost update or duplicate posting. This should occur very infrequently and only for a brief duration. In such cases, the response will contain a 429 TooManyRequests http status code. The client should retry the same request with the same postxtid in the url and the same etagpost in the If-Match header using exponential backoff.

If the message would result in a lost update, the response will contain a 412 PreconditionFailed http status code. In this case the client should retrieve the most recent version of the chat room entity using the GET chat room request and retry the PUT message request with the same message content, same postxtid in the url but this time using the etagpost retrieved in the rovered.wetagdtupost.etag field of the chat room entity. The client should repeat the above process until it succeeds.

When the request succeeds, the most recent etagpost will be returned in the ETag header of the response. The client may save this value for posting future messages into the chat room.

Quotas and limits

Messages posted in a chat room may not exceed 8196 characters in length. Exceeding this limit will result in a 400 BadRequest http status code.

PUT /v3/igr/room/{copid}/{roomxtid}/post/{postxtid} HTTP/1.1  
Host: api.instantcmr.com  
x-icmr-auth-1: {authentication-token}  
Content-Type: application/json  
If-Match: {etagpost}  
Content-Length: 1779  

{posteu}  
copidCompany identifier assigned by instantCMR.
roomxtidClient-generated chat room identifier where the message should be posted.
postxtidClient-generated identifier of the message.
etagpostThe sequence number of the most recent known message (etagpost) in the chat room. Can be retrieved by sending a GET chat room request or from the ETag header of a previous PUT message response.
authentication-tokenSee Authentication.
posteuMessage entity.

Response

HTTP/1.1 200 OK  
Date: Thu, 23 Jan 2020 16:29:47 GMT  
Content-Type: application/json; charset=UTF-8  
ETag: {ETag} 
Content-Length: 1386  

{posted}

Response codes

200 OKRequest was successful. Response contains the message update result entity in the response body and most recent etagpost of the chat room in the ETag response header.
400 BadRequestMalformed request, API quota violation or missing If-Match header.
401 UnauthorizedMissing or invalid authentication-token.
403 ForbiddenThe authenticated user does not have sufficient permission to access chat rooms of the company designated by copid or to post messages into the chat room designated by roomxtid.
404 Not FoundThe chat room with id of roomxtid not found.
412 PreconditionFailedETag specified in If-Match header did not match the sequence number of the most recent message in the chat room. Retrieve the current chat room entity using GET chat room and retry the PUT chat room request with an updated etagpost.
429 Too Many RequestsRequest has been throttled as the user exceeded API quota or conflict resolution is temporarily impossible. Retry the request with an exponential backoff.

Response body

postedpostedMessage update response entity.

PUT delivery receipt

Updates the delivery receipt of a member specified by userxtid of a chat room specified by roomxtid.

Request

To update the delivery receipt of a given member send a PUT delivery receipt request to the url below, specifying the roomxtid of the chat room, userxtid of the member whose delivery receipt should be updated and the etagpost of the most recent message delivered to the member.

The response body will contain the updated chat room entity, including the membership record of the user containing the updated delivery receipt. Please note that the etagpost included in the response might be different from the one specified in the request as updates to stale message sequence numbers will be ignored by the Chat API (previously delivered messages can not be marked as ‘undelivered’).

On rare occasions it might be temporarily impossible to validate the request. In these cases the response will contain a 429 TooManyRequests http status code. Should that be the case the client should retry the same request with exponential backoff.

PUT /v3/igr/room/{copid}/{roomxtid}/user/{userxtid}/sr/{etagpost} HTTP/1.1  
Host: api.instantcmr.com  
x-icmr-auth-1: {authentication-token}  
copidCompany identifier assigned by instantCMR.
roomxtidClient-generated chat room identifier where the delivery receipt should be updated.
userxtidClient-generated identifier of the chat room member whose delivery receipt should be updated.
etagpostThe sequence number of the most recent message (etagpost) in the chat room delivered to the user.
authentication-tokenSee Authentication.

Response

HTTP/1.1 200 OK  
Date: Thu, 23 Jan 2020 16:29:47 GMT  
Content-Type: application/json; charset=UTF-8  
ETag: {ETag} 
Content-Length: 1386  

{roomed}

Response codes

200 OKRequest was successful. Response contains the updated chat room entity in the response body and the most recent etagroom of the chat room in the ETag response header.
400 BadRequestMalformed request (e.g. etagpost is invalid).
401 UnauthorizedMissing or invalid authentication-token.
403 ForbiddenThe authenticated user does not have sufficient permission to access chat rooms of the company designated by copid.
404 Not FoundThe chat room with id of roomxtid not found or the user specified by the userxtid is not a member of the chat room.
429 Too Many RequestsRequest has been throttled as the user exceeded API quota or request validation is temporarily impossible. Retry the request with an exponential backoff.

Response body

roomedroomedChat room entity containing the updated delivery receipt.

PUT read receipt

Updates the read receipt of a member specified by userxtid of a chat room specified by roomxtid.

Request

To update the read receipt of a given member send a PUT read receipt request to the url below, specifying the roomxtid of the chat room, userxtid of the member whose read receipt should be updated and the etagpost of the most recent message read by the member.

The response body will contain the updated chat room entity, including the membership record of the user containing the updated read receipt. Please note that the etagpost included in the response might be different from the one specified in the request as updates to stale message sequence numbers will be ignored by the Chat API (previously read messages can not be marked as ‘unread’).

On rare occasions it might be temporarily impossible to validate the request. In these cases the response will contain a 429 TooManyRequests http status code. Should that be the case the client should retry the same request with exponential backoff.

PUT /v3/igr/room/{copid}/{roomxtid}/user/{userxtid}/rr/{etagpost} HTTP/1.1  
Host: api.instantcmr.com  
x-icmr-auth-1: {authentication-token}  
copidCompany identifier assigned by instantCMR.
roomxtidClient-generated chat room identifier where the read receipt should be updated.
userxtidClient-generated identifier of the chat room member whose read receipt should be updated.
etagpostThe sequence number of the most recent message (etagpost) in the chat room read by the user.
authentication-tokenSee Authentication.

Response

HTTP/1.1 200 OK  
Date: Thu, 23 Jan 2020 16:29:47 GMT  
Content-Type: application/json; charset=UTF-8  
ETag: {ETag} 
Content-Length: 1386  

{roomed}

Response codes

200 OKRequest was successful. Response contains the updated chat room entity in the response body and the most recent etagroom of the chat room in the ETag response header.
400 BadRequestMalformed request (e.g. etagpost is invalid).
401 UnauthorizedMissing or invalid authentication-token.
403 ForbiddenThe authenticated user does not have sufficient permission to access chat rooms of the company designated by copid.
404 Not FoundThe chat room with id of roomxtid not found or the user specified by the userxtid is not a member of the chat room.
429 Too Many RequestsRequest has been throttled as the user exceeded API quota or request validation is temporarily impossible. Retry the request with an exponential backoff.

Response body

roomedroomedChat room entity containing the updated read receipt.
© 2025 instantCMR LtdAPI Legal Disclaimer