Loforo API Documentation

The Loforo API can be used to interact with Loforo from your own application (web, mobile, server-based app, etc). Currently you can create posts via the API. More APIs will be added to retrieve existing posts, edit posts and more at a later time.

Loforo API Illustration

API Key

All Loforo APIs require an "API Key". You can get your API key from the Settings page when you are logged in. Note that the API key is site-specific so if you have multiple sites each site's API key will be different.

Do not share your API key with anyone or post it publicly -- the API key provides unrestricted access to your account/site (create, edit, delete, etc).

The API key should be sent with each API request (as input "key")

Responses

There are 2 basic types of response you can expect from the API: a successful one or an error if something fails. Here are some sample responses:

Create a Post

You can use the API to create new posts on your site. The content of the post should be HTML formatted. You can also upload a picture or video to be inserted in your post with this API.

Input

Upload/attach a Picture or Video with a post

There are 2 ways to attach media (photos/videos) with your post.

If you embed 1 or more links to an image or video in the HTML content of the post (with img or video tags), Loforo will display it within the post. If it's hosted on an external site, we will also mirror it to our servers shortly after the post is created.

If you want to upload an image or video from your own computer, you can use the media input in the API mentioned above. Media can be up to 100MB and a single image/video can be attached per post at this time.

If you are uploading an image or video with your post, the media data must be in the multipart/form-data format (HTML forms are sent this way for example).

Sample Requests

Warning: The sample requests below contain your unique API key in them -- do not share them with others.

If you have curl installed on your computer (most Mac and Linux computers do), you can upload from the command line/terminal as follows:

Sample Code - Python

The following code will create a post with an image with Python using the requests library (change the image name as needed):

import requests

url = 'https://loforo.com/api/post/create'
payload = {
  'key': 'YOUR-API-KEY-HERE',
  'content': '<p>A picture is attached to this post</p>'
}
files = {'media': open('IMAGE_NAME_HERE.jpg', 'rb')}

print('Creating post..')
response = requests.post(url, data=payload, files=files)

print('HTTP Code:', response.status_code)
print('Response Body:', response.text)

Rate Limits

There are currently no hard rate limits on requests. We ask that you be responsible using this API and keep the number of simultaneous requests low and don't send too many requests rapidly. We reserve the right to disable your API and site access if we feel there is abuse.

Questions? Need help?

If you have any questions, issues, or feature-requests, please contact us -- we'll be happy to help!