Skip to main content
GET
/
domains
JavaScript
import Codeqr from '@codeqr/ts';

const client = new Codeqr({
  apiKey: process.env['CODEQR_API_KEY'], // This is the default and can be omitted
});

const domains = await client.domains.list();

console.log(domains);
curl --request GET \
--url https://api.codeqr.io/domains \
--header 'Authorization: Bearer <token>'
import requests

url = "https://api.codeqr.io/domains"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.codeqr.io/domains",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

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

curl_close($curl);

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

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

func main() {

url := "https://api.codeqr.io/domains"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.codeqr.io/domains")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.codeqr.io/domains")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
[
  {
    "id": "<string>",
    "slug": "acme.com",
    "verified": false,
    "primary": false,
    "archived": false,
    "target": "https://acme.com",
    "type": "redirect",
    "placeholder": "https://codeqr.io/help/article/what-is-codeqr",
    "expiredUrl": "https://acme.com/expired",
    "createdAt": "<string>",
    "updatedAt": "<string>"
  }
]
{
"error": {
"code": "bad_request",
"message": "The requested resource was not found.",
"doc_url": "https://docs.codeqr.io/api-reference/errors#bad-request"
}
}
{
"error": {
"code": "unauthorized",
"message": "The requested resource was not found.",
"doc_url": "https://docs.codeqr.io/api-reference/errors#unauthorized"
}
}
{
"error": {
"code": "forbidden",
"message": "The requested resource was not found.",
"doc_url": "https://docs.codeqr.io/api-reference/errors#forbidden"
}
}
{
"error": {
"code": "not_found",
"message": "The requested resource was not found.",
"doc_url": "https://docs.codeqr.io/api-reference/errors#not-found"
}
}
{
"error": {
"code": "conflict",
"message": "The requested resource was not found.",
"doc_url": "https://docs.codeqr.io/api-reference/errors#conflict"
}
}
{
"error": {
"code": "invite_expired",
"message": "The requested resource was not found.",
"doc_url": "https://docs.codeqr.io/api-reference/errors#invite-expired"
}
}
{
"error": {
"code": "unprocessable_entity",
"message": "The requested resource was not found.",
"doc_url": "https://docs.codeqr.io/api-reference/errors#unprocessable-entity"
}
}
{
"error": {
"code": "rate_limit_exceeded",
"message": "The requested resource was not found.",
"doc_url": "https://docs.codeqr.io/api-reference/errors#rate-limit_exceeded"
}
}
{
"error": {
"code": "internal_server_error",
"message": "The requested resource was not found.",
"doc_url": "https://docs.codeqr.io/api-reference/errors#internal-server_error"
}
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

Query Parameters

archived
boolean
default:false

Whether to include archived domains in the response. Defaults to false if not provided.

The search term to filter the domains by.

page
number
default:1

The page number for pagination.

Required range: x > 0
Example:

1

pageSize
number
default:50

The number of items per page.

Required range: 0 < x <= 50
Example:

50

Response

The domains were retrieved.

id
string
required

The unique identifier of the domain.

slug
string
required

The domain name.

Example:

"acme.com"

verified
boolean
default:false
required

Whether the domain is verified.

primary
boolean
default:false
required

Whether the domain is the primary domain for the project.

archived
boolean
default:false
required

Whether the domain is archived.

target
string | null
required

The target URL to redirect to when accessing the domain root.

Example:

"https://acme.com"

type
enum<string>
default:redirect
required

The behavior type for the domain root redirect.

Available options:
redirect,
rewrite
placeholder
string
default:https://codeqr.io/help/article/what-is-codeqr
required

Provide context to your teammates in the link creation modal by showing them an example of a link to be shortened.

Example:

"https://codeqr.io/help/article/what-is-codeqr"

expiredUrl
string | null
required

The URL to redirect to when a link under this domain has expired.

Example:

"https://acme.com/expired"

createdAt
string
required

The date the domain was created.

updatedAt
string
required

The date the domain was last updated.