Skip to main content
POST
/
domains
/
{domain}
/
dns
Create DNS record
curl --request POST \
  --url https://rdp.sh/api/v1/domains/{domain}/dns \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "value": "<string>",
  "ttl": 3600,
  "priority": 32767
}
'
import requests

url = "https://rdp.sh/api/v1/domains/{domain}/dns"

payload = {
    "name": "<string>",
    "value": "<string>",
    "ttl": 3600,
    "priority": 32767
}
headers = {
    "Authorization": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({name: '<string>', value: '<string>', ttl: 3600, priority: 32767})
};

fetch('https://rdp.sh/api/v1/domains/{domain}/dns', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://rdp.sh/api/v1/domains/{domain}/dns",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'name' => '<string>',
    'value' => '<string>',
    'ttl' => 3600,
    'priority' => 32767
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: <api-key>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://rdp.sh/api/v1/domains/{domain}/dns"

	payload := strings.NewReader("{\n  \"name\": \"<string>\",\n  \"value\": \"<string>\",\n  \"ttl\": 3600,\n  \"priority\": 32767\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://rdp.sh/api/v1/domains/{domain}/dns")
  .header("Authorization", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"<string>\",\n  \"value\": \"<string>\",\n  \"ttl\": 3600,\n  \"priority\": 32767\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://rdp.sh/api/v1/domains/{domain}/dns")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"<string>\",\n  \"value\": \"<string>\",\n  \"ttl\": 3600,\n  \"priority\": 32767\n}"

response = http.request(request)
puts response.read_body
{
  "status": true,
  "message": "<string>",
  "record": {
    "id": 123,
    "name": "<string>",
    "value": "<string>",
    "ttl": 123,
    "priority": 123,
    "created_at": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Path Parameters

domain
integer
required

Domain ID

Body

application/json

Payload for creating or updating a DNS record.

type
enum<string>
required

DNS record type.

Available options:
A,
AAAA,
CNAME,
MX,
TXT,
NS,
SRV,
CAA
name
string
required

Record name. Use @ for the apex/root.

Maximum string length: 255
Example:

"@"

value
string
required

Record value (e.g. an IP address, hostname, or text).

Maximum string length: 1000
Example:

"185.241.208.160"

ttl
integer
default:3600

Time-to-live in seconds (60-86400). Defaults to 3600.

Required range: 60 <= x <= 86400
priority
integer | null

Priority for MX and SRV records.

Required range: 0 <= x <= 65535

Response

DNS record created successfully.

status
boolean
Example:

true

message
string
Example:

"DNS record added"

record
object

DNS record object.