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
>>> import json
>>> r = requests.post("https://fleep.io/api/account/login",
...     headers = {"Content-Type": "application/json"},
...     data = json.dumps({"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",
...         headers = {"Content-Type": "application/json"},
...         cookies = {"token_id": "dd737a29-7819-41dc-ad93-a38aab2c9409"},
...         data = json.dumps({"wait": False, "event_horizon": 0, "ticket": "d5a9c3c2fc696c4a4b55"}))

Post messages

To post messages to Fleep use https://fleep.io/api/message/send/CONV_ID.


>>> r = requests.post("https://fleep.io/api/message/send/87f2b207-5ce5-4357-8a6c-552bc24b8d6e",
...         headers = {"Content-Type": "application/json"},
...         cookies = {"token_id": "dd737a29-7819-41dc-ad93-a38aab2c9409"},
...         data = json.dumps({"message": "Hello world!", "ticket": 'd5a9c3c2fc696c4a4b55'}))

Table Of Contents

Previous topic

Fleep API Documentation

Next topic

Fleep API Reference