Skip to content

s3.php

S3 storage management module: creating and deleting accounts, managing buckets and files, retrieving usage statistics, managing tariff plans, and billing.

API Methods

Method Action Description
create_account create a free S3 account Creates a free S3 account for a client with the specified plan and location, creates a bucket, and initializes counters.
create_bucket create a bucket Creates a new bucket in an existing S3 account.
create_order create a paid order Creates a paid order for S3 storage, creates a service in billing, and creates a user account.
delete_account delete S3 account Completely deletes the user's S3 account and all associated data.
delete_bucket delete a bucket Deletes the specified bucket from the S3 account.
delete_file delete a file Deletes the specified file from the S3 bucket.
delete_payment_account delete a paid account Sets the termination date for a paid S3 account.
get_buckets get bucket list (AWS) Returns the user's bucket list via the AWS API, including traffic and snapshot information.
get_buckets_rmq get bucket list (RMQ) Returns the bucket list via the message queue (RMQ), including detailed usage statistics and access keys.
get_files get file list Returns a list of files and folders in the specified bucket with pagination and search support.
get_users get user list Returns a list of S3 users with filtering by plan, location, email, and traffic statistics.
history get plan history Returns the change history for the specified tariff plan.
list_plans get tariff plan list Returns a list of available S3 storage tariff plans.
show_key get access key Returns the decrypted access key (access_key or secret_key) for an S3 account.

s3/cancel_payment_account_deletion

Cancels the scheduled deletion of a paid S3 account, restoring its status.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: cancel_payment_account_deletion
token string Authorization token
s3uid string Unique S3 account identifier
id int Client ID (for administrators)

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=cancel_payment_account_deletion" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE"
Example of a successful response
{
"result": "OK",
"action": "cancel_payment_account_deletion",
"message": "Termination cancelled successfully"
}
Failure response
{
"code": -1,
"message": "S3 account not found for this customer"
}

s3/create_account

Creates a free S3 account for a client with the specified plan and location, creates a bucket, and initializes counters.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: create_account
token string Authorization token
plan_id int Tariff plan ID
bucket_name string Name of the bucket to create
location string Location code (e.g., NL)

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=create_account" \
--data "token=HOSTKEY_TOKEN" \
--data "plan_id=VALUE" \
--data "bucket_name=VALUE" \
--data "location=VALUE"
Example of a successful response
{
"result": "OK",
"action": "create_account",
"s3uid": "s3-12345-abcde"
}
Failure response
{
"code": -1,
"message": "S3 account not found for this customer"
}

s3/create_bucket

Creates a new bucket in an existing S3 account.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: create_bucket
token string Authorization token
s3uid string Unique S3 account identifier
bucket_name string Name of the bucket to create

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=create_bucket" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE" \
--data "bucket_name=VALUE"
Example of a successful response
{
"result": "OK",
"action": "create_bucket",
"message": {
"status": 200,
"body": "",
"headers": {}
}
}
Failure response
{
"code": -1,
"message": "Create bucket error: Bucket already exists"
}

s3/create_order

Creates a paid order for S3 storage, creates a service in billing, and creates a user account.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: create_order
token string Authorization token
plan_id int Tariff plan ID
bucket_name string Name of the bucket to create
location string Location code (e.g., NL)

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=create_order" \
--data "token=HOSTKEY_TOKEN" \
--data "plan_id=VALUE" \
--data "bucket_name=VALUE" \
--data "location=VALUE"
Example of a successful response
{
"result": "OK",
"action": "create_order",
"s3uid": "s3-67890-fghij"
}
Failure response
{
"code": -1,
"message": "issue service paid"
}

s3/delete_account

Completely deletes the user's S3 account and all associated data.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: delete_account
token string Authorization token
s3uid string Unique S3 account identifier

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=delete_account" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE"
Example of a successful response
{
"result": "OK",
"action": "delete_account",
"message": "Account deleted successfully"
}
Failure response
{
"code": -1,
"message": "Delete S3 account error: Account not found"
}

s3/delete_bucket

Deletes the specified bucket from the S3 account.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: delete_bucket
token string Authorization token
s3uid string Unique S3 account identifier
bucket_name string Name of the bucket to delete

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=delete_bucket" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE" \
--data "bucket_name=VALUE"
Example of a successful response
{
"result": "OK",
"action": "delete_bucket",
"message": "string"
}
Failure response
{
"code": -1,
"message": "Delete S3 bucket error: Bucket not empty"
}

s3/delete_file

Deletes the specified file from the S3 bucket.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: delete_file
token string Authorization token
s3uid string Unique S3 account identifier
bucket_name string Bucket name
filename string Path to the file to delete

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=delete_file" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE" \
--data "bucket_name=VALUE" \
--data "filename=VALUE"
Example of a successful response
{
"result": "OK",
"action": "delete_file",
"message": "File deleted successfully"
}
Failure response
{
"code": -1,
"message": "Delete S3 file error: File not found"
}

s3/delete_payment_account

Sets the termination date for a paid S3 account.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: delete_payment_account
token string Authorization token
s3uid string Unique S3 account identifier

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=delete_payment_account" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE"
Example of a successful response
{
"result": "OK",
"action": "delete_payment_account",
"message": "Service termination scheduled"
}
Failure response
{
"code": -1,
"message": "Invalid service ID"
}

s3/get_buckets

Returns the user's bucket list via the AWS API, including traffic and snapshot information.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: get_buckets
token string Authorization token
s3uid string Unique S3 account identifier

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=get_buckets" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE"
Example of a successful response
{
"result": "OK",
"action": "get_buckets",
"message": [
{
"name": "my-bucket",
"creation_date": "2023-10-01T12:00:00Z"
}
],
"bandwidth": 102400,
"snapshot": {
"bandwidth_usage": 102400,
"storage_usage": 5368709120,
"created_at": "2023-10-27T10:00:00Z"
}
}
Failure response
{
"code": -1,
"message": "s3/get_buckets: Load bucket error: Access denied."
}

s3/get_buckets_rmq

Returns the bucket list via the message queue (RMQ), including detailed usage statistics and access keys.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: get_buckets_rmq
token string Authorization token
s3uid string Unique S3 account identifier

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=get_buckets_rmq" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE"
Example of a successful response
{
"result": "OK",
"action": "get_buckets_rmq",
"message": [
{
"name": "data-bucket",
"usage": 1073741824
}
],
"bandwidth": 204800,
"usage_storage": 1073741824,
"quota": 5368709120,
"snapshots": [
{
"bandwidth_usage": 204800,
"storage_usage": 1073741824,
"created_at": "2023-10-27T10:00:00Z"
}
],
"access_key": "AKIAIOSFODNN7EXAMPLE",
"secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}
Failure response
{
"code": -1,
"message": "S3 account not found for this customer"
}

s3/get_files

Returns a list of files and folders in the specified bucket with pagination and search support.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: get_files
token string Authorization token
s3uid string Unique S3 account identifier
bucket_name string Bucket name
continuation_token string Token for pagination
max_keys int Maximum number of files (up to 100)
search string Search string in file names

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=get_files" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE" \
--data "bucket_name=VALUE"
Example of a successful response
{
"result": "OK",
"action": "get_files",
"files": [
{
"key": "document.pdf",
"original_key": "document.pdf",
"size": 102400,
"last_modified": "2023-10-27T10:00:00Z"
}
],
"folders": [
{
"key": "images/"
}
],
"next_token": "eyJDb250aW51YXRpb25Ub2tlbiI6IkFCQzEyMyJ9"
}
Failure response
{
"code": -1,
"message": "Load S3 files error: Bucket not found"
}

s3/get_users

Returns a list of S3 users with filtering by plan, location, email, and traffic statistics.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: get_users
token string Authorization token
id int Client ID (for admin)
plan_id int Filter by plan ID
s3uid string Filter by S3UID
email string Filter by email
billing string Filter by billing location
limit int Record limit
order string Sorting field
order_by string Sorting direction (ASC/DESC)
period_from string Start date for traffic (YYYY-MM-DD)
period_to string End date for traffic (YYYY-MM-DD)

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=get_users" \
--data "token=HOSTKEY_TOKEN"
Example of a successful response
{
"result": "OK",
"action": "get_users",
"s3_users": [
{
"id": 123,
"s3uid": "s3-12345",
"email": "[email protected]",
"plan_id": 5,
"location": "NL",
"traffic": 104857600,
"storage_usage": 524288000,
"service": {
"status": "active",
"termination_date": "2024-10-27"
}
}
]
}
Failure response
{
"code": -1,
"message": "customer not found"
}

s3/history

Returns the change history for the specified tariff plan.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: history
token string Authorization token
id int Tariff plan ID

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=history" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE"
Example of a successful response
{
"result": "OK",
"action": "history",
"data": []
}
Failure response
{
"code": -1,
"message": "s3/history: invalid command"
}

s3/list_plans

Returns a list of available S3 storage tariff plans.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: list_plans
token string Authorization token
id int Specific plan ID (for admin)

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=list_plans" \
--data "token=HOSTKEY_TOKEN"
Example of a successful response
{
"result": "OK",
"action": "list_plans",
"plans": [
{
"id": 1,
"name": "Basic S3",
"quota": 10737418240,
"active": 1,
"locations": [
"NL",
"DE"
],
"monthly_eur": 5.0,
"monthly_usd": 5.5,
"storage_type": "standard",
"bandwidth_limit": 0,
"price": {
"monthly_eur": 5.0,
"monthly_usd": 5.5
}
}
]
}
Failure response
{
"code": -1,
"message": "s3/list_plans: invalid request"
}

s3/show_key

Returns the decrypted access key (access_key or secret_key) for an S3 account.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: show_key
token string Authorization token
s3uid string Unique S3 account identifier
s3_key string Key type: 'access_key' or 'secret_key'

Example Request

curl -s "https://api.hostkey.com/s3.php" -X POST \
--data "action=show_key" \
--data "token=HOSTKEY_TOKEN" \
--data "s3uid=VALUE" \
--data "s3_key=VALUE"
Example of a successful response
{
"result": "OK",
"action": "show_key",
"key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}
Failure response
{
"code": -1,
"message": "invalid key"
}

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×