Fleep API Tutorial

Quick overview on how to communicate with Fleep via API.


Fleep API consists of JSON requests and responses over HTTPS, API endpoints are in form https://fleep.io/api/METHOD.

  • Request’s Content-Type must be application/json.
  • Response Content-Type will also be application/json.
  • Only UTF-8 charset is allowed.
  • If requests has header Accept-Encoding: gzip the result may be optionally compressed.
  • During login, server returns cookie named token_id and JSON string named ticket. This cookie must be attached to all following requests and ticket must be embedded into JSON requests.


API access is authenticated via token which identifies a Fleep user. To request token use https://fleep.io/api/account/login method.


>>> import requests
>>> r = requests.post("https://fleep.io/api/account/login",
...     json={"email": "user@domain.com", "password": "xxxx"})
>>> print r.json()["ticket"]
>>> print r.cookies["token_id"]

Retrieve messages

To retrieve Fleep messages and events use https://fleep.io/api/account/poll.


>>> r = requests.post("https://fleep.io/api/account/poll",
...     cookies={"token_id": "dd737a29-7819-41dc-ad93-a38aab2c9409"},
...     json={"wait": False, "event_horizon": 0, "ticket": "d5a9c3c2fc696c4a4b55"})

Post messages

To post messages to Fleep use https://fleep.io/api/event/store.


>>> data = {
...     "ticket": "6528701a3f619b6aa001",
...     "api_version": 4,
...     "stream": [{
...         "client_req_id": "84d73134-ca41-4dda-b818-f724f42cd79e",
...         "mk_event_type": "urn:fleep:client:message:add_plain",
...         "params": {
...             "conversation_id": "3c2c8dee-02c6-4280-9306-d76a932cd79e",
...             "message": "Hello world!"}}]}
>>> r = requests.post("https://fleep.io/api/event/store",
...     cookies={"token_id": "dd737a29-7819-41dc-ad93-a38aab2c9409"},
...     json=data)

Table Of Contents

Previous topic

Fleep API Documentation

Next topic

Fleep API Reference