In this article you will learn:
- How WAPI works and what it is used for
- How to activate WAPI in the Customer Administration
- How communication and authentication work
- How to paginate and search in lists
- Basic commands
- List of return codes
- Glossary
WEDOS API
WEDOS API, or WAPI, is used to control services directly from your information system.
The prerequisite for using the interface is using the WEDOS Credit Account, from which the system deducts payments for registrations, renewals, transfers and other charged fees.
WAPI currently allows management of:
- Credit Account ⧉ (
account-*andcredit-*) - Domains ⧉ (
domains-*anddomain-*) - Domain contacts ⧉ (
contact-*) - NSSET ⧉ (
nsset-*) - DNS ⧉ (
dns-*) - Authorized WEDOS Global users ⧉ (
wg-members-*) - WEDOS Protection ⧉ (
wgp-services-*andwgp-domain-*)
WAPI limits
As protection against abuse, WAPI applies the following limits:
- You can send a maximum of 1,000 requests per hour from one user account. This applies to all requests of all types; when this limit is reached, WAPI rejects further requests until the time limit expires.
- One user account may submit a maximum of 100 domain availability requests per hour. This applies to the commands domain-check, domain-create and domain-transfer-check.
- Repeated sending of invalid requests (authorization failure, access from a disallowed IP address, invalid input, missing or incorrect parameters, unknown command, commands ending with any error, or any request beyond the scope of the other limits) will, once 10 invalid requests are exceeded, block the IP address for 1 minute for each invalid request. With each further invalid request, the system extends the blocking time.
Synchronous and asynchronous operations
Most commands executed via WAPI are synchronous – you send a command and usually learn the result within a few seconds.
Some operations are asynchronous, meaning that processing such a command can take a very long time (even hours or days). WAPI therefore does not return the final result, only confirmation that the command was received. The system then sends you the progress and the final result in the form of notifications.
Logging
You can find the request log in the Customer Administration by following these steps:
- Log in to the Customer Administration ⧉.
- In the top menu, select My Account Customer.
- In the left menu, select WAPI queries.
Activating WAPI in the Customer Administration
Before you start using WAPI, activate it in the Customer Administration by following these steps:
- Log in to the Customer Administration ⧉.
- In the top menu, select My Account Customer.
- In the left menu, select WAPI interface.
- Set the allowed IP addresses (IPv4 or IPv6, CIDR is supported), notification method, preferred protocol and password.
- Confirm the settings by clicking Set.

All settings entered during activation can later be changed in the same way. By deleting the contents of the field Allowed IP addresses you deactivate WAPI.
Communication and authentication
Communication with the WAPI interface takes place over the HTTPS protocol. Data is passed using the POST method in the parameter request in XML or JSON format. The basic form of the command and response is the same for all commands. Data encoding is UTF-8.
Interface URLs:
- XML:
https://api.wedos.com/wapi/xml - JSON:
https://api.wedos.com/wapi/json
Request structure
A request consists of the following data:
- user: The username (email) of your customer account, required parameter.
- auth: Authorization string, required parameter. It is the sha1 hash of a string composed of the username, the sha1 hash of the WAPI password and the current hour (00-23). The time zone is Europe/Prague (winter time UTC+1 CET, summer time UTC+2 CEST). See the code below for a concrete example.
- command: The WAPI command itself. Required parameter.
- clTRID: Request ID, optional parameter. You can put any string into this element as an identifier, which WAPI returns in the response.
- data: The data part of the command. Optional parameter.
- test: Test mode flag, optional parameter. If you add the test element with the value 1 to the command, WAPI only checks your command and does not make any changes.
When communicating with WAPI, use the WAPI password. The customer account password does not work.
The request template (JSON) is therefore:
{
"request":
{
"user": "your@login.tld",
"auth": "authorization string",
"command": "request name",
"data":
{
request data
}
"clTRID": "request identifier (optional)",
"test": "1 (if you only want to test the request, optional)"
}
}
A complete example of use in PHP (JSON data format) can then be:
<?php
date_default_timezone_set('Europe/Prague');
$login = 'your@login.tld';
$wpass = 'your WAPI password';
$auth = sha1($login.sha1($wpass).date('H', time()));
$url = 'https://api.wedos.com/wapi/json';
$input = [ 'request' => [
'user' => $login,
'auth' => $auth,
'command' => 'request name',
'data' => ['request data array'],
'clTRID' => 'request identifier (optional)',
'test' => '1 (if you only want to test the request)'
]
];
$post = json_encode($input);
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_TIMEOUT,60);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS, 'request=' . urlencode($post));
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']);
$res = curl_exec($ch);
?>
Response structure
A response consists of the following data:
- code: Return value of the command. You can find more information in the chapter Return codes.
- result: Text description of the return code.
- timestamp: Time of command execution in UNIX format.
- clTRID: Client-side command identifier.
- svTRID: Server-side command identifier.
- command: The WAPI command.
- data: Return values. If the command fails, no data is returned.
- test: Included in responses to commands that also contain this flag.
A sample response in JSON format looks like this:
{
"response":
{
"code": "1000",
"result": "ok",
"timestamp": "1286356644",
"svTRID": "1286356644.0246.21616",
"command": "domain-create",
"data":
{
"num": "1311000863",
"expiration": "2011-10-06"
},
"test": "1"
}
}
Pagination and searching in lists
List commands domains-list and dns-rows-list have optional parameters for searching and pagination. If you do not specify them, WAPI returns the response as before, i.e. the whole list.
Parameters in the data part of the request:
- search: Text to search for, case-insensitive. For
domains-listit searches the domain name, fordns-rows-listthe record name or data. - page: Page number starting from 1. The default value is 1.
- page_limit: Number of items per page, at most 1000 (WAPI reduces a larger value to 1000). If you omit it or specify 0, WAPI returns all items.
Command dns-rows-list also has these filters:
- row_name: Exact record name. The value
@means the record directly on the domain. - rdtype: Record type (A, AAAA, MX, TXT…), case does not matter.
If you specify any of these parameters, WAPI returns the list as an array (for domains-list in the item domain, for dns-rows-list in the item row) and in the data part of the response adds:
- total: Total number of items after filters are applied.
- page: Number of the returned page.
- page_limit: Number of items per page used (0 means all).
Things to watch out for:
- A page past the end of the list returns an empty list with the item total, not an error.
- WAPI does not reject an invalid value of page or page_limit (text, negative number) but replaces it with the default value: page 1, page_limit 0, i.e. all items.
- An array instead of a value in page or page_limit returns error 2101.
- Command
dns-domains-listreturns total (as a string), page and page_limit in every case. If page_limit is omitted or set to 0, 1000 is used.
JSON command domains-list (active domains containing “example”, first page with two domains), see the detailed description in the documentation of the domains-list command ⧉:
{
"request": {
"user": "your@login.tld",
"auth": "generated authorization string",
"command": "domains-list",
"clTRID": "custom ID code",
"data": {
"status": "active",
"search": "example",
"page": 1,
"page_limit": 2
}
}
}
JSON command dns-rows-list (A records of the domain example.cz, first page with 50 records), see the detailed description in the documentation of the dns-rows-list command ⧉:
{
"request": {
"user": "your@login.tld",
"auth": "generated authorization string",
"command": "dns-rows-list",
"clTRID": "custom ID code",
"data": {
"domain": "example.cz",
"rdtype": "A",
"page": 1,
"page_limit": 50
}
}
}
Notification
Asynchronous operations cannot be performed immediately. You can follow the progress and result of such operations through notifications. Synchronous requests do not use notifications.
If WAPI cannot complete an operation immediately, it returns Request pending (1001). Once the operation is completed (for more complex actions, after each step), it creates a notification, which is equivalent to a classic response. You can match a notification to the corresponding request by the clTRID or svTRID parameters.
Notification data is always UTF-8 encoded.
You can receive notifications in the following ways (depending on the settings made during activation):
- Via the POLL queue.
- By sending them to the specified email address.
- Via HTTP (or HTTPS) to a URL of your choice using the POST method in the request parameter. An HTTP response with return code 200 is considered correct delivery. If delivery fails, our system will try again at intervals of several minutes.
A sample notification in JSON format looks like this:
{
"notify": {
"code": 1000,
"result": "OK",
"timestamp": 1286957932,
"clTRID": "AvrX87Kqk6h3",
"svTRID": "1286957874.1271.15706",
"command": "ping-async",
"ID": 2691
}
}
System notifications
System notifications send information about relevant events, currently only about a domain being transferred elsewhere. If WAPI is active on your account, the system sends such information via a notification, similar to an asynchronous command.
Set the protocol in which WAPI sends system notifications according to the chapter Activating WAPI in the Customer Administration. This option works for notifications sent to an email or URL address. When downloading from the POLL queue, the response has the same form as a command.
The structure is the same as in the classic notification, the command is always system-notify. In the data node you will find more detailed information.
Basic commands
The basic commands include ping, ping-async and the commands for working with the POLL queue poll-req and poll-ack.
ping
The ping command is used to test that WAPI works – for example credentials, IP address or code.
Return values are:
- 1000 - OK
JSON command:
{
"request": {
"user": "your@login.tld",
"auth": "generated authorization string",
"command": "ping",
"clTRID": "custom ID code"
}
}
JSON response:
{
"response": {
"code": "1000",
"result": "OK",
"timestamp": "UTC time",
"clTRID": "custom ID code",
"svTRID": "server ID code",
"command": "ping"
}
}
ping-async
The ping-async command tests that WAPI notifications work.
Return values are:
- 1000 OK
- 1001 Request pending
JSON command:
{
"request": {
"user": "your@login.tld",
"auth": "generated authorization string",
"command": "ping",
"clTRID": "custom ID code"
}
}
JSON response:
{
"response": {
"code": "1001",
"result": "Request pending",
"timestamp": "UTC time",
"clTRID": "custom ID code",
"svTRID": "server ID code",
"command": "ping"
}
}
JSON notification:
{
"notify": {
"code": "1000",
"result": "OK",
"timestamp": "UTC time",
"clTRID": "your own ID code",
"svTRID": "server ID code",
"command": "ping-async",
"id": "ID for the POLL queue",
"data": {
"round": "attempt number",
"time": "time",
"done": 1
}
}
}
poll-req and poll-ack
You retrieve notifications from the POLL queue by combining the poll-req and poll-ack commands:
- The poll-req command downloads the oldest available notification.
- The poll-ack command marks a notification as received, which makes newer ones available until the queue is exhausted.
Return values for poll-req are:
- 1000 – notification retrieved
- 1003 – there is no unread notification in the queue
- 2150 – Your account is not set up to download notifications from the poll queue
JSON command poll-req:
{
"request": {
"user": "your@login.tld",
"auth": "generated authorization string",
"command": "poll-req",
"clTRID": "custom ID code"
}
}
JSON response to poll-req (notification available):
{
"response": {
"code": "1000",
"result": "OK",
"timestamp": "UTC time",
"clTRID": "custom ID code",
"svTRID": "server ID code",
"command": "poll-req",
"data": {
"notify": {
"code": "1000",
"result": "OK",
"timestamp": "UTC time",
"clTRID": "custom ID code of the found command",
"svTRID": "server ID code of the found command",
"command": "command name",
"id": "ID in the POLL queue"
}
}
}
}
JSON response to poll-req (empty notification queue):
{
"response": {
"code": 1003,
"result": "Empty notifications queue",
"timestamp": "1286962852",
"clTRID": "your own ID code",
"svTRID": "server ID code",
"command": "poll-req"
}
}
You pass the following data (parameters) to the poll-ack command:
- id – ID of the current POLL notification
Return values for poll-ack are:
- 1002 – notification marked as received
- 2151 – notification not found
JSON command poll-ack:
{
"request": {
"user": "your@login.tld",
"auth": "generated authorization string",
"command": "poll-ack",
"clTRID": "custom ID code",
"data": {
"id": "ID of the received POLL notification"
}
}
}
JSON response to poll-ack:
{
"response": {
"code": "1002",
"result": "Notification acquired",
"timestamp": "UTC time",
"clTRID": "your own ID code",
"svTRID": "server ID code",
"command": "poll-ack"
}
}
List of return codes
Return codes in responses and notifications will help you identify the progress and any errors of WAPI.
Basic classification of return codes:
- 1xxx – the command was successful.
- 2xxx – incorrect command (for example missing input items, or their incorrect format or value).
- 3xxx – target object error – the requested action cannot be performed because the object is not in the correct state (for example when trying to register an already taken domain, …).
- 4xxx – error while executing the command (e.g. domain registry unavailable, communication error, etc.).
- 5xxx – internal error or state of our system.
- x0xx, x1xx – general.
- x2xx – domains.
- x3xx – DNS.
You will always find the specific responses returned for a given command in the documentation of that command.
Glossary
- Asynchronous command: A command executed over a longer time; it returns only an acceptance message and you follow its further progress through notifications.
- API: Application Programming Interface. An interface that lets you use your own code to retrieve data from or manage a third-party application.
- Data: The content of some commands specifying detailed settings. The data structure is defined by the specific command.
- JSON: JavaScript Object Notation. A modern way of communicating with an API.
- Return code: A number identifying the type of WAPI response to a command.
- Notification: JSON or XML code with messages about the progress of an asynchronous command.
- Command: A request to WAPI.
- Synchronous command: A command executed practically instantly. It returns a full response and does not use notifications.
- System notifications: A special kind of notification about events in the system; WAPI sends them automatically in the configured format.
- UTF-8: Unicode Transformation Format. A widely used international character encoding standard supporting a large number of scripts.
- WAPI: An interface for managing some parts of the Customer Administration (Credit Account, domains, DNS).
- XML: eXtended Markup Language. An older way of communicating with an API.