This example calls GET /me, which returns your account and organization details. It needs nothing but your token.
Note
These examples show the verified request shape (method, URL, header, and body format) used by 20dragons's own API documentation page. They have not been executed against the live API from this documentation project. If something does not work as shown, check Troubleshooting and API errors.
curl
curl -i -H "Authorization: Bearer YOUR_API_TOKEN" "https://www.20dragons.com/api/me"
PHP
<?php
$ch = curl_init("https://www.20dragons.com/api/me");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer YOUR_API_TOKEN",
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
print_r($data);
JavaScript (fetch)
const response = await fetch("https://www.20dragons.com/api/me", {
headers: {
Authorization: "Bearer YOUR_API_TOKEN",
},
});
const data = await response.json();
console.log(data);
Python
import requests
response = requests.get(
"https://www.20dragons.com/api/me",
headers={"Authorization": "Bearer YOUR_API_TOKEN"},
)
data = response.json()
print(data)
Sending data (POST / PUT)
Requests that send data use a JSON body with Content-Type: application/json. For example, registering a subdomain:
curl -i -X POST "https://www.20dragons.com/api/subdomains" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"domain":"example-domain.com","label":"myproject","nameservers":["ns1.example.net"],"glue":[]}'
Paid registrations and renewals: the confirm step
If a registration or renewal requires credits, the first request returns a quote (price and your balance) instead of completing immediately. Show this to the user, then send the same request again with "confirm": true to finalize it. See Endpoint reference for details.