MongooseIM's REST API for frontend or client

In addition to the regular XMPP connection methods such as TCP (with TLS/STARTTLS), WebSockets and BOSH, MongooseIM provides parts of its functionality over a REST API.


  1. Every request has to be authenticated. Please see the Authentication section for more details.
  2. We strongly advise that this API is served over HTTPS.
  3. User registration has to be done via other methods (f.e. using the REST API for backend services).
  4. The relevant endpoint has to be configured on the server side. See the configuration section.
  5. A list of provided actions is documented with Swagger. See the beautiful specification.


MongooseIM uses Basic Authentication as an authentication method for the REST API.

Basic authentication is a simple authentication scheme built into the HTTP protocol. Each HTTP request to the client REST API has to contain the Authorization header with the word Basic followed by a space and a base64-encoded string username@host:password, where:

  • username@host is the user's bare JID,
  • password is the password used to register the user's account.

For example, to authorize as alice@localhost with the password secret, the client would send a header:

Authorization: Basic YWxpY2VAbG9jYWxob3N0OnNlY3JldA==


Handlers have to be configured as shown in the REST API configuration example to enable REST API.

In order to get the client REST API up and running simply copy the provided example. For more details about possible configuration parameters please see the relevant documentation of the listeners, in particular the client REST API handlers section.

Smack library support

REST API can fetch messages for Smack Stanza Properties.

For example if we have properties in the stanza like:

    <message xml:lang='en' to='alice@localhost' id='123' type='chat'>
      <body xml:lang='en_US'>Hi!</body>
      <properties xmlns=""
              <value type='integer'>123</value>
              <value type='string'>abc</value>

then in the final json message these properties will be converted to json map without tag names and all types will be taken as string:

    {   "to": "alice@localhost",
        "timestamp": 1531329049949,
        "id": "123",
        "from": "bob@localhost",
        "body": "Hi!",

OpenAPI specifications

See the beautiful Swagger documentation for more information.