Introduction

The 4Sync API is built to conform to the design principles of Representational State Transfer (REST) and exposes 4Sync resources like files, folders and users that can be accessed and manipulated using the next HTTP methods:

POST - creates or updates a resource

PUT - updates a resource

GET - retrieves a resource or list of resources

DELETE - deletes a resource

In general, a list of the resources is available through /{resource name}. To get a specific resource, use /{resource name}/{id}.
Subresources, e.g. a list of user's files, can be received through /{resource name}/{id}/{subresource name}.

https://api.4sync.com/{api version}/{resource name} - for all other requests

The 4Sync API is accessible via HTTPS only. Current API version is v1_2.

Formats

The 4Sync API supports xml and json formats. You should set your HTTP Content-Type request header accordingly
(application/xml, application/json), though you may also specify the desired format by
appending .xml or .json extensions in the resource URI.

Pagination

Most of the API resources support pagination that in turn is consistent across all API resources that require it. Use
offset and limit parameters to page through query results.

Parameter

Type

Description

Required

limit

Integer

The number of records returned. Min value is 1. Default (and max value) is 100.

User Authorization

The second step is to request user authorization. Upon receipt of a Request Token from 4Sync the authorization page,
where an application could be granted the requested access, is displayed. The only required parameter for this step is
the Request Token (oauth_token value) received from the previous step. The endpoint is followed by an oauth_token
parameter with the value set to the oauth_token value.
After an application is granted the access, a user is redirected to the URL specified in the oauth_callback parameter.

RESOURCE

/oauth/authorize

DESCRIPTION

The second step of authorization. Without user authorization in this step, it is impossible for your application to obtain an Access Token.

Getting an Access Token

This is the final step of the authorization process. After an application is granted the access, it needs to exchange
the Request Token for an Access Token. For this step, you will need the Request Token (the oauth_token and
oauth_token_secret values) (see previous step).

RESOURCE

/oauth/token

DESCRIPTION

The third step of authorization. Getting an Access Token.

URL

https://api.4sync.com/v1_2/oauth/token

METHOD

POST

VERSION

v1_2

RETURNS

An access token and the corresponding access token secret with HTTP Status 200.

/files

File Response

FileResponse entity contains metadata of a file, information about its owner and its download link. Next fields: description, tags,
exif, id3 are not returned by default and must be requested via an additional parameter addFields.

Update file (PUT /files/{id})

This method is used to upload a new version of an existing file in a user's account. File size is limited to 150 MB.
To upload files of larger size /upload method must be used. The whole body is treated as file binary data and
Content-Type should be set to application/octet-stream.

RESOURCE

/files/{id}

DESCRIPTION

Simple update file endpoint (only for files less than 150 Mb in size).

Move file from Recycle bin (POST /files/{id}/untrash)

Restores a file, moved to a Recycle bin. Default: restores a file to the previous parent folder, i.e. the folder
before deletion. If the parent folder no longer exists, a new folder is created. If a file with the same name exists
in the parent folder, some new unique name must be specified in the request.

RESOURCE

/files/{id}/untrash

DESCRIPTION

Restores a file from Recycle bin.

URL

https://api.4sync.com/v1_2/files/{id}/untrash

METHOD

POST

VERSION

v1_2

PARAMETERS

Parameter

Type

Description

Required

name

String

Some new name of this file in the case of restore conflict. Max value: 255 symbols.

Get thumbnails of the file (GET /files/{id}/thumbnails/{type})

Returns a thumbnail of the specified type for an audio file with cover, video, image or pdf file. Its a public call. Possible values are {type}:

XS: height-72, width-72

S: height-240, width-320

SM: height-480, width-854

M: height-750, width-1334

L: height-1080, width-1920

XL:height-1600, width-2560

Thumbnails are generated on post-upload for all types except SM, XL types.
The returned image may be larger or smaller than the size requested, depending on the size and aspect ratio of the original image. If the requested preview size exceeds the original file, the latter one will be returned.

Move folder from Recycle bin (POST /folders/{id}/untrash)

Restores a folder, moved to Recycle bin. Default: restores a folder to its previous parent folder, i.e. the folder
before deletion. If its parent folder no longer exists, a new folder is created. If a folder with the same name exists
in the parent folder, some new unique name must be specified in the request.

RESOURCE

/folders/{id}/untrash

DESCRIPTION

Restores a folder from Recycle bin.

URL

https://api.4sync.com/v1_2/folders/{id}/untrash

METHOD

POST

VERSION

v1_2

PARAMETERS

Parameter

Type

Description

Required

name

String

Some new name of this folder in the case of restore conflict. Max value: 255 symbols.