Skip to content

cleanup.php

Cleanup and maintenance module for managing stalled deployments, system tasks, and automated cleanup processes.


cleanup/autodeploy_timeout

Checks for stalled deployments caused by autodeploy timeouts and returns the list of processed items.

HTTP method: POST|GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: autodeploy_timeout
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST|GET \
--data "action=autodeploy_timeout"
Success response example
{
"result": "OK",
"data": [
{
"id": 123,
"status": "stalled",
"server_id": 456,
"reason": "timeout"
}
]
}
Error examples
{
"code": -1,
"message": "Cleanup API rq: action= autodeploy_timeout from IP: 127.0.0.1"
}

cleanup/check_email

Sends a test email from the system's debug address to verify that the SMTP connection is working correctly.

HTTP method: POST|GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: check_email
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST|GET \
--data "action=check_email"
Success response example
{
"result": "OK",
"action": "check_email",
"data": {
"status": "sent",
"message": "this is test message body"
}
}
Error examples
{
"code": -1,
"message": "cleanup/check_email: SMTP connection failed"
}

cleanup/check_vm

Checks the status of virtual machines based on specified filters like count, skip, and status.

HTTP method: GET|POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: check_vm
count ❌ integer Number of VMs to process.
skip ❌ integer Number of records to skip for pagination.
status ❌ string Filter VMs by their current status.

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X GET|POST \
--data "action=check_vm"
Success response example
{
"result": "OK",
"message": "check_vm: done for 10 servers"
}
Error examples
{
"code": -1,
"message": "cleanup/check_vm: error message"
}

cleanup/cleanup_auth_attempts

Cleans up failed authentication attempts to prevent brute-force attacks.

HTTP method: POST|GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: cleanup_auth_attempts
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST \
--data "action=cleanup_auth_attempts"
Success response example
{
"result": "OK",
"unknown": 1
}
Error examples
{
"code": -1,
"message": "Error description"
}

cleanup/cleanup_db

This endpoint is a no-op as cleanup is handled by the background scheduler.

HTTP method: POST|GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: cleanup_db
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST|GET \
--data "action=cleanup_db"
Success response example
{
"result": "OK",
"message": "cleanup_db is handled by scheduler, this endpoint is a no-op"
}
Error examples
{
"code": -1,
"message": "Error description"
}

cleanup/cleanup_ipmi

Performs maintenance on IPMI IP addresses, cleans up NAT rules, NoVNC sessions, ISO mounts, and unblocks expired IP blocks.

HTTP method: POST|GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: cleanup_ipmi
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST|GET \
--data "action=cleanup_ipmi"
Success response example
{
"result": "OK",
"message": "cleanup_ipmi: cleared NAT for <details>"
}
Error examples
{
"code": -1,
"message": "Error description"
}

cleanup/cleanup_iso

Cleans up outdated ISO mounts based on the specified number of days.

HTTP method: GET|POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: cleanup_iso
days ❌ integer Number of days to keep ISO mounts. Must be a positive integer.

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X GET|POST \
--data "action=cleanup_iso"
Success response example
{
"result": "OK",
"statistic": 15
}
Error examples
{
"code": -1,
"message": "cleanup/cleanup_iso: days must be a positive integer"
}

cleanup/cleanup_old_ip_ranges

Cleans up old IPv4 IP ranges that have been moved to old ranges and are older than 30 days.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: cleanup_old_ip_ranges
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST \
--data "action=cleanup_old_ip_ranges"
Success response example
{
"result": "OK",
"summary": [
"15 unused tags cleared",
"eq height updated",
"servers data cleaned",
"unused RR cleaned",
"Old deploy tags cleared"
]
}
Error examples
{
"code": -1,
"message": "cleanup/cleanup_old_ip_ranges: Error message description"
}

cleanup/cleanup_s3_journal

Clears the S3 journal history nodes.

HTTP method: POST|GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: cleanup_s3_journal
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST \
--data "action=cleanup_s3_journal"
Success response example
{
"result": "OK",
"msg": "Journal S3 history cleared"
}
Error examples
{
"code": -1,
"message": "cleanup/cleanup_s3_journal: Error message"
}

cleanup/cleanup_servers

Performs comprehensive maintenance on server data, including clearing unused tags, updating EQ height, cleaning RR records, and purging stalled TT servers.

HTTP method: GET|POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: cleanup_servers
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X GET|POST \
--data "action=cleanup_servers"
Success response example
{
"result": "OK",
"summary": [
"0 unused tags cleared",
"eq height updated",
"servers data cleaned",
"unused RR cleaned",
"stalled TT servers cleared: 0",
"Old deploy tags cleared"
]
}
Error examples
{
"code": -1,
"message": "cleanup/cleanup_servers: Error message"
}

cleanup/cleanup_traffic

Performs maintenance on traffic data by updating periods and cleaning up shaped traffic.

HTTP method: POST|GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: cleanup_traffic
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST \
--data "action=cleanup_traffic"
Success response example
{
"result": "OK",
"summary": {
"update_traffic_periods": null,
"cleanup_shape_traffic": null
}
}
Error examples
{
"code": -1,
"message": "cleanup/cleanup_traffic: Error message description"
}

cleanup/cleanup_upgrade_invoices

Searches for old upgrade invoices and cancels them. Returns a summary of processed invoices.

HTTP method: POST|GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: cleanup_upgrade_invoices
age ❌ integer Maximum allowed invoice age in days.

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST|GET \
--data "action=cleanup_upgrade_invoices"
Success response example
{
"result": "OK",
"summary": [
{
"component_id": 123,
"status": "cancelled"
},
{
"component_id": 456,
"status": "error: invoice already paid"
}
]
}
Error examples
{
"code": -1,
"message": "cleanup/cleanup_upgrade_invoices: Error description"
}

cleanup/get_currency_rates

Returns the current exchange rates for EUR costs.

HTTP method: GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: get_currency_rates
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X GET \
--data "action=get_currency_rates"
Success response example
{
"result": "OK",
"rate": 85.42
}
Error examples
{
"code": -1,
"message": "Error description"
}

cleanup/reload_traffic_data

Reloads traffic data and updates counters for a specific entity.

HTTP method: POST|GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: reload_traffic_data
id ✅ integer The ID of the entity for which traffic data should be reloaded.

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST|GET \
--data "action=reload_traffic_data" \
--data "id=VALUE"
Success response example
{
"result": "OK"
}
Error examples
{
"code": -1,
"message": "No id provided"
}

cleanup/sync_billing_status

Synchronizes component billing statuses by checking components that have upcoming due dates and matching them with WHMCS data.

HTTP method: GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: sync_billing_status
billing ❌ string Specific billing type to filter by. If empty, all non-hand types are processed.

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X GET \
--data "action=sync_billing_status"
Success response example
{
"result": "OK",
"action": "sync_billing_status",
"data": [
"Component1 123 Condition_Component in invapi, bill status is active",
"Component1 456 Condition_Component in invapi, error: Service not found"
],
"items": [
{
"id": 1,
"name": "example"
}
]
}
Error examples
{
"code": -1,
"message": "cleanup/sync_billing_status: action required"
}

cleanup/update_billing_currency_rates

Updates WHMCS currency rates for a specific location or all locations if none is provided.

HTTP method: POST|GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: update_billing_currency_rates
location ❌ string Billing location to update. If empty, all locations are updated.

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST|GET \
--data "action=update_billing_currency_rates" \
--data "location=US-EAST"
Success response example
{
"result": "OK",
"message": "{\"active\": \"true\", \"code\": \"USD\", \"error\": null, \"identifier\": \"US-EAST\", \"result\": 1, \"sec\": \"secret_key\", \"url\": \"https://whmcs.example.com\"}"
}
Error examples
{
"code": -1,
"message": "Failed to update currency rates. No active billings found or update failed due to error."
}

cleanup/update_components

Triggers the update of component locations in the system and returns the execution time.

HTTP method: POST|GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: update_components
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST|GET \
--data "action=update_components"
Success response example
{
"result": "OK",
"message": "update_components: done $i components in $done sec"
}
Error examples
{
"code": -1,
"message": "cleanup/update_components: Error description"
}

cleanup/update_currency_rates

Updates EUR costs based on current exchange rates and cleans up server tags.

HTTP method: GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: update_currency_rates
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X GET \
--data "action=update_currency_rates"
Success response example
{
"result": "OK",
"message": "EUR costs update with a rate 1.2345",
"tags_cleared": "5 unused tags cleared"
}
Error examples
{
"code": -1,
"message": "Failed to update EUR costs"
}

cleanup/update_hw_config

Triggers an hourly update of hardware configurations for all servers.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: update_hw_config
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST \
--data "action=update_hw_config"
Success response example
{
"result": "OK",
"message": "update_hardware configs: done 125 servers"
}
Error examples
{
"code": -1,
"message": "cleanup/update_hw_config: Error description"
}

cleanup/update_jira_organizations

Synchronizes Jira organizations with the system data.

HTTP method: POST|GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: update_jira_organizations
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST|GET \
--data "action=update_jira_organizations"
Success response example
{
"result": "OK",
"organizations": [
{
"id": 1,
"name": "Example Org",
"external_id": "JIRA-123"
}
]
}
Error examples
{
"code": -1,
"message": "Failed to update organizations: error message from provider"
}

cleanup/update_rates

Updates pricing/costs for servers based on specific stages or a single server ID. Supports dry run and quiet modes.

HTTP method: GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: update_rates
server_id ❌ integer Specific server ID to check/update price for.
stage ❌ integer The stage of update process. 1: Sale servers, 2: NL rent, 3: US rent, 4: RU rent, 5: FI rent, 6: DE rent, 7: All infra, 8: IS rent, 9: TR rent, 10: UK rent, 11: FR rent, 12: ES rent, 13: IT rent, 14: PL rent.
dry_run ❌ boolean If set to 1, performs a dry run without actual updates.
quiet ❌ integer Quiet mode flag. Default is 1.
batch ❌ integer Batch size for processing (overrides default if > 0).

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X GET \
--data "action=update_rates"
Success response example
{
"result": "OK",
"summary": {}
}
Error examples
{
"code": -1,
"message": "Cleanup error description"
}

cleanup/update_traffic_rates

Performs actualization of cost_trafficIN and cost_traffic for active servers based on specified filters.

HTTP method: POST|GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: update_traffic_rates
dry_run ❌ boolean If present, the operation is performed in dry-run mode (testing only).
location ❌ string Location filter for traffic rate updates.
limit ❌ integer Maximum number of records to process in this batch.
offset ❌ integer Offset for pagination in the update process.

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST|GET \
--data "action=update_traffic_rates"
Success response example
{
"result": "OK",
"summary": [
"update_traffic_periods: 120",
"cleanup_shape_traffic: completed",
"stalled TT servers cleared: 5"
]
}
Error examples
{
"code": -1,
"message": "Cleanup module/update_traffic_rates: Error message description"
}

cleanup/yookassa_check_pending_refunds

Triggers a Jenkins job to check for pending refunds in the Yookassa payment system.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: yookassa_check_pending_refunds
- - - No other parameter

Request example

curl -s "https://invapi.hostkey.com/cleanup.php" -X POST \
--data "action=yookassa_check_pending_refunds"
Success response example
{
"result": "OK",
"action": "yookassa_check_pending_refunds",
"data": {
"status": "success",
"message": "Job dispatched to Jenkins"
}
}
Error examples
{
"code": -1,
"message": "cleanup/check_yookassa_refund: Error description"
}
question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×