API renewal charges the token owner’s account balance for the selected period. Renew the root site: its subdomains share that service and cannot be renewed separately.
Check before paying
Test the token, then retrieve the intended site. Use curl.exe on Windows or curl on Linux:
curl.exe -H "X-API-TOKEN: wsk_REPLACE_ME" https://webshield.ru/api/v1/sites/42
Replace the token and 42. Verify the domain, paid_until, and parent_id. When parent_id is not null, use the root site’s ID. Record the existing paid-through date and check available balance with GET /api/v1/me.
Submit a renewal
Save this JSON as renew.json:
{"days":30}
days must be a positive integer. Omitting it selects the plan’s minimum period. null, fractional numbers, and Boolean values are rejected. Applicable period discounts follow the service’s payment rules.
curl.exe -i -X POST https://webshield.ru/api/v1/sites/42/renew -H "X-API-TOKEN: wsk_REPLACE_ME" -H "Content-Type: application/json" --data-binary "@renew.json"
Send the request once. For ok: true, inspect data.site.paid_until, then confirm the new date with GET. Test website availability separately; renewal does not fix DNS or application errors.
Handle errors
401 unauthorized: check the token and header.404 not_found: verify the site ID and token’s account.422 invalid_daysor400 invalid_json: correct the period or JSON.402 insufficient_funds: inspectbalanceandcost, then replenish the balance before another attempt.409 subdomain_not_payable: renew the root site.409 service_missingorpayment_failed: review the details and contact support if unclear.
Use error.code rather than parsing message text. A timeout does not prove that payment failed. Check the paid-through date and balance before repeating POST. Idempotency-Key is unsupported. A renewal request does not configure the service’s auto-payment switch; panel auto payment is managed separately.