SLiMG API Documentation (WIP)

Getting Started

SLiMG API uses 2 types of autentication.

The first is OAuth2, which will grant you access to all endpoints and to your own account data. You'll get your Access Token by authenticating through the Token endpoint.

The second is to simply send the header
Authorization: Client-ID {YOUR_CLIENT_ID}
Connecting to the API this way will grant you access to all public endpoints, as well as anonymous uploading.

If you do not use either of the above methods, you'll receive an error return and not be able to access any of the resources.

To use the SLiMG API you first need to create an account on https://sli.mg/, if you have an account you can skip this step.
Next you'll need to generate your client_id and client_secret. You do this by clicking on the Account tab and then Generate Keys.



Once you have these you are ready to get started!


Endpoints

Token
You'll use this endpoint to authenticate in order to retrieve an Access Token.
URLhttps://api.sli.mg/token
MethodPOST
AccessAll
Parameters
Key Required Desc
grant_type (Required) client_credentials
client_id (Required) {YOUR_CLIENT_ID}
client_secret (Required) {YOUR_CLIENT_SECRET}
Response
{ "access_token": "{YOUR_ACCESS_TOKEN}", "expires_in": 86400, "token_type": "Bearer", "refresh_token": "{YOUR_REFRESH_TOKEN}" }


Account
URLNOT IMPLEMETED
MethodNOT IMPLEMETED
AccessPublic
ResponseNOT IMPLEMETED

Account Albums
You'll use this endpoint to retrieve all of the albums for the given username.
If authenticated, you can send "me" as the username to retrive your own albums.
URLhttps://api.sli.mg/account/{USERNAME}/albums/
MethodGET
AccessPublic
Parameters
Response
On success you'll receive the number of albums as well as an array of albums.
album_secret will be empty unless you are authenticated as the account owner.
username will be empty if the album was uploaded anonymously.
{ "success": true, "status": 200, "data": { "album_count": 44, "albums": [ { "album_key": "123", "album_secret": "secret", "description": "description", "created": 1462666092, "username": "username", "url": "https://sli.mg/a/123", "media_count": 1, "tags": [ { "tag_key": "slimg", "url": "https://sli.mg/v/slimg" } ] }, ] } }

Account Media
You'll use this endpoint to retrieve all of the media for the given username.
If authenticated, you can send "me" as the username to retrive your own albums.
A max of 50 media records are returned at once, so you'll need to use the {PAGE} in order to get all of them. {PAGE} is optional and defaults to 1.
URLhttps://api.sli.mg/account/{USERNAME}/media/{PAGE}
MethodGET
AccessPublic
Parameters
Response
On success you'll receive the number of media items as well as an array of media.
media_secret will be empty unless you are authenticated as the account owner.
{ "success": true, "status": 200, "data": { "media_count": 238, "media": [ { "media_key": "123", "media_secret": "123", "title": "title", "description": "description", "username": "username", "status": 1, "created": 1462663829, "mimetype": "image/jpeg", "extension": "jpg", "size": 420, "url": "https://sli.mg/123", "url_direct": "https://sli.mg/123.jpg", "animated": false, "gifv": false, "url_gifv": "", "webm": false, "url_webm": "", "mp4": false, "url_mp4": "", "height": 1, "width": 1, "tags": [ { "tag_key": "slimg", "url": "https://sli.mg/v/slimg" } ] }, ] } }


Media
You'll use this endpoint to retrieve the details of the requested media item.
URLhttps://api.sli.mg/media/{MEDIA_KEY}
MethodGET
AccessPublic
Parameters
Response
media_secret will be empty unless you are authenticated as the account owner.
username will be empty if the album was uploaded anonymously.

Status is very important for media, you'll need to keep track of them for uploading purposes.
0 = Disabled.
1 = Active and available.
20 = Queued for media processing.
21 = Currently being processed.
99 = Fatal Error Occurred.
50 = Marked to be deleted.
51 = Deleted from the system.

When you retrieve media you will want to get thumbnails instead of having to load the original image for previews. There are currently 2 thumbnail sizes we offer. You can request the thumbnail by appending the size key into the URL.
For instance, to get a thumb for URL https://sli.mg/123.jpg the URL becomes https://sli.mg/123.ms.jpg.
ss = 100x100
ms = 250x250
{ "success": true, "status": 200, "data": { "media_key": "123", "media_secret": "123", "title": "title", "description": "description", "username": "username", "status": 1, "created": 1462650118, "mimetype": "image/jpeg", "extension": "jpg", "size": 420, "url": "https://sli.mg/123", "url_direct": "https://sli.mg/123.jpg", "animated": false, "gifv": false, "url_gifv": "", "webm": false, "url_webm": "", "mp4": false, "url_mp4": "", "height": 1, "width": 1, "tags": [ { "tag_key": "slimg", "url": "https://sli.mg/v/slimg" } ] } }

Media Create
You'll use this endpoint to upload new media. If you upload without authenticating, the upload will be considered anonymous. In both cases you'll receive a Media Secret, but you'll need to save the Media Secret in order to update / delete the media later on if it is uploaded anonymously.

All successful uploads are returned with a status = 20. This means that the item is queued for processing. You'll need to poll the Media endpoint to know when it has completed. Once complete, a status = 1 will be returned.
URLhttps://api.sli.mg/media
MethodPOST | PUT
AccessPublic
Parameters
Key Required Desc
type (Required) binary | URL | base64
data (Required) A binary file, String URL or a base64 encoded file.
size (Optional) Size of the file as an Int.
title (Optional) An optional title
description (Optional) An optional description.
shared (Optional) true | false if the item should be shared on SLiMG.
album_key (Optional) The key of an album to assign this media to once created.
album_secret (Optional) The album_secret. Used when not authenticated to verify ownership.
tags (Optional) A comma seperated list of tags.
Response
media_secret will be always be populated after an upload.

username will be empty if the album was uploaded anonymously.

album_key will be populated if you added this media to an album during creation.

Status is very important for media, you'll need to keep track of them for uploading purposes.
0 = Disabled.
1 = Active and available.
20 = Queued for media processing.
21 = Currently being processed.
99 = Fatal Error Occurred.
50 = Marked to be deleted.
51 = Deleted from the system.

When you retrieve media you will want to get thumbnails instead of having to load the original image for previews. There are currently 2 thumbnail sizes we offer. You can request the thumbnail by appending the size key into the URL.
For instance, to get a thumb for URL https://sli.mg/123.jpg the URL becomes https://sli.mg/123.ms.jpg.
ss = 100x100
ms = 250x250
{ "success": true, "status": 200, "data": { "media_key": "123", "media_secret": "123", "title": "title", "description": "description", "username": "username", "status": 20, "created": 1462650118, "mimetype": "image/jpeg", "extension": "jpg", "size": 420, "url": "https://sli.mg/123", "url_direct": "https://sli.mg/123.jpg", "animated": false, "gifv": false, "url_gifv": "", "webm": false, "url_webm": "", "mp4": false, "url_mp4": "", "height": 1, "width": 1, "tags": [ { "tag_key": "slimg", "url": "https://sli.mg/v/slimg" } ], "album_key": "abc" } }

Media Update
You'll use this endpoint to update media.

If authenticated, you simply need to pass in the media_key of an item that belongs to you.

Otherwise, you will need to pass in both the media_key and media_secret in order to update the item.
URLhttps://api.sli.mg/media/{MEDIA_KEY}/{MEDIA_SECRET}
MethodPOST | PUT
AccessPublic
Parameters
Key Required Desc
title (Optional) An optional title
description (Optional) An optional description.
shared (Optional) true | false if the item should be shared on SLiMG.
album_key (Optional) The key of an album to assign this media to once created.
album_secret (Optional) The album_secret. Used when not authenticated to verify ownership.
tags (Optional) A comma seperated list of tags. This overwrites all previous tags.
Response
media_secret will be always be populated after an upload.

username will be empty if the album was uploaded anonymously.

album_key will be populated if you added this media to an album during creation.

Status is very important for media, you'll need to keep track of them for uploading purposes.
0 = Disabled.
1 = Active and available.
20 = Queued for media processing.
21 = Currently being processed.
99 = Fatal Error Occurred.
50 = Marked to be deleted.
51 = Deleted from the system.

When you retrieve media you will want to get thumbnails instead of having to load the original image for previews. There are currently 2 thumbnail sizes we offer. You can request the thumbnail by appending the size key into the URL.
For instance, to get a thumb for URL https://sli.mg/123.jpg the URL becomes https://sli.mg/123.ms.jpg.
ss = 100x100
ms = 250x250
{ "success": true, "status": 200, "data": { "media_key": "123", "media_secret": "123", "title": "title", "description": "description", "username": "username", "status": 1, "created": 1462650118, "mimetype": "image/jpeg", "extension": "jpg", "size": 420, "url": "https://sli.mg/123", "url_direct": "https://sli.mg/123.jpg", "animated": false, "gifv": false, "url_gifv": "", "webm": false, "url_webm": "", "mp4": false, "url_mp4": "", "height": 1, "width": 1, "tags": [ { "tag_key": "slimg", "url": "https://sli.mg/v/slimg" } ], "album_key": "adf" } }

Media Delete
You'll use this endpoint to delete media.

If authenticated, you simply need to pass in the media_key of an item that belongs to you.

Otherwise, you will need to pass in both the media_key and media_secret in order to delete the item.
URLhttps://api.sli.mg/media/{MEDIA_KEY}/{MEDIA_SECRET}
MethodDELETE
AccessPublic
Parameters
Response
deleted will be the time the item was deleted.
{ "success": true, "status": 200, "data": { "deleted": 1462650118, "created": 1462650118 } }


Album
You'll use this endpoint to retrieve the details of the requested album.
URLhttps://api.sli.mg/album/{ALBUM_KEY}
MethodGET
AccessPublic
Parameters
Response
album_secret will be empty unless you are authenticated as the account owner.

username will be empty if the album was uploaded anonymously.

The media_key of the album thumbnail will be returned in cover along with with the media type.

When you retrieve media you will want to get thumbnails instead of having to load the original image for previews. There are currently 2 thumbnail sizes we offer. You can request the thumbnail by appending the size key into the URL.
For instance, to get a thumb for URL https://sli.mg/123.jpg the URL becomes https://sli.mg/123.ms.jpg.
ss = 100x100
ms = 250x250
{ "success": true, "status": 200, "data": { "album_key": "123", "album_secret": "123", "description": "description", "created": 1446598131, "username": "username", "url": "https://sli.mg/a/123", "media_count": 1, "cover_key": "123", "cover_mime": "image/gif", "cover_ext": "gif", "tags": [ { "tag_key": "test", "url": "https://sli.mg/v/test" } ] } }

Album Create
You'll use this endpoint to create new album. If you create without authenticating, the album will be considered anonymous. In both cases you'll receive an Album Secret, but you'll need to save the Album Secret in order to update / delete the album later on if it is uploaded anonymously.
URLhttps://api.sli.mg/album
MethodPOST | PUT
AccessPublic
Parameters
Key Required Desc
description (Optional) An optional description.
shared (Optional) true | false if the item should be shared on SLiMG.
media_keys (Optional) A comma seperated list of the media_keys you want in this album. This is an overwrite operation. The first media_key will become the album cover.
media_secrets (Optional) A comma seperated list of the media_secrets. Used when not authenticated, each media_secret must match the index of the media_key it is to be applied to.
tags (Optional) A comma seperated list of tags.
Response
album_secret will be always be populated after creation.

username will be empty if the album was uploaded anonymously.

When you retrieve media you will want to get thumbnails instead of having to load the original image for previews. There are currently 2 thumbnail sizes we offer. You can request the thumbnail by appending the size key into the URL.
For instance, to get a thumb for URL https://sli.mg/123.jpg the URL becomes https://sli.mg/123.ms.jpg.
ss = 100x100
ms = 250x250
{ "success": true, "status": 200, "data": { "album_key": "123", "album_secret": "123", "description": "description", "created": 1446598131, "username": "username", "url": "https://sli.mg/a/123", "media_count": 1, "cover_key": "123", "cover_mime": "image/gif", "cover_ext": "gif", "tags": [ { "tag_key": "test", "url": "https://sli.mg/v/test" } ] } }

Album Update
You'll use this endpoint to update an album.

If authenticated, you simply need to pass in the album_key of an item that belongs to you.

Otherwise, you will need to pass in both the album_key and album_secret in order to update the item.
URLhttps://api.sli.mg/album/{ALBUM_KEY}/{ALBUM_SECRET}
MethodPOST | PUT
AccessPublic
Parameters
Key Required Desc
description (Optional) An optional description.
shared (Optional) true | false if the item should be shared on SLiMG.
media_keys (Optional) A comma seperated list of the media_keys you want in this album. This is an overwrite operation. The first media_key will become the album cover.
media_secrets (Optional) A comma seperated list of the media_secrets. Used when not authenticated, each media_secret must match the index of the media_key it is to be applied to.
tags (Optional) A comma seperated list of tags. This overwrites all previous tags.
Response
username will be empty if the album was uploaded anonymously.

When you retrieve media you will want to get thumbnails instead of having to load the original image for previews. There are currently 2 thumbnail sizes we offer. You can request the thumbnail by appending the size key into the URL.
For instance, to get a thumb for URL https://sli.mg/123.jpg the URL becomes https://sli.mg/123.ms.jpg.
ss = 100x100
ms = 250x250
{ "success": true, "status": 200, "data": { "album_key": "123", "album_secret": "123", "description": "description", "created": 1446598131, "username": "username", "url": "https://sli.mg/a/123", "media_count": 1, "cover_key": "123", "cover_mime": "image/gif", "cover_ext": "gif", "tags": [ { "tag_key": "test", "url": "https://sli.mg/v/test" } ] } }

Album Delete
You'll use this endpoint to delete an album.

If authenticated, you simply need to pass in the album_key of an item that belongs to you.

Otherwise, you will need to pass in both the album_key and album_secret in order to delete the item.
URLhttps://api.sli.mg/album/{ALBUM_KEY}/{ALBUM_SECRET}
MethodDELETE
AccessPublic
Parameters
Response
deleted will be the time the item was deleted.
{ "success": true, "status": 200, "data": { "deleted": 1462650118, "created": 1462650118 } }

Album Media
You'll use this endpoint to retrieve all of the media for the given album.
URLhttps://api.sli.mg/album/{ALBUM_KEY}/media
MethodGET
AccessPublic
Parameters
Response
On success you'll receive the number of media items as well as an array of media.
media_secret will be empty unless you are authenticated as the account owner.
username will be empty if the album was uploaded anonymously.
{ "success": true, "status": 200, "data": { "media_count": 238, "media": [ { "media_key": "123", "media_secret": "123", "title": "title", "description": "description", "username": "username", "status": 1, "created": 1462663829, "mimetype": "image/jpeg", "extension": "jpg", "size": 420, "url": "https://sli.mg/123", "url_direct": "https://sli.mg/123.jpg", "animated": false, "gifv": false, "url_gifv": "", "webm": false, "url_webm": "", "mp4": false, "url_mp4": "", "height": 1, "width": 1, "tags": [ { "tag_key": "slimg", "url": "https://sli.mg/v/slimg" } ] }, ] } }


Browse
You'll use this endpoint to retrieve shared items matching our browse section.

A max of 30 media records are returned at once, so you'll need to use the {PAGE} in order to get all of them. {PAGE} is optional and defaults to 1.
URLhttps://api.sli.mg/browse/{PAGE}
MethodGET
AccessPublic
Parameters
Response
On success you'll receive an array of shared items.

username will be empty if the album was uploaded anonymously.

album_key will only be populated if it is an album, as well as is_album being set to true.

media_key will only be populated if it is not an album, as well as is_album being seting to false.

The cover_key will be populated with the key to use for getting the cover image.

When you retrieve media you will want to get thumbnails instead of having to load the original image for previews. There are currently 2 thumbnail sizes we offer. You can request the thumbnail by appending the size key into the URL.
For instance, to get a thumb for URL https://sli.mg/123.jpg the URL becomes https://sli.mg/123.ms.jpg.
ss = 100x100
ms = 250x250
{ "success": true, "status": 200, "data": [ { "album_key": "123", "media_key": "123", "title": "title", "description": "description", "username": "username", "is_album": false, "cover_key": "234", "cover_mime": "image/jpeg", "cover_ext": "jpg", "url": "https://sli.mg/123", "tags": [ { "tag_key": "slimg", "url": "https://sli.mg/v/slimg" } ] }, ] }

Browse Tag
You'll use this endpoint to retrieve shared items matching our browse section for a certain tag.

You'll need to set {TYPE} to one of the following (all|nsfw|sfw).
all = return all items.
sfw = return only sfw items.
nsfw = return only nsfw items.

A max of 30 media records are returned at once, so you'll need to use the {PAGE} in order to get all of them. {PAGE} is optional and defaults to 1.
URLhttps://api.sli.mg/browse/{TAG}/{TYPE}/{PAGE}
MethodGET
AccessPublic
Parameters
Response
On success you'll receive an array of shared items.

username will be empty if the album was uploaded anonymously.

album_key will only be populated if it is an album, as well as is_album being set to true.

media_key will only be populated if it is not an album, as well as is_album being seting to false.

The cover_key will be populated with the key to use for getting the cover image.

When you retrieve media you will want to get thumbnails instead of having to load the original image for previews. There are currently 2 thumbnail sizes we offer. You can request the thumbnail by appending the size key into the URL.
For instance, to get a thumb for URL https://sli.mg/123.jpg the URL becomes https://sli.mg/123.ms.jpg.
ss = 100x100
ms = 250x250
{ "success": true, "status": 200, "data": [ { "album_key": "123", "media_key": "123", "title": "title", "description": "description", "username": "username", "is_album": false, "cover_key": "234", "cover_mime": "image/jpeg", "cover_ext": "jpg", "url": "https://sli.mg/123", "tags": [ { "tag_key": "slimg", "url": "https://sli.mg/v/slimg" } ] }, ] }

Report Contact Terms Privacy MLog API