### Get Files Info Request Body Example Source: https://github.com/keep2share/api/blob/master/index.html Example JSON payload for the getFilesInfo request, including authentication token and file IDs. ```json { "auth_token":"cb9tg4rt9lom9gb5i6tudgqlse", "ids":["358b6aa520a72"], "extended_info":true } ``` -------------------------------- ### Success Response for Get Files List Source: https://github.com/keep2share/api/blob/master/index.html Example of a successful response when retrieving a list of files. Includes status, code, and lists of folder names and IDs. ```json { "status":"success", "code":200, "foldersList":["test","simple"], "foldersIds":["5432a01230d2b","1632a04bb0d2a"] } ``` -------------------------------- ### Keep2ShareAPI.php SDK Usage Example Source: https://github.com/keep2share/api/blob/master/index.html This PHP code demonstrates various functionalities of the Keep2ShareAPI SDK, including login, getting file lists, uploading, getting download URLs, creating folders, and checking balance. ```php login(); /** getFiles **/ $getFiles = $api->getFilesList('/', 10, 0, ['date_created'=>-1], 'files'); /** upload **/ $upload = $api->uploadFile('PATH-TO-LOCAL-FILE'); /** getUrl **/ $getUrl = $api->GetUrl('ID-FILE'); /** createFolder **/ $createFolder = $api->createFolder('Any name'); /** getBalance **/ $getBalance = $api->getBalance(); ``` -------------------------------- ### Get Files Info Request Example Source: https://github.com/keep2share/api/blob/master/index.html Example cURL command to call the getFilesInfo endpoint with a JSON request body. ```bash curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/getFilesInfo ``` -------------------------------- ### Login Request Body Example Source: https://github.com/keep2share/api/blob/master/index.html This is an example of the JSON payload required for the /login endpoint. ```json { "username":"test", "password":"pass" } ``` -------------------------------- ### Get Subscriptions API Call Source: https://github.com/keep2share/api/blob/master/index.html Example cURL command to fetch subscription details for a given domain. Requires an authentication token and domain name. ```bash curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/getSubscriptions ``` -------------------------------- ### Get Files Info Success Response (without extended info) Source: https://github.com/keep2share/api/blob/master/index.html Example of a successful response from getFilesInfo when extended_info is false. ```json { "code": 200, "files": [ { "access": "public", "id": "da4a6352cb666", "is_available": true, "is_folder": false, "md5": "6661db843941f4b406e590c21caa9ca1", "name": "Super video.mp4", "size": 479125093 } ], "status": "success" } ``` -------------------------------- ### PHP Login with Username and Password Source: https://github.com/keep2share/api/blob/master/index.html PHP example for logging in using the Keep2ShareAPI class and retrieving the authentication token. ```PHP login(); var_dump($result); /* bool(true) */ var_dump($api->getAuthToken()); /* string(flmuf4o3uo59s105546dmvmq60) */ ``` -------------------------------- ### Get Balance Source: https://github.com/keep2share/api/blob/master/index.html Retrieves the user, partner, or reseller balance. Requires an auth_token. ```bash curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/getBalance ``` ```json { "auth_token":"cb9tg4rt9lom9gb5i6tudgqlse" } ``` ```json { "status":"success", "code":200, "balance":0.20 } ``` ```json { "status":"error", "code":403, "errorCode":10, "message":"You are not authorized for this action" } ``` -------------------------------- ### Upload File (PHP SDK) Source: https://github.com/keep2share/api/blob/master/index.html This example shows how to upload a file using the Keep2Share PHP SDK after successful login. ```APIDOC #### PHP: Upload File ### Description This PHP code demonstrates how to use the `Keep2ShareAPI` class to log in and then upload a file. ### Usage 1. Include the `Keep2ShareAPI.php` file. 2. Instantiate the `Keep2ShareAPI` class with your email and password. 3. Call the `login()` method. 4. If login is successful, call the `uploadFile()` method with the local file path. ### Code Example: ```php login(); if ($result === true) { $uploadResult = $api->uploadFile('somefile.txt'); var_dump($uploadResult); /* Example Response: array(5) { ["status"]=> string(7) "success" ["success"]=> bool(true) ["status_code"]=> int(200) ["user_file_id"]=> string(13) "a4b8776255952" ["link"]=> string(32) "http://k2s.cc/file/a4b8776255578" } */ } ?> ``` ``` -------------------------------- ### Success Response Body for File Info Source: https://github.com/keep2share/api/blob/master/index.html Example of a successful response when retrieving file information, including extended details. ```json { "status":"success", "code":200, "files": [ { "id":"4632a04bb0d2b", "name":"test", "is_available":false, "is_folder":false, "date_created":"2019-01-01 00:00:01", "size":1024, "md5":"a457f1dd3623a399d78a9672d225ddd5", "extended_info": { "abuses":[{ "type": "hash", "projects": ["k2s"], "blocked_to": "2020-01-01 00:00:01" }], "storage_object":"available", "size":1024, "date_download_last":"2019-01-01 00:00:01", "downloads":1, "access":"public", "content_type":"text" } } ] } ``` -------------------------------- ### Get Account Info Source: https://github.com/keep2share/api/blob/master/index.html Retrieves account traffic and subscription details. Requires an auth_token. ```bash curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/accountInfo ``` ```json { "auth_token":"cb9tg4rt9lom9gb5i6tudgqlse" } ``` ```json { "status":"success", "code":200, "available_traffic":53687091200, "account_expires":"2022-04-24T00:00:00.000Z" } ``` ```json { "status":"error", "code":403, "errorCode":10, "message":"You are not authorized for this action" } ``` -------------------------------- ### Curl Request for createFileMeta Source: https://github.com/keep2share/api/blob/master/index.html Example of how to make a POST request to the createFileMeta endpoint using curl. Requires authentication. ```curl curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/createFileMeta ``` -------------------------------- ### Created Folder Response Body Source: https://github.com/keep2share/api/blob/master/index.html Example of a successful response after creating a folder. Includes status, code, and the ID of the newly created folder. ```json { "status":"success", "code":200, "id":"0632a04bb0d21" } ``` -------------------------------- ### Not Acceptable Response for Create Folder Source: https://github.com/keep2share/api/blob/master/index.html Example of a 'Not Acceptable' response when an error occurs during folder creation. ```json { "status":"error", "code":406, "errorCode":60, "message":"Error create folder" } ``` -------------------------------- ### Premium File Response JSON Source: https://github.com/keep2share/api/blob/master/index.html Example JSON response for a file with premium access, showing different size and video info details. ```json { "status": "success", "code": 200, "access": "premium", "isAvailableForFree": false, "is_available": true, "is_folder": false, "name": "test.mp4", "size": 7777777, "date_created": "2019-01-01 00:00:01", "video_info": { "duration": 5392.92, "format": "MPEG-4", "width": 768, "height": 1024, "is_streamable": true } } ``` -------------------------------- ### Get Domains List Source: https://github.com/keep2share/api/blob/master/index.html Retrieves a list of available domains for file uploads. Requires an auth_token. ```bash curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/getDomainsList ``` ```json { "auth_token":"cb9tg4rt9lom9gb5i6tudgqlse" } ``` ```json { "status":"success", "code":200, "domains":['k2s.cc'] } ``` -------------------------------- ### Error Response Example (404 Not Found) Source: https://github.com/keep2share/api/blob/master/index.html This JSON structure represents an error response when a requested domain is not found. ```json { "status":"error", "code":400, "message":"Domain not found" } ``` -------------------------------- ### Get Subscriptions Request Body Source: https://github.com/keep2share/api/blob/master/index.html Example JSON payload for the getSubscriptions API endpoint. Includes authentication token, domain name, and optional limit/offset. ```json { "auth_token":"cb9tg4rt9lom9gb5i6tudgqlse", "domainName":"test.test", "limit":1 } ``` -------------------------------- ### Update File Request Example Source: https://github.com/keep2share/api/blob/master/index.html Example cURL command to update a file's properties using the Keep2Share API. Requires authentication and file ID. ```bash curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/updateFile ``` -------------------------------- ### Update Files Request Body Example Source: https://github.com/keep2share/api/blob/master/index.html This JSON object demonstrates the required parameters for updating file properties, including authentication token and file IDs. ```json { "auth_token":"cb9tg4rt9lom9gb5i6tudgqlse", "ids":["83f09624b61db","83f09624b61ds"] "new_name":"test" } ``` -------------------------------- ### cURL Request for getUrl Source: https://github.com/keep2share/api/blob/master/index.html Example cURL command to obtain a download link for a file using the getUrl endpoint. ```curl curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/getUrl ``` -------------------------------- ### File Response JSON Source: https://github.com/keep2share/api/blob/master/index.html Example JSON response body for a successful file retrieval, including file metadata and video information. ```json { "status": "success", "code": 200, "files": { "id": "1632a04bb0d2b", "access": "public", "isAvailableForFree": true, "name": "test.mp4", "is_available": true, "is_folder": false, "date_created": "2019-01-01 00:00:01", "size": 1024, "video_info": { "duration": 848.901, "width": 1920, "height": 1080, "format": "MPEG-4", "is_streamable": true } } } ``` -------------------------------- ### Curl Request for getFilesMeta Source: https://github.com/keep2share/api/blob/master/index.html Example of how to make a POST request to the getFilesMeta endpoint using curl. Ensure you have a valid access token. ```curl curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/getFilesMeta ``` -------------------------------- ### Get Account Info Source: https://github.com/keep2share/api/blob/master/index.html Retrieves account information using a permanent token for authorization. ```APIDOC ## POST /api/v2/accountInfo ### Description Retrieves the account information associated with the provided permanent token. ### Method POST ### Endpoint https://keep2share.cc/api/v2/accountInfo ### Parameters #### Request Body - **access_token** (string) - Required - The permanent token for authentication. ### Request Example ```json { "access_token":"yourtoken" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. - **code** (integer) - The HTTP status code. - **available_traffic** (integer) - The remaining available traffic in bytes. - **account_expires** (string) - The account expiration date in ISO 8601 format. ``` -------------------------------- ### Generic cURL Request Example Source: https://github.com/keep2share/api/blob/master/index.html A generic cURL command structure for making requests to the Keep2Share API, showing placeholders for method and path. ```curl curl -X \ https://keep2share.cc/api/v2/ ``` -------------------------------- ### Update File Success Response JSON Source: https://github.com/keep2share/api/blob/master/index.html Example JSON response body for a successful file update operation (202 Accepted). ```json { "status":"success", "code":202 } ``` -------------------------------- ### Create Folder Request Body Source: https://github.com/keep2share/api/blob/master/index.html Example JSON payload for creating a new folder. Requires authentication token, folder name, parent path, and access type. ```json { "auth_token":"cb9tg4rt9lom9gb5i6tudgqlse", "name":"test", "parent":"/", "access":"public" } ``` -------------------------------- ### Example Success Response for Reseller Code Source: https://github.com/keep2share/api/blob/master/index.html This is a successful response after requesting a reseller code. It includes the status, code, a unique code_id, the generated reseller_code, and the balance. ```json { "status":"success", "code":200, "code_id":1, "reseller_code":"mt2dr45tlnev", "code_id":0.10 } ``` -------------------------------- ### Get Files List Source: https://github.com/keep2share/api/blob/master/index.html This method allows you to receive a File list by its ID or from the root folder in your user space. It supports pagination, sorting, and filtering. ```APIDOC ## POST /getFilesList ### Description This method allows you to receive File list by its ID or from root folder in user space. ### Secured By - Custom Scheme (requires `access_token` for Partner Account or login for Keep2Share user account). ### Method POST ### Endpoint https://keep2share.cc/api/v2/getFilesList ### Parameters #### Request Body - **auth_token** (string) - Required - Example: cb9tg4rt9lom9gb5i6tudgqlse - **parent** (string) - Optional - Default: '/' - **limit** (integer) - Optional - Total number of files to receive, default 100, max 10000 - **offset** (integer) - Optional - Sampling start from N file with current order, default 0 - **sort** (array) - Optional - Examples: `{ name: 1 }, { name: -1 }, { date_created: 1 }, { date_created: -1 }` - **only_available** (boolean) - Optional - Default: false - **extended_info** (boolean) - Optional - Default: false - Includes additional info like abuses, storage_object, size, date_download_last, downloads, access, content_type. ### Request Example ```json { "auth_token": "cb9tg4rt9lom9gb5i6tudgqlse" } ``` ### Response #### Success Response (200 OK) (Response body structure not fully detailed in source, but implies a list of files with potential extended info.) ``` -------------------------------- ### Error Response Example (400 Bad Request) Source: https://github.com/keep2share/api/blob/master/index.html This JSON structure represents an error response when the request parameters are invalid. ```json { "status":"error", "code":400, "errorCode":2, "message":"Invalid request params" } ``` -------------------------------- ### Example 200 OK Response Body for findFile Source: https://github.com/keep2share/api/blob/master/index.html This JSON object represents a successful response from the findFile endpoint, indicating whether the file was found. ```json { "status":"success", "code":200, "found":true } ``` -------------------------------- ### Example JSON Request Body for findFile Source: https://github.com/keep2share/api/blob/master/index.html This JSON object represents the request body for the findFile endpoint, containing the authentication token and the MD5 hash of the file. ```json { "auth_token":"cb9tg4rt9lom9gb5i6tudgqlse", "md5":"a457f1dd3623a399d78a9672d225ddd1" } ``` -------------------------------- ### Example 200 OK Response Body for deleteFiles Source: https://github.com/keep2share/api/blob/master/index.html This JSON object represents a successful response from the deleteFiles endpoint, indicating the number of files deleted. ```json { "status":"success", "code":200, "deleted":2 } ``` -------------------------------- ### Get Account Info with Permanent Token Source: https://github.com/keep2share/api/blob/master/index.html Use this cURL command to retrieve account information by providing a permanent access token. ```cURL $ curl -X POST \ -H "Content-type: application/json" \ -d '{"access_token":"yourtoken"}' \ https://keep2share.cc/api/v2/accountInfo ``` -------------------------------- ### Example cURL Request for deleteFileMeta Source: https://github.com/keep2share/api/blob/master/index.html This cURL command demonstrates how to make a POST request to delete file metadata, including setting the content type and providing the request body. ```curl curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/deleteFileMeta ``` -------------------------------- ### Example Error Response (application/json) Source: https://github.com/keep2share/api/blob/master/index.html This JSON structure represents an error response from the API, indicating a failure in an operation like updating a file or exceeding disk quota. ```json { "status":"error", "code":406, "errorCode":63, "message":"Error update file" } ``` -------------------------------- ### Example JSON Request Body for deleteFiles Source: https://github.com/keep2share/api/blob/master/index.html This JSON object represents the request body for the deleteFiles endpoint, containing the authentication token and file IDs. ```json { "auth_token":"cb9tg4rt9lom9gb5i6tudgqlse", "ids":["83f09624b61db", "83f09624b61ds"] } ``` -------------------------------- ### Basic Upload Command Source: https://github.com/keep2share/api/blob/master/cli command/README.md This is the fundamental command to initiate a file upload using the partnercli. Ensure you provide the required access token and source folder. ```bash partnercli upload ``` -------------------------------- ### Help Command for Upload Source: https://github.com/keep2share/api/blob/master/cli command/README.md This command displays the help information for the 'upload' subcommand, detailing its usage and options. ```bash ./partnercli-macos help upload ``` -------------------------------- ### Get Captcha Image API Call Source: https://github.com/keep2share/api/blob/master/index.html Example cURL command to retrieve a captcha image using a provided ID. This is used to display the captcha to the user. ```bash curl -X GET \ https://keep2share.cc/api/v2/captcha?id= ``` -------------------------------- ### cURL Request Example for Updating File Metadata Source: https://github.com/keep2share/api/blob/master/index.html This cURL command demonstrates how to send a POST request to the updateFileMeta API endpoint. It includes the Content-type header and a JSON payload specified in a separate file (body.json). ```bash curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/updateFileMeta ``` -------------------------------- ### Login with Username and Password Source: https://github.com/keep2share/api/blob/master/index.html Use this cURL command to authenticate a user and obtain an auth_token. Ensure you provide the correct username and password in the request body. ```bash curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/login ``` -------------------------------- ### GET /captcha Source: https://github.com/keep2share/api/blob/master/index.html Retrieves the CAPTCHA image or challenge data. ```APIDOC ## GET /captcha ### Description Retrieves the CAPTCHA image or challenge data. ### Method GET ### Endpoint /captcha ``` -------------------------------- ### GET /reCaptcha Source: https://github.com/keep2share/api/blob/master/index.html Retrieves the reCAPTCHA image or challenge data. ```APIDOC ## GET /reCaptcha ### Description Retrieves the reCAPTCHA image or challenge data. ### Method GET ### Endpoint /reCaptcha ``` -------------------------------- ### Upload with Domain Name Option Source: https://github.com/keep2share/api/blob/master/cli command/README.md Use the -n or --domain-name option to specify the domain for generated URLs when uploading files. The default is 'k2s'. ```bash partnercli upload -n k2s ``` -------------------------------- ### GET /reCaptcha Source: https://github.com/keep2share/api/blob/master/index.html Returns an HTML page with the Google CAPTCHA. Requires an `id` query parameter. ```APIDOC ## GET /reCaptcha ### Description This method returns an html page with Google captcha. ### Method GET ### Endpoint https://keep2share.cc/api/v2/reCaptcha ### Parameters #### Query Parameters - **id** (string) - Required - example: 3fe7f38bba329 ### Request Example ``` curl -X GET \ https://keep2share.cc/api/v2/reCaptcha?id= ``` ### Response #### Success Response (200) - **Content-Type**: text/html #### Error Response (400 Bad Request) - **status** (string) - error - **code** (integer) - 400 - **message** (string) - example: Id not found #### Response Example ```json { "status":"error", "code":400, "message":"Id not found" } ``` ``` -------------------------------- ### Not Acceptable Error JSON Source: https://github.com/keep2share/api/blob/master/index.html Example JSON response for a 406 Not Acceptable error, indicating the file is not available. ```json { "status":"error", "code":406, "errorCode":20, "message":"File not available" } ``` -------------------------------- ### post /getFoldersList Source: https://github.com/keep2share/api/blob/master/index.html Returns the User's/Partner's list of folders. Requires authentication. ```APIDOC ## POST /getFoldersList ### Description This method returns User's/Partner's list of folders. ### Method POST ### Endpoint https://keep2share.cc/api/v2/getFoldersList ### Parameters #### Request Body - **auth_token** (string) - Required - Example: cb9tg4rt9lom9gb5i6tudgqlse - **parent_id** (string) - Optional - Get sub folders by folder id ### Request Example ```json { "auth_token": "cb9tg4rt9lom9gb5i6tudgqlse" } ``` ### Response #### Success Response (200) (Response details not provided in the source text) ``` -------------------------------- ### Upload Command Aliases Source: https://github.com/keep2share/api/blob/master/cli command/README.md Short aliases 'u' and 'upl' can be used as shortcuts for the 'partnercli upload' command. ```bash partnercli u ``` ```bash partnercli upl ``` -------------------------------- ### POST /createFileMeta Source: https://github.com/keep2share/api/blob/master/index.html Creates metadata for a file. Allows setting a title, description, and tags for the specified file. This endpoint is secured and requires authentication. ```APIDOC ## POST /createFileMeta ### Description Creates metadata for a file. Allows setting a title, description, and tags for the specified file. ### Method POST ### Endpoint https://keep2share.cc/api/v2/createFileMeta ### Parameters #### Request Body ##### application/json - **auth_token** (string) - Optional - Authentication token for partner accounts. - **file_id** (string) - Required - The ID of the file for which to create metadata. - **title** (string) - Optional - The title for the file metadata. - **description** (string) - Optional - The description for the file metadata. - **tags** (array) - Optional - An array of tags to associate with the file. - **tags[]** (string) - A tag for the file. ### Request Example ```json { "auth_token": "cb9tg4rt9lom9gb5i6tudgqlse", "file_id": "96a9d7445484c", "title": "My Awesome Video", "description": "This is a description for my video file.", "tags": ["video", "tutorial"] } ``` ### Response (Response details for `createFileMeta` are not fully provided in the source text, only the request body structure is available.) ### Error Handling (Error handling details for `createFileMeta` are not fully provided in the source text.) ``` -------------------------------- ### POST /createFolder Source: https://github.com/keep2share/api/blob/master/index.html Creates a new folder within the user's account. ```APIDOC ## POST /createFolder ### Description Creates a new folder within the user's account. ### Method POST ### Endpoint /createFolder ### Parameters #### Request Body - **folderName** (string) - Required - The name of the folder to create. ``` -------------------------------- ### POST /createFileMeta Source: https://github.com/keep2share/api/blob/master/index.html Creates metadata for a file. ```APIDOC ## POST /createFileMeta ### Description Creates metadata for a file. ### Method POST ### Endpoint /createFileMeta ### Parameters #### Request Body - **fileId** (string) - Required - The ID of the file to associate metadata with. - **metaData** (object) - Required - An object containing the metadata key-value pairs. ``` -------------------------------- ### GET /captcha Source: https://github.com/keep2share/api/blob/master/index.html This method returns an image with a captcha code. It requires an 'id' parameter to specify which captcha to retrieve. ```APIDOC ## GET /captcha ### Description This method returns an image with a code. ### Method GET ### Endpoint https://keep2share.cc/api/v2/captcha ### Parameters #### Query Parameters - **id** (string) - Required - example: 3fe7f38bba329 ### Request Example curl -X GET \ https://keep2share.cc/api/v2/captcha?id= ### Response #### Success Response (200) - **image/jpg** - The captcha image. ``` -------------------------------- ### Upload from Source Folder Source: https://github.com/keep2share/api/blob/master/cli command/README.md The -s or --source-folder option is required to specify the local path containing the files to be uploaded. ```bash partnercli upload -s /path/to/local/folder ``` -------------------------------- ### Get Download URL (cURL) Source: https://github.com/keep2share/api/blob/master/index.html This cURL request retrieves a temporary download URL for a given file ID. ```APIDOC #### CURL: Get Download URL ### Description This cURL command sends a POST request to the `getUrl` API endpoint to obtain a download URL for a specified file ID. Authorization is not required for this operation. ### Method POST ### Endpoint `https://keep2share.cc/api/v2/getUrl` ### Parameters #### Request Body - **auth_token** (string) - Required - Your authentication token. - **file_id** (string) - Required - The ID of the file for which to get the download URL. ### Request Example: ```json { "auth_token": "", "file_id": "" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the request (e.g., "success"). - **code** (integer) - The HTTP status code. - **url** (string) - The temporary download URL for the file. #### Response Example: ```json { "status": "success", "code": 200, "url": "https://prx-214.keep2share.cc/6b50f2add0ba8/a8db134b2b824/12bb6331eaf8e?temp_url_sig=cd2cb4d790632999d2623adfba6683a86e4294e439f4f927afc78744cceae28629c7119345093b8f30109725063d7cc2536d586ac2bd56554bc1101c9356e84f&temp_url_expires=1569891870&id=dba7c1fa58ef0&ip=any&node_id=214&countable=1&project=k2s&user_id=1&uf=a4b8776255352&tags=legacy-api%2Cdownload%2Ck2s&name=sometfile.txt" } ``` ``` -------------------------------- ### Login with Username and Password Source: https://github.com/keep2share/api/blob/master/index.html Authenticate with the API using your email and password to obtain an auth_token. This is a prerequisite for many API operations. ```cURL $ curl -X POST \ -H "Content-type: application/json" \ -d '{"username":"yourbox@gmail.com","password":"yourpassword"}' \ https://keep2share.cc/api/v2/login ``` -------------------------------- ### post /createFileByHash Source: https://github.com/keep2share/api/blob/master/index.html Allows the creation of a file using its MD5 hash. If a file with the same hash already exists, this speeds up the upload process. ```APIDOC ## POST /createFileByHash ### Description This method allows you to create a file based on a hash sum (md5). If our project already has a file with this hash sum (md5), it speeds up the upload time. ### Method POST ### Endpoint https://keep2share.cc/api/v2/createFileByHash ### Parameters #### Request Body - **auth_token** (string) - Required - Example: cb9tg4rt9lom9gb5i6tudgqlse - **hash** (string) - Required - Example: 'a457f1dd3623a399d78a9672d225ddd1' - **name** (string) - Required - Example: 'test2' - **parent** (string) - Optional - parent_id or set default '/' - **access** (string) - Optional - Enum: public, private, premium ### Request Example ```json { "auth_token":"cb9tg4rt9lom9gb5i6tudgqlse", "hash":"a457f1dd3623a399d78a9672d225ddd1", "name":"test2" } ``` ### Response #### Success Response (201 Created) - **status** (string) - success - **code** (integer) - 201 - **id** (string) - Example: 0632a04bb0d21 #### Response Example ```json { "status":"success", "code":200, "id":"0632a04bb0d21", "link":"https://k2s.cc/file/0632a04bb0d21" } ``` #### Error Responses - **400 Bad Request**: Invalid request params. `errorCode`: 2. - **403 Forbidden**: You are not authorized for this action. `errorCode`: 10. - **406 Not Acceptable**: Error create file. `errorCode`: 20, 61, 62, 64. ``` -------------------------------- ### cURL Request for remoteUploadStatus Source: https://github.com/keep2share/api/blob/master/index.html Example cURL command to check the status of recently added file links using the remoteUploadStatus endpoint. ```curl curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/remoteUploadStatus ``` -------------------------------- ### POST /createFileByHash Source: https://github.com/keep2share/api/blob/master/index.html Creates a file using its hash, potentially for deduplication. ```APIDOC ## POST /createFileByHash ### Description Creates a file using its hash, potentially for deduplication. ### Method POST ### Endpoint /createFileByHash ### Parameters #### Request Body - **hash** (string) - Required - The hash of the file to create. - **fileName** (string) - Required - The desired name for the new file. ``` -------------------------------- ### POST /login Source: https://github.com/keep2share/api/blob/master/index.html Authenticates a user and returns an authorization token. ```APIDOC ## POST /login ### Description Authenticates a user and returns an authorization token. ### Method POST ### Endpoint /login ### Parameters #### Request Body - **username** (string) - Required - The username for authentication. - **password** (string) - Required - The password for authentication. ``` -------------------------------- ### 200 OK Response for getUrl Source: https://github.com/keep2share/api/blob/master/index.html This JSON object represents a successful response when requesting a download URL, including the direct download link. ```json { "status":"success", "code":200, "url":"https://prx-214.keep2share.cc/6b50f2add0ba8/name=sometfile.txt" } ``` -------------------------------- ### Login with Username and Password Source: https://github.com/keep2share/api/blob/master/index.html Authenticates with the API using username and password to obtain an auth token. ```APIDOC ## POST /api/v2/login ### Description Authenticates a user using their username and password. If successful, it returns an `auth_token`. ### Method POST ### Endpoint https://keep2share.cc/api/v2/login ### Parameters #### Request Body - **username** (string) - Required - The user's email address. - **password** (string) - Required - The user's password. ### Request Example ```json { "username":"yourbox@gmail.com", "password":"yourpassword" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. - **code** (integer) - The HTTP status code. - **auth_token** (string) - The authentication token for subsequent requests. - **message** (string) - A success message. ``` -------------------------------- ### Error Response Example (406 Not Acceptable) Source: https://github.com/keep2share/api/blob/master/index.html This JSON structure represents an error response when the request cannot be accepted, possibly due to format issues. ```json { "status":"error", "code":406, "errorCode":60, "message":"Error list file meta" } ``` -------------------------------- ### Request Captcha API Call Source: https://github.com/keep2share/api/blob/master/index.html Example cURL command to request a captcha challenge from the Keep2Share API. This is used for user verification during downloads. ```bash curl -X POST \ https://keep2share.cc/api/v2/requestCaptcha ``` -------------------------------- ### cURL Request for createFileByHash Source: https://github.com/keep2share/api/blob/master/index.html Use this cURL command to create a file using its hash. Ensure you have the correct Content-type and body.json. ```bash curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/createFileByHash ``` -------------------------------- ### Get Download URL (PHP SDK) Source: https://github.com/keep2share/api/blob/master/index.html This PHP code snippet demonstrates how to obtain a download URL using the Keep2Share API SDK. ```APIDOC #### PHP: Get Download URL ### Description This PHP code shows how to use the `Keep2ShareAPI` class to retrieve a download URL for a given file ID after logging in. ### Usage 1. Include the `Keep2ShareAPI.php` file. 2. Instantiate the `Keep2ShareAPI` class. 3. Call the `login()` method. 4. If login is successful, call the `getUrl()` method with the file ID. ### Code Example: ```php login(); var_dump($result); /* Example Response: bool(true) */ var_dump($api->getUrl('')); /* Example Response: array(3) { ["status"]=> string(7) "success" ["code"]=> int(200) ["url"]=> string(391) "https://prx-214.keep2share.cc/6b50f2add0ba8/a8db134b2b824/12bb6331eaf8e?temp_url_sig=cd2cb4d790632999d2623adfba6683a86e4294e439f4f927afc78744cceae28629c7119345093b8f30109725063d7cc2536d586ac2bd56554bc1101c9356e84f&temp_url_expires=1569891870&id=dba7c1fa58ef0&ip=any&node_id=214&countable=1&project=k2s&user_id=1&uf=a4b8776255352&tags=legacy-api%2Cdownload%2Ck2s&name=sometfile.txt" } */ ?> ``` ``` -------------------------------- ### POST /getFilesInfo Source: https://github.com/keep2share/api/blob/master/index.html Retrieves detailed information about specified files. ```APIDOC ## POST /getFilesInfo ### Description Retrieves detailed information about specified files. ### Method POST ### Endpoint /getFilesInfo ### Parameters #### Request Body - **fileIds** (array) - Required - An array of file IDs for which to retrieve information. ``` -------------------------------- ### Error Response Example (403 Forbidden - General) Source: https://github.com/keep2share/api/blob/master/index.html This JSON structure represents a general forbidden error response, often due to insufficient permissions. ```json { "status":"error", "code":403, "errorCode":10, "message":"You are not authorized for this action" } ``` -------------------------------- ### Upload with Access Token Source: https://github.com/keep2share/api/blob/master/cli command/README.md The -a or --access-token option is required to authenticate your requests with your profile's access token. ```bash partnercli upload -a YOUR_ACCESS_TOKEN ``` -------------------------------- ### Get Subscriptions Success Response Source: https://github.com/keep2share/api/blob/master/index.html This JSON structure represents a successful response when fetching subscription details, including total count and a list of items. ```json { "status":"success", "code":200, "total":10, "items": [ { "userEmail":"user1@test.test", "domainName":"test.test", "expiresAt":"2021-08-25T15:23:15.000Z", "lastPayment":"2021-08-25T15:23:15.000Z" } ] } ``` -------------------------------- ### Upload File (cURL) Source: https://github.com/keep2share/api/blob/master/index.html This snippet demonstrates how to upload a file using cURL by first fetching upload form data and then submitting the file. ```APIDOC ## Bash script: upload.sh ### Description This script uploads a file to Keep2Share. It first retrieves necessary form data from the API and then uses `curl` to upload the file. ### Usage 1. Ensure `jq` is installed: `sudo apt-get install jq` 2. Make the script executable: `sudo chmod +x upload.sh` 3. Run the script: `./upload.sh` ### Steps: 1. **Get Upload Form Data**: ```bash curl -s -H 'Content-Type: application/json' -d '{"access_token": "your_token"}' "https://keep2share.cc/api/v2/getUploadFormData" ``` 2. **Extract Form Details**: The script parses the JSON response to get `form_action`, `file_field`, `ajax`, `params`, and `signature`. 3. **Upload File**: ```bash curl -F "$FileField=@$FullFileName" -F "ajax=$Ajax" -F "signature=$Sig" -F "params=$Params" "$Form_Action" ``` ``` -------------------------------- ### cURL Request for Reseller Code Source: https://github.com/keep2share/api/blob/master/index.html This cURL command demonstrates how to request a reseller code using the POST method. Ensure you include the correct Content-type and provide the request body. ```bash curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/resellerGetCode ``` -------------------------------- ### Update File Request Body JSON Source: https://github.com/keep2share/api/blob/master/index.html Example JSON payload for the updateFile API method, specifying authentication token, file ID, and new name. ```json { "auth_token":"cb9tg4rt9lom9gb5i6tudgqlse", "id":"83f09624b61db" "new_name":"test" } ``` -------------------------------- ### POST /copyFileMeta Source: https://github.com/keep2share/api/blob/master/index.html Copies metadata from one file to another. ```APIDOC ## POST /copyFileMeta ### Description Copies metadata from one file to another. ### Method POST ### Endpoint /copyFileMeta ### Parameters #### Request Body - **sourceFileId** (string) - Required - The ID of the file to copy metadata from. - **destinationFileId** (string) - Required - The ID of the file to copy metadata to. ``` -------------------------------- ### post /findFile Source: https://github.com/keep2share/api/blob/master/index.html This method allows to check file presence in our cloud storage using hash sum (md5). It requires an authentication token and the md5 hash of the file. ```APIDOC ## POST /findFile ### Description This method allows to check file presence in our cloud storage using hash sum (md5). It requires an authentication token and the md5 hash of the file. ### Method POST ### Endpoint https://keep2share.cc/api/v2/findFile ### Parameters #### Request Body - **auth_token** (string) - Required - Example: cb9tg4rt9lom9gb5i6tudgqlse - **md5** (string) - Required - Example: 'a457f1dd3623a399d78a9672d225ddd1' ### Request Example ```json { "auth_token": "cb9tg4rt9lom9gb5i6tudgqlse", "md5": "a457f1dd3623a399d78a9672d225ddd1" } ``` ### Response #### Success Response (200) - **status** (string) - success - **code** (integer) - 200 - **found** (boolean) #### Response Example ```json { "status": "success", "code": 200, "found": true } ``` #### Error Responses - **400 Bad Request**: Invalid request params. `errorCode`: 2. - **403 Forbidden**: You are not authorized for this action. `errorCode`: 10. ``` -------------------------------- ### Example Not Acceptable Response for Reseller Code Source: https://github.com/keep2share/api/blob/master/index.html This response indicates a 406 Not Acceptable error, which can occur if there are no available reseller codes or an error occurred during the purchase process. ```json { "status":"error", "code":406, "errorCode":50, "message":"No available reseller codes" } ``` -------------------------------- ### Request Body for getUrl Source: https://github.com/keep2share/api/blob/master/index.html JSON object representing the request body to get a download URL, including file ID and optional authentication or captcha parameters. ```json { "file_id":"3fe7f38bba329" } ``` -------------------------------- ### Request Body for Folder List Source: https://github.com/keep2share/api/blob/master/index.html This JSON object represents the required parameters for the getFoldersList request. It includes an authentication token and an optional parent_id to get subfolders. ```json { "auth_token":"cb9tg4rt9lom9gb5i6tudgqlse" } ``` -------------------------------- ### POST /test Source: https://github.com/keep2share/api/blob/master/index.html A test endpoint to verify API connectivity. ```APIDOC ## POST /test ### Description A test endpoint to verify API connectivity. ### Method POST ### Endpoint /test ``` -------------------------------- ### Login with reCAPTCHA Source: https://github.com/keep2share/api/blob/master/index.html Completes the login process using username, password, and reCAPTCHA verification details. ```APIDOC ## POST /api/v2/login (with reCAPTCHA) ### Description Authenticates a user using their username, password, and reCAPTCHA verification response. This method is used after successfully completing the reCAPTCHA challenge. ### Method POST ### Endpoint https://keep2share.cc/api/v2/login ### Parameters #### Request Body - **username** (string) - Required - The user's email address. - **password** (string) - Required - The user's password. - **re_captcha_challenge** (string) - Required - The challenge identifier obtained from `requestReCaptcha`. - **re_captcha_response** (string) - Required - The response code obtained after solving the reCAPTCHA. ### Request Example ```json { "username":"yourbox@gmail.com", "password":"yourpassword", "re_captcha_challenge":"9c726b3ce8b34", "re_captcha_response":"9c726b3ce8b349c726b3ce8b349c726b3ce8b34" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. - **code** (integer) - The HTTP status code. - **auth_token** (string) - The authentication token for subsequent requests. ``` -------------------------------- ### Error Response Example (406 Not Acceptable) Source: https://github.com/keep2share/api/blob/master/index.html This JSON structure illustrates an error response for a 406 Not Acceptable status, often related to file availability or download restrictions. ```json { "status":"error", "code":406, "errorCode":30, "message":"Captcha required" } ``` ```json { "status":"error", "code":406, "errorCode":21, "message":"File is not available" "errors": [ { "code":1, "message": "Download count files exceed" } ] } ``` -------------------------------- ### cURL Request for Folder List Source: https://github.com/keep2share/api/blob/master/index.html This cURL command demonstrates how to request a list of user folders using the POST method. It requires an authentication token. ```bash curl -X POST \ -H "Content-type: application/json" \ -d @body.json \ https://keep2share.cc/api/v2/getFoldersList ``` -------------------------------- ### Example Forbidden Response for General API Call Source: https://github.com/keep2share/api/blob/master/index.html This response indicates a 403 Forbidden error, typically due to authorization issues. It includes an errorCode and a descriptive message. ```json { "status":"error", "code":403, "errorCode":10, "message":"You are not authorized for this action" } ```