BinoclardBox

Upload Endpoint

POST /upload

Upload a file with optional parameters.

Parameters

Parameter Type Required Description
file file Yes The file to upload
expiration string No Expiration time: 1hour, 1day, 1week, 1month (default: 1day)
delete_after_read string No Delete file after first download: true or false (default: false)

HTTP Status Codes

Status Code Description
200 OK Upload successful
400 Bad Request Invalid parameters, no file uploaded, or file too large
403 Forbidden Access denied (IP address or file hash is blacklisted)
413 Payload Too Large Request body exceeds maximum size (before parsing)
500 Internal Server Error Server error during upload processing
507 Insufficient Storage Server storage quota exceeded

Success Response (200 OK)

Returns JSON with file information:

{
  "id": "IX91qrQrUSjv.txt",
  "deletion_token": "iPmOptoDDF7E290xXQmWRRvf5H4GlN22",
  "original_filename": "example.txt",
  "size": 1024
}

Note: Use the id to construct URLs:

Error Response (4xx/5xx)

Returns JSON with error details:

{
  "detail": "Error message",
  "status_code": 400
}

Delete Endpoint

DELETE /delete/{id}/{deletion_token}

Delete an uploaded file using its ID and deletion token.

Parameters

Parameter Type Required Description
id string Yes The file ID (from upload response)
deletion_token string Yes The deletion token (from upload response)

HTTP Status Codes

Status Code Description
204 No Content File deleted successfully
404 Not Found File not found or invalid deletion key

Success Response (204 No Content)

Returns empty response body.

Error Response (404 Not Found)

Returns JSON with error details:

{
  "detail": "Not Found",
  "status_code": 404
}

curl examples

Basic Upload

curl -F "file=@example.txt" https://box.binoclard.net/upload

Upload with parameters

curl -F "file=@document.pdf" -F "expiration=1week" -F "delete_after_read=true" https://box.binoclard.net/upload

Delete uploaded file

curl -X DELETE https://box.binoclard.net/delete/{id}/{deletion_token}