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 services 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:
- DNS Endpoint access
- DNS Endpoint details:
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
| Method | Endpoint | Description |
|---|---|---|
| GET | /domains/{domain} | Detail of one domain in WGP |
| GET | /domains/templates | List of template domains for a given service variant |
| POST | /domains/create | Set up a new domain in WGP |
| POST | /domains/info | Detail of one or more domains in WGP |
| POST | /domains/{domain}/create/retry | Retry domain setup after an error |
| POST | /domains/{domain}/delete-order | Delete an unfinished domain order |
| GET | /domains/{domain}/origin-ips | Target (origin) IP addresses of a domain |
| PUT | /domains/{domain}/origin-ips/update | Set the target (origin) IP addresses of a domain |
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 invalid2004– 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 failed4005– no example available for the current endpoint inexample=1mode6000– 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 /domains/{domain}
Returns information about one domain connected to WGP – a combination of data from the external WEDOS Global Protection administration and the internal WEDOS database.
Parameters:
domain– required, path – domain name
Return codes:
1000– OK2100– required parameter missing2101– invalid parameter format2202– invalid or unsupported domain name format2292– the domain does not exist in WGP for this customer account2400– internal error – unregistered return code from the WGP API (see Notes)2418– TXT record missing for a domain in thePending_TXTstate
Response data:
wgp– domain data from the external WGP administration (e.g. domain state, admin account flag and more; the itemswedos_client_idandcmsare removed from the response)service– domain data from the internal database:ID,name,num,user_id,lang,currency, billing (cli_*) and owner (own_*) contact details,status,expiration
Example:
curl -X GET -H 'Authorization: Bearer <TOKEN>' \
'https://api.wedos.com/v2/wgp/domains/domain1.tld'
{
"code": 1000,
"msg": "OK",
"request_id": "a1b2c3d4",
"data": {
"wgp": {
"domain": "domain1.tld",
"state": "active",
"user_admin": false
},
"service": {
"ID": 435,
"name": "domain1.tld",
"num": "2026123456",
"user_id": 10234,
"lang": "cs",
"currency": "CZK",
"status": "active",
"expiration": "2027-10-01 00:00:00"
}
}
}
GET /domains/templates
Returns a paged list of template domains available for the given WGP service variant. Use it as the source of template_domain_id when setting up a domain or replicating settings.
Parameters:
variant_id– required, query – WGP service variant ID (see thehosting_wedos_protection.variantscode list)per_page– optional, query – records per page; default 15, value-1returns all recordspage– optional, query – page number; default 1locale– optional, query – paging language, allowed valuescs,en; defaultensearch– optional, query – search string in the columnscustom_name,name
Return codes:
1000– OK2100– required parameter missing (variant_id)2400– internal error – unregistered return code
Response data:
data– array of template domains; each item containsid,custom_name,name,urlper_page,total,last_page,from,to– paging detailsfirst_page_url,prev_page_url,next_page_url,last_page_url,path– links to individual pageslinks– array of paging elements (url,label,active)
Example:
curl -X GET -H 'Authorization: Bearer <TOKEN>' \
'https://api.wedos.com/v2/wgp/domains/templates?variant_id=1'
{
"code": 1000,
"msg": "OK",
"request_id": "a1b2c3d4",
"data": {
"data": [
{
"id": 123,
"custom_name": "Sample e-shop",
"name": "template-eshop.wedos.com",
"url": "https://template-eshop.wedos.com"
}
],
"per_page": 15,
"total": 1,
"last_page": 1,
"from": 1,
"to": 1,
"path": "https://api.wedos.com/v2/wgp/domains/templates",
"first_page_url": "https://api.wedos.com/v2/wgp/domains/templates?page=1",
"prev_page_url": null,
"next_page_url": null,
"last_page_url": "https://api.wedos.com/v2/wgp/domains/templates?page=1",
"links": [
{"url": null, "label": "« Previous", "active": false},
{"url": "https://api.wedos.com/v2/wgp/domains/templates?page=1", "label": "1", "active": true},
{"url": null, "label": "Next »", "active": false}
]
}
}
POST /domains/info
Returns information about one or more domains in WGP (equivalent to GET /domains/{domain}, but you can give several comma-separated domains in the request body).
Parameters:
domain– required – domain name, or several names separated by commas (e.g."domain1.tld,domain2.tld")
Return codes:
1000– OK2100– required parameter missing2101– invalid parameter format2202– invalid or unsupported domain name format2292– the domain does not exist in WGP for this customer account2400– internal error – unregistered return code from the WGP API2418– TXT record missing for a domain in thePending_TXTstate
Response data: For one domain, the same structure as GET /domains/{domain} (keys wgp and service). For several domains, the response is an object keyed by domain name, where each item again has the wgp and service structure.
Example:
curl -X POST -H 'Authorization: Bearer <TOKEN>' -H 'Content-Type: application/json' \
'https://api.wedos.com/v2/wgp/domains/info' \
--data '{"domain":"domain1.tld,domain2.tld"}'
{
"code": 1000,
"msg": "OK",
"request_id": "a1b2c3d4",
"data": {
"domain1.tld": {
"wgp": {"domain": "domain1.tld", "state": "active", "user_admin": false},
"service": {"ID": 435, "name": "domain1.tld", "status": "active", "expiration": "2027-10-01 00:00:00"}
},
"domain2.tld": {
"wgp": {"domain": "domain2.tld", "state": "active", "user_admin": false},
"service": {"ID": 436, "name": "domain1.tld", "status": "active", "expiration": "2027-03-15 00:00:00"}
}
}
}
POST /domains/create
Sets up a new domain in WGP. It can also be used to restore a domain that was suspended (state disabled) because its setup was not completed in time after creation.
Parameters:
domain– required – domain namevariant_id– required, number – service variant ID (see thehosting_wedos_protection.variantscode list)period_id– required, number – subscription period IDupstream_ips– optional, array – array of IP addresses that will not be resolved to WGPtemplate_domain_id– optional, number – ID of the template domain used to configure the new domainmode– optional, string – domain mode, allowed valuesnsorcname
Return codes:
1000– OK (restoration of a previously suspended domain from thedisabledstate)1001– request accepted, domain setup is being processed2101– invalid parameter value2202– invalid or unsupported domain name format2203– invalid value ofperiod_id2272– invalid IP address format (upstream_ips)2273– invalid value ofvariant_id2276– unsupported TLD2277– an explicitwww.in the domain name is not allowed2278– a service for this domain already exists2279– the prepaid account is locked2281– the prepaid account is not active2282– cannot pay from the prepaid account in the given currency2283– insufficient prepaid account balance2284– error in the prepaid account’s contact details2285– incorrect billing setting with/without VAT2291– the domain already exists in WGP for this customer account2293– cannot get the prepaid account credit balance2294– cannot get the service price2416– invalid domain mode (mode)2417– invalid or unsupported subdomain name format2422– cannot determine the account type (admin/customer)2423– internal error calling the WGP API- other error codes specific to the operation (e.g. template domain replication validation
2401–2405)
Response data:
WGP_ID– domain ID in WGPdomain– domain nameorder_num– order number (unless the domain is set up free of charge or by an admin account; also on restoration from thedisabledstate)currency,amount– currency and amount deducted from the prepaid accountacc_amount_before,acc_amount_current– prepaid account balance before and after paymentdesc– description (present only when restoring a domain from thedisabledstate)
Example:
curl -X POST -H 'Authorization: Bearer <TOKEN>' -H 'Content-Type: application/json' \
'https://api.wedos.com/v2/wgp/domains/create' \
--data '{"domain":"domain1.tld","variant_id":1,"period_id":1,"mode":"ns"}'
{
"code": 1001,
"msg": "Request pending",
"request_id": "a1b2c3d4",
"data": {
"WGP_ID": 98765,
"domain": "domain1.tld",
"order_num": "2026123456",
"currency": "CZK",
"amount": -499,
"acc_amount_before": 1500,
"acc_amount_current": 1001
}
}
POST /domains/{domain}/create/retry
Retries a domain setup that ended with an error (available only for certain domain states, e.g. error_crt).
Parameters:
domain– required, path – domain name
Return codes:
1000– OK2100– required parameter missing2292– the domain does not exist in WGP for this customer account2400– internal error – unregistered return code
Response data:
domain– domain namedomain_id– domain ID in WGPwedos_client_id– client ID in WGP
Example:
curl -X POST -H 'Authorization: Bearer <TOKEN>' \
'https://api.wedos.com/v2/wgp/domains/domain1.tld/create/retry'
{
"code": 1000,
"msg": "OK",
"request_id": "a1b2c3d4",
"data": {
"domain": "domain1.tld",
"domain_id": 98765,
"wedos_client_id": 10234
}
}
POST /domains/{domain}/delete-order
Deletes an unfinished domain order – the state where the domain is stuck in WGP with no way to complete activation and the local service does not exist yet.
Parameters:
domain– required, path – domain name
Return codes:
1000– OK2100– required parameter missing2292– the domain was not found in WGP for this customer account2400– internal error2410– service not found2421– the WGP service already exists, the domain will not be removed
Response data:
domain– domain namedomain_id– domain ID in WGPwedos_client_id– client ID in WGP
Example:
curl -X POST -H 'Authorization: Bearer <TOKEN>' \
'https://api.wedos.com/v2/wgp/domains/domain1.tld/delete-order'
{
"code": 1000,
"msg": "OK",
"request_id": "a1b2c3d4",
"data": {
"domain": "domain1.tld",
"domain_id": 98765,
"wedos_client_id": 10234
}
}
GET /domains/{domain}/origin-ips
Returns the target (origin) IP addresses of a domain protected by WGP. The domain is searched only in the client’s customer account, in any state.
Read-only client: allowed. Dry run: not applicable (GET).
Parameters:
domain– required, path – domain name
Return codes:
1000(HTTP 200) – OK2100(HTTP 400) – required parameter missing2101(HTTP 400) – invalid parameter format2202(HTTP 400) – invalid or unsupported domain name format2276(HTTP 400) – unsupported TLD, or the maximum domain level was exceeded2277(HTTP 400) – thewww.prefix in the domain name is not allowed2292(HTTP 404) – the domain does not exist in this customer account2417(HTTP 400) – invalid subdomain name format2400,4000(HTTP 500) – internal error
Response data:
domain– domain namedomain_id– domain ID in WGPdomain_tld– domain TLDwedos_client_id– customer account IDstate– domain state in WGPipv4– array of target IPv4 addressesipv6– array of target IPv6 addresses
Example:
curl -X GET -H 'Authorization: Bearer <TOKEN>' \
'https://api.wedos.com/v2/wgp/domains/example.com/origin-ips'
PUT /domains/{domain}/origin-ips/update
Sets the target (origin) IP addresses of a domain. The addresses you send replace all current addresses. An empty array deletes all addresses.
You read the addresses with origin-ips and set them with origin-ips/update.
Read-only client: not allowed (2012). Dry run: supported – checks the input and whether the domain exists in your account.
Parameters:
domain– required, path – domain nameupstream_ips– required, array – IP addresses (IPv4 and IPv6); an empty array[]deletes all target addresses
Rules for addresses:
- Only individual public IP addresses, no ranges or CIDR.
- Private, loopback and other non-public addresses are rejected with code
2432. - IPv6 only global unicast (
2000::/3), outside the documentation range2001:db8::/32. - Addresses are converted to their canonical form and duplicates are skipped.
Return codes:
1000(HTTP 200) – OK2100(HTTP 400) – required parameter missing (e.g.upstream_ipsnot given)2101(HTTP 400) – invalid parameter format (e.g.upstream_ipsis not an array)2202(HTTP 400) – invalid or unsupported domain name format2272(HTTP 400) – invalid IP address format2276(HTTP 400) – unsupported TLD, or the maximum domain level was exceeded2277(HTTP 400) – thewww.prefix in the domain name is not allowed2292(HTTP 404) – the domain does not exist in this customer account2417(HTTP 400) – invalid subdomain name format2432(HTTP 400) – the IP address is not public2400,4000(HTTP 500) – internal error
Response data:
domain– domain nameupstream_ips– array of the addresses that were set
Example:
curl -X PUT -H 'Authorization: Bearer <TOKEN>' -H 'Content-Type: application/json' \
--data '{"upstream_ips":["46.28.106.212","2a02:2b88:1:4::10e"]}' \
'https://api.wedos.com/v2/wgp/domains/example.com/origin-ips/update'