REST API – WEDOS.protection Services

WEDOS REST API is still in development. Access and features may change without notice.

This article partially covers the WEDOS.protection endpoint of WEDOS REST API. WEDOS.protection domains and members have their own articles. For WEDOS API (WAPI) see WAPI – WEDOS Protection.

For basic information anbout WEDOS REST API, consult the WEDOS REST API Manual.

In this article, you will find the following information:


WGP Endpoint Access

The WGP HTTP REST API v2 is used to manage domains, services and co-management invitations in WEDOS.protection (WGP).

Base URL and Authentication

The base URL for the WGP endpoints is: https://api.wedos.com/v2

Authentication uses only OAuth2: include a valid access token in the request header (Authorization: Bearer <TOKEN>) with the wgp scope. Without a valid token the API returns error 2000.

You can add the parameter example=1 to any endpoint as a GET parameter (?example=1 for endpoints without their own GET parameters, otherwise &example=1). The API then returns a sample curl command for that call without requiring real parameters. Valid authentication is required even in this mode.

Endpoint Overview

MethodEndpointDescription
GET/servicesList of your standalone WGP services
POST/services/{service_id}/cache/purgePurge the CDN cache
POST/services/{service_id}/renewRenew a service
POST/services/{service_id}/template-replicateReplicate settings from a template domain
PATCH/services/{service_id}Change the service’s subscription variant/period
DELETE/services/{service_id}Delete/terminate a service

Response format

The API response is always a JSON object with the keys code (return code), msg (text description), request_id (request identifier) and, where applicable, data (returned data on success).

General return codes valid for all endpoints (REST layer, independent of the specific operation):

  • 1000 – success (OK)
  • 2000 – authentication (OAuth2 Bearer token) missing or invalid
  • 2004 – maximum request size exceeded (URL or request body)
  • 4000 – unknown/unsupported API method (the called combination of HTTP method and path does not exist)
  • 4001 – input validation failed
  • 4005 – no example available for the current endpoint in example=1 mode
  • 6000 – internal error initializing the underlying WAPI command

In addition, each endpoint returns its own business codes specific to the operation (corresponding to the underlying WAPI command). These are listed under Return codes for each endpoint.


GET /services

Returns a list of the logged-in OAuth2 user’s own standalone WEDOS Global Protection services (created directly as a WGP service, table hosting_wedos_protection).

Parameters:

  • status – optional, query – filter by a specific service status (the value is not validated against the status code list)

Return codes:

  • 1000 – OK

Response data: An array of services; each item contains ID, name, status, expiration.

Example:

curl -X GET -H 'Authorization: Bearer <TOKEN>' \
  'https://api.wedos.com/v2/wgp/services?status=active'
{
  "code": 1000,
  "msg": "OK",
  "request_id": "a1b2c3d4",
  "data": [
    {
      "ID": 435,
      "name": "domain1.tld",
      "status": "active",
      "expiration": "2027-10-01 00:00:00"
    }
  ]
}

POST /services/{service_id}/cache/purge

Purges the CDN cache for a domain connected to WGP. It can target either a standalone WGP service or a domain with WGP as an add-on (hosting_domain); the service type is set with the service_type parameter.

Parameters:

  • service_id – required, path – local service ID
  • service_type – optional – service type, hosting_wedos_protection (default) or hosting_domain
  • limiter_decay – optional, number – time in seconds during which repeated purging is limited; default 5
  • limiter_reset – optional, bool – cancel the current limit; default false

Return codes:

  • 1000 – OK
  • 2100 – required parameter missing
  • 2101 – invalid parameter value
  • 2406 – domain/service not found
  • 2415 – the limiter is still running – purging cannot be repeated right now
  • 3223 – the service belongs to another customer account
  • 2400 – internal error – unregistered return code

Response data:

  • domain – domain name
  • domain_id – domain ID in WGP
  • domain_tld – domain TLD
  • service_id – service ID
  • wedos_client_id – client ID in WGP
  • limiter_available_in – in how many seconds the function can be used again (documented only for error 2415; however, the current implementation does not return the data part on error, see Notes)

Example:

curl -X POST -H 'Authorization: Bearer <TOKEN>' -H 'Content-Type: application/json' \
  'https://api.wedos.com/v2/wgp/services/435/cache/purge' \
  --data '{"limiter_decay":5,"limiter_reset":0}'
{
  "code": 1000,
  "msg": "OK",
  "request_id": "a1b2c3d4",
  "data": {
    "domain": "domain1.tld",
    "domain_id": 98765,
    "domain_tld": "tld",
    "service_id": 435,
    "wedos_client_id": 10234
  }
}

POST /services/{service_id}/renew

Renews the WGP service for another billing period.

Parameters:

  • service_id – required, path – service ID

Return codes:

  • 1000 – OK
  • 2100 – required parameter missing
  • 2101 – invalid parameter value
  • 2152 – renewal is not allowed in the service’s current state
  • 2279 – the prepaid account is locked
  • 2281 – the prepaid account is not active
  • 2282 – cannot pay from the prepaid account in the given currency
  • 2283 – insufficient prepaid account balance
  • 2284 – error in the prepaid account’s contact details
  • 2293 – cannot get the prepaid account credit balance
  • 2297 – cannot determine whether the prepaid account includes VAT
  • 2406 – service not found
  • 2409 – service renewal failed

Response data:

  • service_id – service ID
  • name – domain name
  • date_from, date_to – validity dates of the new period
  • fakt_order_num – renewal order number
  • currency – prepaid account currency
  • price – renewal amount
  • credit – prepaid account balance afterwards (null for FREE/TRIAL services)

Example:

curl -X POST -H 'Authorization: Bearer <TOKEN>' \
  'https://api.wedos.com/v2/wgp/services/435/renew'
{
  "code": 1000,
  "msg": "OK",
  "request_id": "a1b2c3d4",
  "data": {
    "service_id": 435,
    "name": "domain1.tld",
    "date_from": "2027-10-01",
    "date_to": "2028-10-01",
    "fakt_order_num": "2026123457",
    "currency": "CZK",
    "price": 499,
    "credit": 502
  }
}

POST /services/{service_id}/template-replicate

Replicates (applies) the settings of a template domain to an existing WGP domain/service.

Parameters:

  • service_id – required, path – ID of the service the settings are replicated to
  • template_domain_id – required – template domain ID (see GET /domains/templates)
  • service_type – optional – service type, hosting_wedos_protection (default) or hosting_domain

Return codes:

  • 1000 – OK
  • 2100 – required parameter missing
  • 2101 – invalid parameter value
  • 2401 – invalid domain for replication
  • 2402 – invalid template domain
  • 2403 – user mismatch between the domain and the template domain
  • 2404 – subscription plan mismatch between the domain and the template domain
  • 2405 – daily replication limit reached
  • 2406 – domain/service not found
  • 2407 – template domain not found
  • 2400 – internal error – unregistered return code

Response data:

  • domain – domain name
  • domain_id – domain ID
  • service_id – service ID
  • service_type – service type
  • template_domain_id – ID of the template domain used
  • replications_count – number of replications performed so far
  • replications_limit – maximum number of replications allowed

Example:

curl -X POST -H 'Authorization: Bearer <TOKEN>' -H 'Content-Type: application/json' \
  'https://api.wedos.com/v2/wgp/services/435/template-replicate' \
  --data '{"template_domain_id":123}'
{
  "code": 1000,
  "msg": "OK",
  "request_id": "a1b2c3d4",
  "data": {
    "domain": "domain1.tld",
    "domain_id": 98765,
    "service_id": 435,
    "service_type": "hosting_wedos_protection",
    "template_domain_id": 123,
    "replications_count": 2,
    "replications_limit": 5
  }
}

PATCH /services/{service_id}

Changes the variant and/or subscription period of an existing WGP service.

Parameters:

  • service_id – required, path – service ID
  • new_variant_id – optional, number – new service variant
  • new_period_id – optional, number – new subscription period

At least one of new_variant_id/new_period_id must be given.

Return codes:

  • 1000 – OK
  • 2100 – required parameter missing
  • 2101 – invalid parameter value
  • 2203 – invalid value of new_period_id
  • 2273 – invalid value of new_variant_id
  • 2279 – the prepaid account is locked
  • 2281 – the prepaid account is not active
  • 2282 – cannot pay from the prepaid account in the given currency
  • 2283 – insufficient prepaid account balance
  • 2284 – error in the prepaid account’s contact details
  • 2293 – cannot get the prepaid account credit balance
  • 2294 – cannot get the service price
  • 2406 – domain/service not found
  • 2408 – parameter new_variant_id or new_period_id missing (neither was given)
  • 2400 – internal error – unregistered return code

Response data:

  • domain – domain name
  • domain_id – domain ID
  • wedos_client_id – client ID in WGP
  • service_id – service ID
  • service_type – service type
  • variant_id – current service variant ID after the change
  • period_id – current subscription period ID after the change
  • dirty – flag showing whether a change actually happened (0 = unchanged, 1 = changed)

Example:

curl -X PATCH -H 'Authorization: Bearer <TOKEN>' -H 'Content-Type: application/json' \
  'https://api.wedos.com/v2/wgp/services/435' \
  --data '{"new_variant_id":2,"new_period_id":1}'
{
  "code": 1000,
  "msg": "OK",
  "request_id": "a1b2c3d4",
  "data": {
    "domain": "domain1.tld",
    "domain_id": 98765,
    "wedos_client_id": 10234,
    "service_id": 435,
    "service_type": "hosting_wedos_protection",
    "variant_id": 2,
    "period_id": 1,
    "dirty": 1
  }
}

DELETE /services/{service_id}

Deletes/terminates a WGP service at the customer’s request.

Parameters:

  • service_id – required, path – service ID
  • force – optional, query, 0/1 – forces deletion even when WGP has no token available for rewriting DNS (restoring A/AAAA records to their original values)

Return codes:

  • 1000 – OK
  • 2100 – required parameter missing
  • 2292 – the domain was not found in WGP for this customer account
  • 2400 – internal error
  • 2410 – service not found
  • 2411 – no token available for rewriting DNS
  • 2412 – the API request for rewriting DNS failed
  • 2413 – the command cannot be executed, WGP lacks permission to manipulate the domain’s DNS (force=1 required)
  • 2414 – no token exists for WGP and the force parameter was not given
  • 3223 – the service belongs to another customer account

Response data:

  • domain – domain name
  • domain_id – domain ID
  • wedos_client_id – client ID in WGP
  • service_id – service ID
  • service_type – service type
  • wdns_data – array of DNS record changes made (IP addresses that stop resolving via WGP after it is cancelled)

Example:

curl -X DELETE -H 'Authorization: Bearer <TOKEN>' \
  'https://api.wedos.com/v2/wgp/services/435?force=1'
{
  "code": 1000,
  "msg": "OK",
  "request_id": "a1b2c3d4",
  "data": {
    "domain": "domain1.tld",
    "domain_id": 98765,
    "wedos_client_id": 10234,
    "service_id": 435,
    "service_type": "hosting_wedos_protection",
    "wdns_data": []
  }
}

Notes

  • GET /services returns only standalone WGP services. Domains that have WGP connected as an add-on to another service are not in this list, and no similar list endpoint exists for them.
  • POST /services/{service_id}/cache/purge and POST /services/{service_id}/template-replicate are addressed directly by service_id (not by domain) and support the service_type parameter to distinguish between a standalone WGP service and a domain with WGP as an add-on. The corresponding WAPI command looks up ownership by user_id itself.
  • For POST /services/{service_id}/cache/purge, the documentation comment of cmd_purge_cache() also mentions the limiter_available_in field in the response data for error 2415, but the current implementation returns only the bare error code without a data part in this case – so the field does not actually appear in the response.

Was this helpful?

Thanks for your feedback!
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors