API documentation Web hosting accessible to everyone Visit LWS

Add a record to a DNS zone

POST https://api.lws.net/v1/domain/{domain}/zdns

operationIdpostDomainZdns

Add a new record to the given domain's DNS zone. It may take up to a few hours for the record to be propagated.

Path parameters

domain string required

Domain name to add DNS record for

Request body

  • type string

    Type of field to add to the DNS Zone. Must be A, AAAA, CNAME, ANAME, MX, NS, TXT, SRV, SPF or CAA

    Example: A

    required
  • name string

    Name of the record to add to the DNS Zone. Its content depends on the type of record to add. For example, @ or mail for A records, www for CNAME records, @ for NS, etc...

    Example: @

    required
  • value string

    Value of the field to add to the DNS Zone. It could be an IP address, a domain name, a DNS, ...

    Example: 192.0.2.1

    required
  • ttl integer

    Time To Live of the field to add to the DNS Zone. Must be 86400, 43200, 21600, 7200, 3600, 1800 or 900

    Example: 86400

    required
Example request
{
  "type": "A",
  "name": "@",
  "value": "192.0.2.1",
  "ttl": 86400
}

Responses

200

DNS record added successfully

{
  "code": 200,
  "info": "Added a new line in the DNS Zone",
  "data": {
    "id": "568470",
    "type": "AAAA",
    "name": "@",
    "value": "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
    "ttl": 86400
  }
}
Response fields 8 Extends ApiEnvelope
  • code integer

    Application-level status/error code (not always equal to the HTTP status code)

    Example: 200

  • info string

    Human-readable message describing the result of the request

    Example: Added a new line in the DNS Zone

  • data object
  • id integer

    ID of the record. Used for record-specific function like DELETE

    Example: 568470

  • type string

    Type of field to add to the DNS Zone. Must be A, AAAA, CNAME, ANAME, MX, NS, TXT, SRV, SPF or CAA

    Example: AAAA

  • name string

    Name of the field to add to the DNS Zone. Its content depends on the type of record to add. For example, @ or mail for A records, www for CNAME records, @ for NS, etc...

    Example: @

  • value string

    Value of the field to add to the DNS Zone. It could be an IP address, a domain name, a DNS, ...

    Example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334

  • ttl integer

    Time To Live of the field to add to the DNS Zone. Must be 86400, 43200, 21600, 7200, 3600, 1800 or 900

    Example: 86400

314

Domain not found on account

314 is not a registered HTTP status code. It is specific to this API.

{
  "code": 314,
  "info": "Provided domain has not been found on your account. You must own this domain to manage it."
}
Response fields 2 Extends ApiEnvelope
  • code integer

    Application-level status/error code (not always equal to the HTTP status code)

    Example: 314

  • info string

    Human-readable message describing the result of the request

    Example: Provided domain has not been found on your account. You must own this domain to manage it.

400

Invalid input ; could be missing fields, invalid fields, ... Check the data provided for more details.

{
  "code": 400,
  "info": "Invalid input",
  "data": []
}
Response fields 3 Extends ApiEnvelope
  • code integer

    Application-level status/error code (not always equal to the HTTP status code)

    Example: 400

  • info string

    Human-readable message describing the result of the request

    Example: Invalid input

  • data object

    Details about validation errors

500

Internal Server Error

{
  "code": 500,
  "info": "Internal Server Error",
  "data": "string"
}
Response fields 3 Extends ApiEnvelope
  • code integer

    Application-level status/error code (not always equal to the HTTP status code)

    Example: 500

  • info string

    Human-readable message describing the result of the request

    Example: Internal Server Error

  • data string

    Error message

502

Bad Gateway

{
  "code": 502,
  "info": "Invalid response from upstream server",
  "data": []
}
Response fields 3 Extends ApiEnvelope
  • code integer

    Application-level status/error code (not always equal to the HTTP status code)

    Example: 502

  • info string

    Human-readable message describing the result of the request

    Example: Invalid response from upstream server

  • data object

    Invalid response returned by the server

401

Unauthorized - Missing authentication headers

{
  "code": 401,
  "info": "Unauthorized access to the API. Please specify X-Auth-Pass and X-Auth-Login to proceed."
}
Response fields 2
  • code integer

    Example: 401

  • info string

    Example: Unauthorized access to the API. Please specify X-Auth-Pass and X-Auth-Login to proceed.

429

Rate limit exceeded

{
  "code": 429,
  "info": "Rate limit exceeded. Please try again later."
}
Response fields 2
  • code integer

    Example: 429

  • info string

    Example: Rate limit exceeded. Please try again later.

Show the code examples and the test console
POST /domain/{domain}/zdns
LWS_AUTH_LOGIN='…'LWS_AUTH_PASS='…'curl -X POST \  "https://api.lws.net/v1/domain/{domain}/zdns" \  -H "X-Auth-Login: $LWS_AUTH_LOGIN" \  -H "X-Auth-Pass: $LWS_AUTH_PASS" \  -H "Content-Type: application/json" \  -d '{"type":"A","name":"@","value":"192.0.2.1","ttl":86400}'
$lwsAuthLogin = '…';$lwsAuthPass = '…';$ch = curl_init("https://api.lws.net/v1/domain/{domain}/zdns");curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_HTTPHEADER, [    "X-Auth-Login: " . $lwsAuthLogin,    "X-Auth-Pass: " . $lwsAuthPass,    "Content-Type: application/json",]);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"type":"A","name":"@","value":"192.0.2.1","ttl":86400}');$res = json_decode(curl_exec($ch), true);
import requestsLWS_AUTH_LOGIN = "…"LWS_AUTH_PASS = "…"res = requests.post(    "https://api.lws.net/v1/domain/{domain}/zdns",    headers={        "X-Auth-Login": LWS_AUTH_LOGIN,        "X-Auth-Pass": LWS_AUTH_PASS,    },    json={"type": "A", "name": "@", "value": "192.0.2.1", "ttl": 86400},)print(res.json())
const LWS_AUTH_LOGIN = "…";const LWS_AUTH_PASS = "…";const res = await fetch("https://api.lws.net/v1/domain/{domain}/zdns", {  method: "POST",  headers: {    "X-Auth-Login": LWS_AUTH_LOGIN,    "X-Auth-Pass": LWS_AUTH_PASS,    "Content-Type": "application/json",  },  body: JSON.stringify({"type":"A","name":"@","value":"192.0.2.1","ttl":86400}),});const data = await res.json();
lwsAuthLogin := "…"lwsAuthPass := "…"body := strings.NewReader(`{"type":"A","name":"@","value":"192.0.2.1","ttl":86400}`)req, _ := http.NewRequest("POST",    "https://api.lws.net/v1/domain/{domain}/zdns", body)req.Header.Set("X-Auth-Login", lwsAuthLogin)req.Header.Set("X-Auth-Pass", lwsAuthPass)req.Header.Set("Content-Type", "application/json")resp, err := http.DefaultClient.Do(req)