Typescript (SDK)
import { Crevio } from "@crevio/sdk";
const crevio = new Crevio({
apiKey: process.env["CREVIO_API_KEY"] ?? "",
});
async function run() {
const result = await crevio.domains.purchase({
domain: "<value>",
registrant: {
name: "<value>",
email: "<value>",
phone: "<value>",
street: "<value>",
city: "<value>",
postalCode: "<value>",
countryCode: "<value>",
},
});
console.log(result);
}
run();curl --request POST \
--url https://api.crevio.co/v1/domains/purchase \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"domain": "<string>",
"registrant": {
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"street": "<string>",
"city": "<string>",
"postal_code": "<string>",
"country_code": "<string>",
"organization": "<string>",
"state": "<string>"
}
}
'import requests
url = "https://api.crevio.co/v1/domains/purchase"
payload = {
"domain": "<string>",
"registrant": {
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"street": "<string>",
"city": "<string>",
"postal_code": "<string>",
"country_code": "<string>",
"organization": "<string>",
"state": "<string>"
}
}
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({
domain: '<string>',
registrant: {
name: '<string>',
email: '<string>',
phone: '<string>',
street: '<string>',
city: '<string>',
postal_code: '<string>',
country_code: '<string>',
organization: '<string>',
state: '<string>'
}
})
};
fetch('https://api.crevio.co/v1/domains/purchase', 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://api.crevio.co/v1/domains/purchase",
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([
'domain' => '<string>',
'registrant' => [
'name' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'street' => '<string>',
'city' => '<string>',
'postal_code' => '<string>',
'country_code' => '<string>',
'organization' => '<string>',
'state' => '<string>'
]
]),
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://api.crevio.co/v1/domains/purchase"
payload := strings.NewReader("{\n \"domain\": \"<string>\",\n \"registrant\": {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"street\": \"<string>\",\n \"city\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country_code\": \"<string>\",\n \"organization\": \"<string>\",\n \"state\": \"<string>\"\n }\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://api.crevio.co/v1/domains/purchase")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"domain\": \"<string>\",\n \"registrant\": {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"street\": \"<string>\",\n \"city\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country_code\": \"<string>\",\n \"organization\": \"<string>\",\n \"state\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crevio.co/v1/domains/purchase")
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 \"domain\": \"<string>\",\n \"registrant\": {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"street\": \"<string>\",\n \"city\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country_code\": \"<string>\",\n \"organization\": \"<string>\",\n \"state\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"object": "<string>",
"id": "<string>",
"domain": "<string>",
"status": "<string>",
"checkout_url": "<string>",
"hint": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "authentication_required",
"message": "You did not provide an API key."
}
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>",
"errors": {},
"doc_url": "<string>"
}
}{
"error": {
"type": "validation_error",
"code": "validation_failed",
"message": "Email is required",
"errors": {
"email": [
"can't be blank"
]
}
}
}{
"error": {
"type": "invalid_request_error",
"code": "rate_limit_exceeded",
"message": "Too many requests. Please retry later."
}
}Domains
Buy a domain
Registers a domain through the built-in registrar in the owner’s name: registrant becomes the legal registrant on record with the registry, so ask the business owner for these details rather than inventing them. If the account has a card on file the purchase is charged immediately (charged: true, no redirect); otherwise the response includes a Stripe Checkout URL (checkout_url) to complete payment. The domain is created in pending_payment and becomes active once payment completes and registration succeeds. Poll GET /domains/ for status. Buying accepts the domain registration terms at https://crevio.co/legal/terms-of-service#7a-domain-names.
POST
/
domains
/
purchase
Typescript (SDK)
import { Crevio } from "@crevio/sdk";
const crevio = new Crevio({
apiKey: process.env["CREVIO_API_KEY"] ?? "",
});
async function run() {
const result = await crevio.domains.purchase({
domain: "<value>",
registrant: {
name: "<value>",
email: "<value>",
phone: "<value>",
street: "<value>",
city: "<value>",
postalCode: "<value>",
countryCode: "<value>",
},
});
console.log(result);
}
run();curl --request POST \
--url https://api.crevio.co/v1/domains/purchase \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"domain": "<string>",
"registrant": {
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"street": "<string>",
"city": "<string>",
"postal_code": "<string>",
"country_code": "<string>",
"organization": "<string>",
"state": "<string>"
}
}
'import requests
url = "https://api.crevio.co/v1/domains/purchase"
payload = {
"domain": "<string>",
"registrant": {
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"street": "<string>",
"city": "<string>",
"postal_code": "<string>",
"country_code": "<string>",
"organization": "<string>",
"state": "<string>"
}
}
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({
domain: '<string>',
registrant: {
name: '<string>',
email: '<string>',
phone: '<string>',
street: '<string>',
city: '<string>',
postal_code: '<string>',
country_code: '<string>',
organization: '<string>',
state: '<string>'
}
})
};
fetch('https://api.crevio.co/v1/domains/purchase', 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://api.crevio.co/v1/domains/purchase",
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([
'domain' => '<string>',
'registrant' => [
'name' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'street' => '<string>',
'city' => '<string>',
'postal_code' => '<string>',
'country_code' => '<string>',
'organization' => '<string>',
'state' => '<string>'
]
]),
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://api.crevio.co/v1/domains/purchase"
payload := strings.NewReader("{\n \"domain\": \"<string>\",\n \"registrant\": {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"street\": \"<string>\",\n \"city\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country_code\": \"<string>\",\n \"organization\": \"<string>\",\n \"state\": \"<string>\"\n }\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://api.crevio.co/v1/domains/purchase")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"domain\": \"<string>\",\n \"registrant\": {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"street\": \"<string>\",\n \"city\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country_code\": \"<string>\",\n \"organization\": \"<string>\",\n \"state\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crevio.co/v1/domains/purchase")
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 \"domain\": \"<string>\",\n \"registrant\": {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"street\": \"<string>\",\n \"city\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country_code\": \"<string>\",\n \"organization\": \"<string>\",\n \"state\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"object": "<string>",
"id": "<string>",
"domain": "<string>",
"status": "<string>",
"checkout_url": "<string>",
"hint": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "authentication_required",
"message": "You did not provide an API key."
}
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>",
"errors": {},
"doc_url": "<string>"
}
}{
"error": {
"type": "validation_error",
"code": "validation_failed",
"message": "Email is required",
"errors": {
"email": [
"can't be blank"
]
}
}
}{
"error": {
"type": "invalid_request_error",
"code": "rate_limit_exceeded",
"message": "Too many requests. Please retry later."
}
}Headers
Body
application/json
Was this page helpful?

