img(height="1",width="1",alt="",style="display:none",src="https://www.facebook.com/tr?id=379183095603793&ev=PixelInitialized")Send Anywhere – API

Welcome to Send Anywhere’s API

Sign up for the Send Anywhere API and embed the simplest file sharing service in your website or application.
Step 1: Apply for an API key
Fill out this form and we will get back to you ASAP via email with the activation API key.
Step 2: Check out the Documentation
Wondering how to use the Send Anywhere API? Then you should check out the following pages:
Step 3: The API in Action
Additionally, visit our examples page to see other awesome ways of applying the Send Anywhere API!

Desktop SDK

Guidelines


API Setup
Download SDK

You can download the SDK from our Github.

Build SDK

To set up Send Anywhere's SDK and see example projects you need to install CMake and then run CMake in your SDK root path.

$ cmake .

CMake is a cross-platform, open-source build system. If you're new to CMake, please visit the official guide to Running CMake.

Examples

Check out more examples at our GitHub.

Desktop SDK

Reference


Initialize
void sendanywhere_init(const char* apiKey, const char* tokenPath);
void sendanywhere_cleanup();
void sendanywhere_init(const char* apiKey, const char* tokenPath);

Initialize Send Anywhere library.

Parameters
apiKeyYour API key.
tokenPathA token path for saving session.
void sendanywhere_cleanup()

Cleanup library.

Create task
SendAnywhereTask sendanywhere_create_send(
        const wchar_t* files[],
        unsigned int fileNumber);
SendAnywhereTask sendanywhere_create_receive(
        const wchar_t* key,
        const wchar_t* destDirPath);
 
void sendanywhere_close(SendAnywhereTask task);
SendAnywhereTask sendanywhere_create_send(const wchar_t* files[], unsigned int fileNumber)

Initialize Send Anywhere library.

Parameters
filesFiles to send.
fileNumberNumber of file.
Return
valueA handle to new task.
SendAnywhereTask sendanywhere_create_receive(const wchar_t* key, const wchar_t* destDirPath)

Start task for sending or receiving. Initialize Send Anywhere library.

Parameters
keyThe KEY of sender.
destDirPathSave path.
Return
valueA handle to new task.
void sendanywhere_close(SendAnywhereTask task)

Close a handle.

Parameters
taskA Handle to the task.
Control task
void sendanywhere_start(SendAnywhereTask task);
bool sendanywhere_is_running(SendAnywhereTask task);
void sendanywhere_wait(SendAnywhereTask task);
void sendanywhere_cancel(SendAnywhereTask task);
void sendanywhere_start(SendAnywhereTask task)

Start task for sending or receiving.

Parameters
taskA Handle to the task.
bool sendanywhere_is_running(SendAnywhereTask task)

Indicates whether the task is running.

Parameters
taskA Handle to the task.
Return
valueTrue if the task is running, false otherwise.
void sendanywhere_wait(SendAnywhereTask task)

Wait until task is finished.

Parameters
taskA Handle to the task.
void sendanywhere_cancel(SendAnywhereTask task)

Cancel the task to stop.

Parameters
taskA Handle to the task.
Listener for task
typedef void (*sendanywhere_listener_function)(
SendAnywhereState state,
SendAnywhereDetailedState detailedState,
const void* param,
void* userptr);
 
void sendanywhere_set_listner(
SendAnywhereTask task,
sendanywhere_listener_function func,
void* userptr);
typedef enum {
    SENDANYWHERE_STATE_UNDEFINED,
 
    SENDANYWHERE_STATE_FINISHED,
    SENDANYWHERE_STATE_ERROR,
    SENDANYWHERE_STATE_PREPARING,
 
    SENDANYWHERE_STATE_TRANSFERRING,
 
    SENDANYWHERE_STATE_NOTIFICATION,
} SendAnywhereState;
 
typedef enum {
    SENDANYWHERE_DETAILED_STATE_UNDEFINED,
 
    SENDANYWHERE_DETAILED_STATE_FINISHED_SUCCESS,
    SENDANYWHERE_DETAILED_STATE_FINISHED_CANCEL,
    SENDANYWHERE_DETAILED_STATE_FINISHED_ERROR,
 
    SENDANYWHERE_DETAILED_STATE_ERROR_WRONG_API_KEY,
    SENDANYWHERE_DETAILED_STATE_ERROR_SERVER,
 
    SENDANYWHERE_DETAILED_STATE_ERROR_NO_REQUEST,
    SENDANYWHERE_DETAILED_STATE_ERROR_NO_EXIST_FILE,
 
    SENDANYWHERE_DETAILED_STATE_ERROR_FILE_NO_DOWNLOAD_PATH,
    SENDANYWHERE_DETAILED_STATE_ERROR_FILE_NO_DISK_SPACE,
    SENDANYWHERE_DETAILED_STATE_ERROR_NO_EXIST_KEY,
 
    SENDANYWHERE_DETAILED_STATE_PREPARING_UPDATED_KEY,
    SENDANYWHERE_DETAILED_STATE_PREPARING_UPDATED_FILE_LIST,
 
    SENDANYWHERE_DETAILED_STATE_TRANSFERRING,
} SendAnywhereDetailedState;
typedef struct {
    const wchar_t* name;
    const wchar_t* fullPath;
    unsigned long long size;
    unsigned long long sent;
} SendAnywhereTransferFileInfo;
 
typedef struct {
    unsigned int number;
    SendAnywhereTransferFileInfo* fileInfo;
} SendAnywhereAllTransferFileInfo;
void sendanywhere_set_listner(SendAnywhereTask task, sendanywhere_listener_function func, void* userptr);

Register a callback to be invoked when transfer event occurs.

typedef void (sendanywhere_listener_function)(SendAnywhereState state, SendAnywhereDetailedState detailedState, const void param, void* userptr);
SendAnywhereState (SENDANYWHERE_STATE_)SendAnywhereDetailedState (SENDANYWHERE_DETAILED_STATE_)param
FINISHEDFINISHED_SUCCESS-
FINISHED_CANCEL-
FINISHED_ERROR-
ERRORERROR_WRONG_API_KEY-
ERROR_SERVER-
ERROR_NO_REQUEST-
ERROR_NO_EXIST_FILE-
ERROR_NO_EXIST_KEY-
ERROR_FILE_NO_DOWNLOAD_PATH-
ERROR_FILE_NO_DISK_SPACE-
ERROR_FILE_DISK_NOT_MOUNTED-
PREPARINGPREPARING_UPDATED_KEYconst wchar_t*
PREPARING_UPDATED_FILE_LISTconst SendAnywhereAllTransferFileInfo*
TRANSFERRINGTRANSFERRINGconst SendAnywhereTransferFileInfo*
Flow Step
  • PREPARING_UPDATED_KEY
    • PREPARING_UPDATED_FILE_LIST
  • TRANSFERRING
  • TRANSFERRING
  • ...
  • TRANSFERRING
  • TRANSFERRING
    • FINISHED_SUCCESS
    • FINISHED_CANCEL
    • ERROR
      • FINISHED_ERROR

iOS SDK

Guidelines


Setup for development
Download SDK

You can download the SDK from our Github.

Configure Xcode

1. Drag and Drop SendAnywhereSDK-iphoneuniversal/SendAnywhereSDK.framework into your Project Navigator Group.

2. Set SAAPIKey value in .plist file with your Send Anywhere API key.

3. Following frameworks and libraries:

  • SystemConfiguration.framework
  • CoreTelephony.framework
  • libstdc++.dylib
  • libz.dylib
Examples

Check out more examples in our GitHub.

iOS SDK

Reference


Task Constructor
@interface SASendTask : SATask
- (instancetype)initWithFileUrls:(NSArray *)urls;
@end
@interface SAReceiveTask : SATask
- (instancetype)initWithKey:(NSString *)key destDirPath:(NSString *)destDirPath;
@end
SASendTask
Parameters
urls The file list to send
ReceiveTask
Parameters
key The KEY for sending files
destDirPath The folder path for receiving files
Public method
@interface SATask : NSObject
- (void)start;
- (void)await;
- (void)cancel;
@end
static void init(String key)

Set your API key.

Parameters
key Your API Key.
void start()

Start a task for sending or receiving files.

void await()

Wait until the task is finished.

void cancel()

Stop and cancel the running task.

Delegate for task
@protocol SATaskDelegate <NSObject>
- (void)task:(SATask *)task transferPreparing:(SAPreparingDetailState)state;
- (void)task:(SATask *)task fileInfo:(id<SAFileInfo>) fileInfo transferring:(SATransferDetailState)state;
- (void)task:(SATask *)task transferFinished:(SAFinishedDetailState)state;
- (void)task:(SATask *)task error:(SAErrorDetailState)state;
@end
Delegate for prepared transfering
- (void)task:(SATask *)task transferPreparing:(SAPreparingDetailState)state;
typedef NS_ENUM(NSInteger, SAPreparingDetailState) {
SAPreparingDetailUndefined,
SAPreparingDetailUpdatedKey,
SAPreparingDetailUpdatedFileList,
};
Delegate for transfering
- (void)task:(SATask *)task fileInfo:(id<SAFileInfo>) fileInfo transferring:(SATransferDetailState)state;
typedef NS_ENUM(NSInteger, SATransferDetailState) {
SATransferDetailTransferring,
};
Delegate for finished transfering
- (void)task:(SATask *)task transferFinished:(SAFinishedDetailState)state;
typedef NS_ENUM(NSInteger, SAFinishedDetailState){
SAFinishedDetailUndefined,
SAFinishedDetailSuccess,
SAFinishedDetailCancel,
SAFinishedDetailError
};
Delegate for error
- (void)task:(SATask *)task error:(SAErrorDetailState)state;
typedef NS_ENUM(NSUInteger, SAErrorDetailState) {
SAErrorDetailUndefined,
SAErrorDetailWrongAPIKey,
SAErrorDetailServer,
SAErrorDetailNoRequest,
SAErrorDetailNoExistFile,
SAErrorDetailFileNoDownloadPath,
SAErrorDetailFileNoDiskSpace,
SAErrorDetailNoExistKey,
};
Flow Step
  • SAPreparingDetailUpdatedKey
    • SAPreparingDetailUpdatedFileList
    • SATransferDetailTransferring
    • SATransferDetailTransferring
    • ...
    • SATransferDetailTransferring
    • SATransferDetailTransferring
      • SAFinishedDetailSuccess
      • SAFinishedDetailCancel
      • SAFinishedDetailError
File Information
@protocol SAFileInfo <NSObject>
@property (nonatomic, readonly) NSURL *url; // File URL
@property (nonatomic, readonly) NSString *pathName; // Relative file path
@property (nonatomic, readonly) long long transferSize; // transfered file size in bytes
@property (nonatomic, readonly) long long totalSize; // file size in bytes
@end

Android SDK

Guidelines


Setup for development
Download SDK

You can download the SDK from our Github.

Configure Android Studio

1. Copy SDK, sendanywhere Dirctory to Project.

2. Import SDK project as dependency in android studio.

3. Set your API key.

Task.init("YOUR_API_KEY")
Examples

Check out more examples in our GitHub.

Android SDK

Reference


Task Constructor
public class SendTask extends Task {
    public SendTask(Context context, File[] files);
 
    ...
}
 
public class ReceiveTask extends Task {
    public ReceiveTask(Context context, String key, File destDir);
 
    ...
}
SendTask(Context context, File[] files)
Parameters
contextThe current context.
filesThe file list what you want to send.
ReceiveTask(Context context, String key, File destDir)
Parameters
contextThe current context.
keyThe KEY of sender.
destDirSave folder.
Public method
public class Task {
    ...
 
    public static void init(String key);
 
    public void start();
 
    public void await();
 
    public void cancel();
 
    ...
}
static void init(String key)

Set your API key.

Parameters
keyYour API Key.
void start()

Start task for sending or receiving.

void await()

Wait until task is finished.

void cancel()

Cancel the task to stop.

Listener for task
public class Task {
    ...
 
    public interface OnTaskListener {
        void onNotify(int state, int detailedState, Object obj);
    }
 
public void setOnTaskListener(OnTaskListener callback)
 
...
}
public class Task {
    ...
 
    public class State {
        public static final int UNKNOWN;
        public static final int FINISHED;
        public static final int ERROR;
        public static final int PREPARING;
        public static final int TRANSFERRING;
    }
 
    public class DetailedState {
        public static final int UNKNOWN;
 
 
        public static final int FINISHED_SUCCESS;
        public static final int FINISHED_CANCEL;
        public static final int FINISHED_ERROR;
 
 
        public static final int ERROR_WRONG_API_KEY;
        public static final int ERROR_SERVER;
 
        public static final int PREPARING_UPDATED_KEY;
        public static final int PREPARING_UPDATED_FILE_LIST;
 
        public static final int TRANSFERRING;
    }
 
    ...
}
public class SendTask extends Task {
    ...
 
    public class DetailedState extends Task.DetailedState {
        public static final int ERROR_NO_REQUEST;
        public static final int ERROR_NO_EXIST_FILE;
    }
 
    ...
}
public class ReceiveTask extends Task {
    ...
 
    public class DetailedState extends Task.DetailedState {
        public static final int ERROR_NO_EXIST_KEY;
        public static final int ERROR_FILE_NO_DOWNLOAD_PATH;
        public static final int ERROR_FILE_NO_DISK_SPACE;
        public static final int ERROR_FILE_DISK_NOT_MOUNTED;
    }
 
    ...
}
public void setOnTaskListener(OnTaskListener callback)

Register a callback to be invoked when transfer event occurs.

void onNotify(int state, int detailedState, Object obj)
Task.StateTask.DetailedStateparam
FINISHEDFINISHED_SUCCESS-
FINISHED_CANCEL-
FINISHED_ERROR-
ERRORERROR_WRONG_API_KEY-
ERROR_SERVER-
ERROR_NO_REQUEST-
ERROR_NO_EXIST_FILE-
ERROR_NO_EXIST_KEY-
ERROR_FILE_NO_DOWNLOAD_PATH-
ERROR_FILE_NO_DISK_SPACE-
ERROR_FILE_DISK_NOT_MOUNTED-
PREPARINGPREPARING_UPDATED_KEYString
PREPARING_UPDATED_FILE_LISTTask.FileInfo[]
TRANSFERRINGTRANSFERRINGTask.FileInfo
Flow Step
  • PREPARING_UPDATED_KEY
    • PREPARING_UPDATED_FILE_LIST
  • TRANSFERRING
  • TRANSFERRING
  • ...
  • TRANSFERRING
  • TRANSFERRING
    • FINISHED_SUCCESS
    • FINISHED_CANCEL
    • ERROR
      • FINISHED_ERROR
File Information
public class Task {
    ...
 
    public class FileInfo {
        public File getFile();
        public String getPathName();
        public long getTransferSize();
        public long getTotalSize();
    }
 
    ...
}
File getFile()

Return the File object

String getPathName()

Return the File object

long getTransferSize()

Returns the transfer size in bytes.

long getTotalSize()

Return the size of the file in bytes.

Web API

Guidelines


Authentication

To use the APIs, you need to pass your API key.

Ways to Pass Your Key
HTTP Header

Pass the API key into the X-Api-Key header.

curl -H 'X-Api-Key: YOUR_API_KEY' 'https://send-anywhere.com/web/v1/device'
Get Query Parameter

Pass the API key into the api_key GET query string parameter.

curl 'https://send-anywhere.com/web/v1/device?api_key=YOUR_API_KEY'
HTTP Basic Auth Username

Pass the API key as the username (without password) using HTTP basic authentication.

curl 'https://YOUR_API_KEY@send-anywhere.com/web/v1/device'

Register Device

To use the API, you need to have a unique device_key in your Cookies.

curl -c $COOKIE_FILE "https://send-anywhere.com/web/v1/device?api_key=$API_KEY&profile_name=Send%20Anywhere%20SDK"

Send files

To send files, create an 6-digit KEY then you'll get a target link to upload files.

Request Sample (with jQuery)
 $.ajax({url: 'https://send-anywhere.com/web/v1/key',
       type: 'GET',
       dataType: 'jsonp',
       api_key: YOUR_API_KEY
       cache: false
}).done(function (data) {
    // `data.key` is an 6-digit KEY.
    // `data.weblink` is a target link.
});

Receive files

To receive files, query an 6-digit KEY then you'll get a target link to download files.

Request Sample (with jQuery)
$.ajax({url: 'https://send-anywhere.com/web/v1/key/' + 123456,
       type: 'GET',
       dataType: 'jsonp',
       api_key: YOUR_API_KEY,
       timeout: 3000,
       cache: false
}).done(function (data) {
    // data.weblink is a target link.
});

Cross Domain Request

We support JSONP which can be used by passing a callback parameter in the query string of the URL you are requesting.

Example

Check out more examples in our GitHub.

Web API

Reference


The base URL for API endpoints is:

 https://send-anywhere.com
HTTP Response Status
200 OK
400 Bad Request. Invalid request query string.
403 Forbidden. Invalid api_key.
404 Not Found. Invalid key
429 Many Request. To keep the amount of spam on Send Anywhere as low as possible.
500Server Error. Something went wrong on our side. We're very sorry.
GET /web/v1/device

Create an unique device_key for your client. If device_key already exists, just update the device.

Parameters
profile_name Client device name
Response Cookies
device_key Unique device key
GET /web/v1/key

Generate a 6-digit key for sending files.

Request Cookies
device_key Unique device key
Response
stringkey Generated key
stringweblink Upload URL
Response Sample
{
 "key": "123456"
 "weblink": "https://file.send-anywhere.com/api/webfile/123456"
}
/web/v1/key/{KEY}

Query a 6-digit key for receiving files.

Request Cookies
device_key Unqiue device key
Response
stringkey Requested key
stringweblink Download URL
Response Sample
{
 "key": "123456"
 "weblink": "https://file.send-anywhere.com/api/webfile/123456"
}

Web Widget

Copy. Paste. Transfer.

Add the Web Widget to your website or blog post. It's quick and easy!

After selecting the size and type, click the 'Generate Code' button. Then copy the generated code and paste it between <body> and </body>.

Apply for an API key

Do You Agree with Send Anywhere API’s Terms of Use?