Service Endpoint

http://api.sandcage.com/0.2/destroy-files


Example Request Payload

{"key":"Your API key.","files":[{"reference_id":"62v"},{"file_token":"file_omc7bwr_lcghngkugwhqd8o4onqplnfzt03"}],"callback_url":"http:\/\/www.example.com\/callback_url"}

Example Success Response

{"request_id":"req_Z9RVuZBPCfFV3T5yoCllDigDSIBD4tfTDstcLf","status":"success"}

Example Error Response

{"request_id":"req_Z9RVuZBPCfFV3T5yoCllDigDSIBD4tfTDstcLf","status":"error","error_msgs":[{"code":1234,"short":"Short error message","long":"This is a long error message that describes in more detail the error that occurred."}]}

Example Success Response With Warning

{"request_id":"req_Z9RVuZBPCfFV3T5yoCllDigDSIBD4tfTDstcLf","status":"success","warning_msgs":[{"code":1234,"short":"Short warning message","long":"This is a long warning message that describes in more detail the issue that occurred."}]}

Request Parameters

key*

string

requiredYour API key.
files*

array

1...1000

requiredAn array of files to be deleted.
files[]

struct

A single file
reference_id

string

1...100

conditionalThe optional unique identifier that you have assigned to the file when creating it.
If a value is provided for the "file_token" and "reference_id" parameters, then the "file_token" parameter value will take precedence and the "reference_id" will be ignored.
A value must be provided for either the "file_token" or "reference_id" parameter.
file_token

string

30...70

conditionalThe token of the file to be deleted.
If a value is provided for the "file_token" and "reference_id" parameters, then the "file_token" parameter value will take precedence and the "reference_id" will be ignored.
A value must be provided for either the "file_token" or "reference_id" parameter.
callback_url

string

4...1000

optionalYour callback url.
If provided, a callback will be sent to this url whenever there is an update available for any of the tasks included in this request. See Callback for more details.

Response Format

request_id

string

A unique identifier for this request.
status

string

Either "success" or "error".
error_msgs

array

An array of errors.
Error messages will only be included as part of the response if the request was not successful.
error_msgs[]

struct

An error.
code

string

The error code.
short

string

The short error message.
long

string

The long and more detailed error message.
warning_msgs

array

An array of warnings.
Warning messages will only be included as part of the response if the request was successful.
warning_msgs[]

struct

A warning.
code

string

The warning code.
short

string

The short warning message.
long

string

The long and more detailed warning message.

Callbacks


Example Callback Payload

{"tasks":[{"status":"success","request_id":"req_Z9RVuZBPCfFV3T5yoCllDigDSIBD4tfTDstcLf","reference_id":"123456789","file_token":"file_q2bxt3mdzgw9qgiji1ff2aiw4wzmwivia","actions":"delete"},{"status":"success","request_id":"req_Z9RVuZBPCfFV3T5yoCllDigDSIBD4tfTDstcLf","reference_id":"","file_token":"file_29tate7ukpjt2l5enxwf712cwei_lofljn","actions":"delete"}]}

Callback Format

tasks

array

1...10000

An array of tasks.
tasks[]

struct

A single task
status

string

always returnedEither "success", "error".
request_id

string

always returnedThe "request_id" that was associated the respective task action.
reference_id

string

0...100

always returnedThe "reference_id" that was associated the respective task action.
file_token

string

30...70

always returnedThe unique token of the task.
This is generated by and can be used as an alternative identifier.
actions

string

always returnedThe value will always be "delete".
error_code

string

conditionally returnedThe error code.
This will only be included if the value of "status" for this tasks was "error".
error_msg

string

conditionally returnedThe error message.
This will only be included if the value of "status" for this tasks was "error".

Still Have Questions?

We're always happy to help with code and integrations. Talk to us!