FileFactory API Last updated: 08/24/2017
Introduction
The FileFactory API will enable you to access various features offered by the FileFactory website, via the HTTP/S GET and POST methods. Supported methods are listed in the menu to the left. New methods can be added when there's enough demand for them, so if functionality you require is missing from the API, please contact us.
Each account, by default, is restricted to a 5,000 request per hour threshold. Exceeding this will generate an error. If this limit is not sufficient for your use case, please contact us using the link above. This limit can be raised on a case-by-case basis.
Overview
The API supports both HTTPS and HTTP. We recommend using HTTPS wherever possible. All responses are returned in JSON. You can find an example request and a success/error response illustrated below:
Example Request |
---|
https://api.filefactory.com/v1/method?param1=foo¶m2=bar |
Example Successful Response |
---|
{ "type":"success", "result":{ "foo":"bar", "baz":"qux" } } |
The result key can contain further nested data. Please consult each method individually for more information. |
Example Error Response |
---|
{ "type":"error", "message":"Example error message", "code":123 } |
A list of possible code values can be found under the "Error Matrix" option to the left. |
When the response is "type":"error"
it indicates that the request failed. This may be due to a server error, or an
error specific to the request (i.e. incorrect file password, invalid file, etc). The only exception to this is the getFileInfo method,
even if all of the file IDs entered were invalid, assuming the call completes successfully you will still be returned a "type":"success"
response.
As a general rule, all file sizes, bandwidth and storage limits, etc, are displayed in bytes. All times and dates are either relative, or displayed as a timestamp (YYYY-MM-DD HH:MM:SS). All times are in CET.
All methods can throw a few generic errors (such as ERR_API_REQ_MISSING_PARAM
). These are not listed under each method in the "Method Specific Errors" section.
Please consult the Error Matrix for a complete list of possible errors.
Versions
The API Version is appended to the URL, between the FQDN and the method being called. For example: https://api.filefactory.com/v1/method?param1=...
Backwards incompatible changes will result in a new version being deployed. We strongly suggest utilizing the latest available API version.
Version Number | URI | Active |
---|---|---|
1 | https://api.filefactory.com/v1/ | Yes |
Authenticating
ERR_API_KEY_INVALID (710)
or ERR_API_KEY_EXPIRED (711)
)
You must have a valid FileFactory account to use most of the methods exposed by this API. Free and Premium accounts will both work, and are treated equally, except where the account type alters the method's return data. For example, running the getDownloadLink method with a Free account will return a free or TrafficShare download link, whereas running it with a Premium account will return a Premium download link.
We highly recommend specifying your session key when making requests, even for methods where it is not mandatory. Specifying it will increase your request limit threshold and allow us to more easily identify problems with your account, or the API, should they arise.
For information on authenticating, please consult the getSessionKey method, or the example below.
Example
This example illustrates how to obtain a session key, and obtain information on a list of file IDs. This assumes that the username and password entered are correct, and that two of the three files exist.
Step 1
Request |
---|
"https://api.filefactory.com/v1/getSessionKey?email=example@filefactory.com&password=example |
Response |
---|
{ "type":"success", "result":{ "key":"b2eca18d2aa4f1fdbbbb4551a31c81aa6bcc4508" } } |
Step 2
Using the key
obtained from the first query, we can now call getFileInfo.
Request |
---|
https://api.filefactory.com/v1/getFileInfo?key=b2eca18d2aa4f1fdbbbb4551a31c81aa6bcc4508&file=1ep92k3t0fdz,5na8cbixx4aj,abcde12345 |
Response |
---|
{ "type":"success", "result":{ "files":{ "1ep92k3t0fdz":{ "status":"online", "hash":"1ep92k3t0fdz", "name":"Tulips.jpg", "size":"620888", "added":"2014-01-23 06:49:39", "url":"http:\/\/www.filefactory.com\/file\/1lubbbam1odb\/n\/Tulips.jpg", "md5":"fafa5efeaf3cbe3b23b2748d13e629a1", "premiumOnly":true, "password":false }, "5drpliy4x0bz":{ "status":"online", "hash":"5drpliy4x0bz", "name":"Desert.jpg", "size":"845941", "added":"2014-01-23 06:49:46", "url":"http:\/\/www.filefactory.com\/file\/5na8cbixx4aj\/n\/Desert.jpg", "md5":"ba45c8f60456a672e003a875e469d0eb", "premiumOnly":false, "password":true }, "abcde12345":{ "status":"invalid" } } } } |
API Methods
getSessionKey v1
Description
Validates an email / password combination and returns a session key. The session key is used for all subsequent method calls. Please only call this method if you do not already have a
Session keys are valid for 15 minutes once generated. This expiration is extended automatically every time the key is used in a request.
Please do not request a new session key before every request - doing so may result in your API access being temporarily suspended. In the event that the
session key has expired, you will receive a specific error (either ERR_API_KEY_INVALID (710)
or ERR_API_KEY_EXPIRED (711)
)
Example
Request |
---|
https://api.filefactory.com/v1/getSessionKey?email=example@filefactory.com&password=example&authkey=1234567890 |
Response |
---|
{ "type":"success", "result":{ "key":"b2eca18d2aa4f1fdbbbb4551a31c81aa6bcc4508" } } |
Request Parameters
Name | Description | Required |
---|---|---|
The email address associated with your FileFactory account | Yes | |
password | The password associated with your FileFactory account | Yes |
authkey | Your assigned authorization key from FileFactory | Yes |
Method Specific Errors
Code | Name | Description |
---|---|---|
707 | ERR_API_ACCOUNT_DELETED | The account has been deleted, or is pending deletion |
706 | ERR_API_LOGIN_FAILED | Login credentials were incorrect. |
getMemberInfo v1
Description
Returns information about the current member linked to the provided session keyExample
Request |
---|
https://api.filefactory.com/v1/getMemberInfo?key=b2eca18d2aa4f1fdbbbb4551a31c81aa6bcc4508 |
Response |
---|
{ "type":"success", "result":{ "email":"example@filefactory.com", "accountType":"premium", "expiryDate":"YYYY-MM-DD HH:MM:SS", "expiryMs":1234567890, // Milliseconds to account expiration "joined":"YYYY-MM-DD HH:MM:SS", "fileCount":"12345", "storageLimit":"1099511627776", // Bytes "storageUsed":107374182400, // Bytes "directDownloads":true, // Boolean "trafficShare":false, // Boolean "trafficShareUsed":null, // Bytes, if trafficShare === true "trafficShareLimit":null // Bytes, if trafficShare === true } } |
Request Parameters
Name | Description | Required |
---|---|---|
key | Valid session key, returned by getSessionKey | Yes |
Method Specific Errors
Code | Name | Description |
---|---|---|
709 | ERR_API_SESS_KEY_MISSING | The session key was not provided. |
711 | ERR_API_LOGIN_EXPIRED | The session key has expired. Please obtain a new one via getSessionKey. |
710 | ERR_API_SESS_KEY_INVALID | The session key has expired or is invalid. Please obtain a new one via getSessionKey. |
getFileInfo v1
Description
Returns information about a file or number of filesExample
Request |
---|
https://api.filefactory.com/v1/getFileInfo?key=b2eca18d2aa4f1fdbbbb4551a31c81aa6bcc4508&file=1ep92k3t0fdz,5na8cbixx4aj,abcde12345 |
Response |
---|
{ "type":"success", "result":{ "files":{ "1ep92k3t0fdz":{ "status":"online", // Either 'online', 'offline', 'invalid' "hash":"1ep92k3t0fdz", "name":"Tulips.jpg", "size":"620888", // Bytes "added":"2014-01-23 06:49:39", "url":"http:\/\/www.filefactory.com\/file\/1lubbbam1odb\/n\/Tulips.jpg", "md5":"fafa5efeaf3cbe3b23b2748d13e629a1", "premiumOnly":true, // Boolean "password":false // Boolean }, "5drpliy4x0bz":{ "status":"online", "hash":"5drpliy4x0bz", "name":"Desert.jpg", "size":"845941", "added":"2014-01-23 06:49:46", "url":"http:\/\/www.filefactory.com\/file\/5na8cbixx4aj\/n\/Desert.jpg", "md5":"ba45c8f60456a672e003a875e469d0eb", "premiumOnly":false, "password":true }, "abcde12345":{ "status":"invalid" } } } } |
Note: A status of 'offline' indicates a temporary issue (maintenance, etc), whereas 'invalid' indicates a permanent issue (deleted, not found, etc).
|
Request Parameters
Name | Description | Required |
---|---|---|
key | Valid session key, returned by getSessionKey | No |
file | A file ID, or up to 100 file IDs separated by commas (e.g. 1ep92k3t0fdz or 1ep92k3t0fdz,5na8cbixx4aj) | Yes |
Method Specific Errors
Code | Name | Description |
---|---|---|
nil |
getDownloadLink v1
Description
Returns a download link and other useful information based off the member's status.Example
Request |
---|
https://api.filefactory.com/v1/getDownloadLink?key=b2eca18d2aa4f1fdbbbb4551a31c81aa6bcc4508&file=1ep92k3t0fdz |
Response |
---|
{ "type":"success", "result":{ "url":"http:\/\/s1.filefactory.com\/get\/p\/1ep92k3t0fdz\/f18874b7bfbe5104\/Tulips.jpg", "name":"Tulips.jpg", "size":"620888", "linkType":"premium", // Either 'premium', 'trafficshare', or 'free' "delay":0 // Wait time - only > 0 if linkType == free } } |
Note: The url value returned by this call will expire, and is tied to both the IP Address and session key (if provided) making the request. Please do not publicly share this link, as it will not work.
|
Request Parameters
Name | Description | Required |
---|---|---|
key | Valid session key, returned by getSessionKey | No |
file | A file ID (e.g. 1ep92k3t0fdz) | Yes |
password | The password required to access the file (also required to access it through the website) | No |
Method Specific Errors
Code | Name | Description |
---|---|---|
713 | ERR_API_FILE_OFFLINE | The file requested is temporarily offline |
712 | ERR_API_FILE_INVALID | The file requested was not found, invalid, or has been deleted |
714 | ERR_API_FILE_SERVER_LOAD | The server hosting this file is overloaded. Please try again later (free members only) |
715 | ERR_API_PASSWORD_REQUIRED | A password is required to download this file |
717 | ERR_API_PASSWORD_ATTEMPTS | Too many failed password attempts. Try again in 5 minutes |
708 | ERR_API_PREMIUM_REQUIRED | The owner of the file has set the premiumOnly flag to true (free members only) |
Appendix
Error Matrix
The following is a list of all of the possible error codes that the API can return.
Code | Name | Description |
---|---|---|
700 | ERR_API_INVALID_METHOD | The requested method was invalid |
701 | ERR_API_INTERNAL_ERROR | An unexpected error was encountered (database, cache, etc). Please try again and contact us if this continues |
702 | ERR_API_REQ_MALFORMED | A request parameter failed validation |
703 | ERR_API_REQ_MISSING_PARAM | A required request parameter was missing |
704 | ERR_API_REQ_LIMIT | API Request limit has been hit. Please slow down your requests, or contact us to have the limit increased |
705 | ERR_API_LOGIN_ATTEMPTS | Too many failed login attempts. Please wait 15 minute and try to login again. |
706 | ERR_API_LOGIN_FAILED | Login details were incorrect |
707 | ERR_API_ACCOUNT_DELETED | Account has been deleted, or is pending deletion |
708 | ERR_API_PREMIUM_REQUIRED | A Premium membership is required to perform this function |
709 | ERR_API_SESS_KEY_MISSING | The session key parameter was missing |
710 | ERR_API_SESS_KEY_INVALID | The session key parameter was invalid |
711 | ERR_API_SESS_KEY_EXPIRED | The session key parameter was valid, but has since expired |
712 | ERR_API_FILE_INVALID | The requested file was invalid, or has been deleted |
713 | ERR_API_FILE_OFFLINE | The requested file is temporarily unavailable due to system maintenance, etc |
714 | ERR_API_FILE_SERVER_LOAD | The server hosting the requested file is overloaded (free members only) |
715 | ERR_API_PASSWORD_REQUIRED | The requested file is password protected, and a password was not supplied |
716 | ERR_API_PASSWORD_INVALID | The requested file is password protected, and the password supplied was incorrect |
717 | ERR_API_PASSWORD_ATTEMPTS | Too many failed password attempts. Try again in 5 minutes |
718 | ERR_API_IP_SUSPENDED | The IP Address initiating the request has been suspended |
719 | ERR_API_ACCOUNT_SUSPENDED | The account being used has been suspended |
Sample Code
Sample code will be coming soon.