Developers

With the powerful fayl.in API you as a developer can use fancy links in your own application! API access is unlimited, but in case of abuse we will disable your access.

API calls are made using HTTP GET and POST requests. Responses can be in json, xml yml or plain and defaults to json. The format is given to the request by adding it as an URL parameter, for example https://fayl.in/api/shortener?format=xml.

URL and file information

GET https://fayl.in/api/shortener/:alias

Parameters

url
One of two required. The URL to shorten
:alias
One of two required. The alias of the shortened URL

Return values

request
A string representing the request you made to the API
shorturl
The shortened URL
longurl
The original long URL
filename
The original name of the file, if the URL represents a shared file
filetype
The mime type of the file, if the URL represents a shared file
filesize
The size of the file in bytes, if the URL represents a shared file
error
A description of the error, if one occured

URL shortener

POST https://fayl.in/api/shortener/:alias

Parameters

url
Required. The URL to shorten.
:alias
Optional. The desired alias you want to use. If no alias is specified, or the alias is already being used, the API will generate a random alias.

Return values

request
A string representing the request you made to the API
shorturl
The shortened URL
longurl
The original long URL
error
A description of the error, if one occured

File sharer

POST https://fayl.in/api/file/:alias

Parameters

file
Required. Form data of the file to be shared
:alias
Optional. The desired alias you want to use. If no alias is specified, or the alias is already being used, the API will generate a random alias.

Return values

request
A string representing the request you made to the API
shorturl
The shortened URL
longurl
The original long URL
filename
The original name of the file
filetype
The mime type of the file
filesize
The size of the file in bytes
error
A description of the error, if one occured

Data sharer

POST https://fayl.in/api/file/data/:alias

Parameters

data
Required. The data URL to be shared
:alias
Optional. The desired alias you want to use. If no alias is specified, or the alias is already being used, the API will generate a random alias.

Return values

request
A string representing the request you made to the API
shorturl
The shortened URL
longurl
The original long URL
filename
The original name of the file
filetype
The mime type of the file
filesize
The size of the file in bytes
error
A description of the error, if one occured

URL redirection

GET https://fayl.in/api/redirect/:alias

Parameters

url
One of two required. The shortened URL
:alias
One of two required. The alias of the shortened URL

Return values

request
A string representing the request you made to the API
error
A description of the error, if one occured

When succesful, this API call doesn't return a value. Instead it redirects the client to the destination of the short URL.

File redirection

GET https://fayl.in/api/redirect/file/:alias

Parameters

url
One of two required. The shortened URL
:alias
One of two required. The alias of the shortened URL

Return values

request
A string representing the request you made to the API
error
A description of the error, if one occured

When succesful, this API call doesn't return a value. Instead it redirects the client to the shared file.

Thumbnail generator

GET https://fayl.in/api/thumbnail/:alias

Parameters

url
One of two required. The shortened URL
:alias
One of two required. The alias of the shortened URL

Return values

request
A string representing the request you made to the API
error
A description of the error, if one occured

When succesful, this API call doesn't return a value. Instead it returns an image with the generated thumbnail of the shared file.

Examples of responses

These responses are an example of the request

GET https://fayl.in/api/shortener?url=https://fayl.in/8s5i

JSON response

{"shorturl":"https\://fayl\.in/8s5i","longurl":"http:\/\/www.google.com"}

XML response

<urlban>
  <shorturl>https://fayl.in/8s5i</shorturl>
  <longurl>http://www.google.com</longurl>
</urlban>

YAML response

shorturl: https://fayl.in/8s5i
longurl: http://www.google.com

Plain response

http://www.google.com