Knowledge Base›WEDOS REST API›WEDOS.protection Services

REST API – WEDOS.protection Services

On this pageWGP Endpoint AccessGET /servicesPOST /services/{service_id}/cache/purgePOST /services/{service_id}/renewPOST /services/{service_id}/template-replicatePATCH /services/{service_id}DELETE /services/{service_id}POST /services/{service_id}/custom-certDELETE /services/{service_id}/custom-certPOST /services/{service_id}/cert-typeNotes

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
POST/services/{service_id}/custom-certUpload a custom SSL certificate
DELETE/services/{service_id}/custom-certDelete the custom SSL certificate
POST/services/{service_id}/cert-typeSwitch between the custom certificate and Let’s Encrypt

The target (origin) IP addresses of a protected domain are managed by endpoints in the REST API – WEDOS.protection Domains article: GET /domains/{domain}/origin-ips shows them and PUT /domains/{domain}/origin-ips/update sets them.

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": []
  }
}

POST /services/{service_id}/custom-cert

Uploads a custom SSL certificate to the service.

  • A domain has at most one custom certificate. A new upload replaces it.
  • The certificate reaches the edge servers within a few minutes.
  • When the custom certificate expires, the domain automatically uses Let’s Encrypt (cert_in_use = letsencrypt, cert_type stays custom).

Read-only client: not allowed. Dry run: supported – checks the PEM format, that the key matches the certificate, and validity. It does not check whether the certificate is issued for the service’s domain (2430). Maximum body size: 64 KB.

Parameters:

  • service_id – required, path – service ID
  • crt – required – certificate in PEM format; it can also contain intermediate certificates
  • private_key – required – private key in PEM format
  • ca – optional – CA certificate chain in PEM format
  • passphrase – optional – password for an encrypted private key
  • activate – optional – true (default) = the domain starts using the custom certificate right away; false = the domain stays on Let’s Encrypt until you switch the type with cert-type
  • service_type – optional – service type, hosting_wedos_protection (default) or hosting_domain

The private_key and passphrase values are stored masked in the request log.

Return codes:

  • 1000 (HTTP 200) – OK
  • 2100 (HTTP 400) – required parameter missing
  • 2101 (HTTP 400) – invalid parameter format
  • 2406 (HTTP 404) – domain/service not found
  • 2425 (HTTP 400) – invalid certificate
  • 2426 (HTTP 400) – invalid private key or wrong key password
  • 2427 (HTTP 400) – the private key does not belong to the certificate
  • 2428 (HTTP 400) – invalid CA certificate chain
  • 2429 (HTTP 400) – the certificate has already expired
  • 2430 (HTTP 400) – the certificate is not issued for the service’s domain
  • 3223 (HTTP 403) – the service belongs to another customer account
  • 2004 (HTTP 413) – the body is larger than 64 KB
  • 2274, 2400, 4000 (HTTP 500) – internal error

Response data (the same structure is returned by DELETE /services/{service_id}/custom-cert and POST /services/{service_id}/cert-type):

  • domain – domain name
  • domain_id – domain ID in WGP
  • service_id – service ID
  • service_type – service type
  • cert_type – selected certificate type (custom / letsencrypt)
  • cert_in_use – certificate the domain actually uses (custom / letsencrypt)
  • custom_cert – custom certificate (names, issuer, valid_from, valid_to – Prague time), or null

Example:

curl -X POST -H 'Authorization: Bearer <TOKEN>' -H 'Content-Type: application/json' \
  --data '{"crt":"-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----\n","private_key":"-----BEGIN PRIVATE KEY-----\nMIGH...\n-----END PRIVATE KEY-----\n","activate":true}' \
  'https://api.wedos.com/v2/wgp/services/435/custom-cert'

DELETE /services/{service_id}/custom-cert

Deletes the custom certificate. The domain returns to Let’s Encrypt (cert_type = cert_in_use = letsencrypt, custom_cert = null).

Read-only client: not allowed. Dry run: not supported (6002).

Parameters:

  • service_id – required, path – service ID
  • service_type – optional, query – service type, hosting_wedos_protection (default) or hosting_domain

Return codes:

  • 1000 (HTTP 200) – OK
  • 2100 (HTTP 400) – required parameter missing
  • 2101 (HTTP 400) – invalid parameter format
  • 2406 (HTTP 404) – domain/service not found
  • 2431 (HTTP 409) – the domain has no custom certificate
  • 3223 (HTTP 403) – the service belongs to another customer account
  • 2274, 2400, 4000 (HTTP 500) – internal error

Response data: The same as for POST /services/{service_id}/custom-cert.

Only the exact URL DELETE /services/{service_id} deletes the service itself. Any other additional part of the path returns 4000 (Unknown action).

Example:

curl -X DELETE -H 'Authorization: Bearer <TOKEN>' \
  'https://api.wedos.com/v2/wgp/services/435/custom-cert'

POST /services/{service_id}/cert-type

Switches the certificate type between the custom certificate (custom) and Let’s Encrypt (letsencrypt).

  • custom works only with an uploaded custom certificate that has not expired.
  • Selecting the current type again changes nothing and returns 1000.

Read-only client: not allowed. Dry run: not supported (6002).

Parameters:

  • service_id – required, path – service ID
  • cert_type – required – custom or letsencrypt
  • service_type – optional – service type, hosting_wedos_protection (default) or hosting_domain

Return codes:

  • 1000 (HTTP 200) – OK
  • 2100 (HTTP 400) – required parameter missing
  • 2101 (HTTP 400) – invalid parameter format (including an unknown cert_type value)
  • 2406 (HTTP 404) – domain/service not found
  • 2429 (HTTP 400) – the custom certificate has already expired (only for custom)
  • 2431 (HTTP 409) – the domain has no custom certificate (only for custom)
  • 3223 (HTTP 403) – the service belongs to another customer account
  • 2274, 2400, 4000 (HTTP 500) – internal error

Response data: The same as for POST /services/{service_id}/custom-cert.

Example:

curl -X POST -H 'Authorization: Bearer <TOKEN>' -H 'Content-Type: application/json' \
  --data '{"cert_type":"letsencrypt"}' \
  'https://api.wedos.com/v2/wgp/services/435/cert-type'

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 article helpful?

Your feedback helps us improve our articles.

Your message goes to the documentation team, who do not reply to it. If you need help, contact us using the contact form. Do not include passwords or personal data.

Didn’t find what you were looking for?

Send us your question using the contact form.