> For the complete documentation index, see [llms.txt](https://api-docs.devhub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.devhub.com/core-resources/domains.md).

# Domains

Covered in this doc:

* [Search available domains](/core-resources/domains.md#search-available-domains)
* [List domains](/core-resources/domains.md#list-domains)
* [Register a domain](/core-resources/domains.md#register-a-domain)
* [Renew a domain](/core-resources/domains.md#renew-a-domain)

## Search available domains

This method allows you search against registered domains using a keyword and see if they are available or already registered.

```
GET /api/v2/domains/search/?keyword=somebusinessname
```

Passing a list of TLDs to the search

```
GET /api/v2/domains/search/?keyword=somebusinessname&tlds=net,com,co.uk,ch
```

### Parameters

<table data-header-hidden><thead><tr><th>Name</th><th width="155.73033707865167">Type</th><th>Description</th></tr></thead><tbody><tr><td>Name</td><td>Type</td><td>Description</td></tr><tr><td><code>keyword</code></td><td><code>string</code></td><td><strong>required</strong> This is the search query. It can accept a set of keywords (i.e. "some business name") or the actual domain desired (i.e. "somebusinessname.com")</td></tr><tr><td><code>tlds</code></td><td><code>string</code></td><td><strong>optional</strong> Customize the Domain TLDs that will be searched. Passed as a comma separated list of tlds.<br><br>Example: <code>com,net,org,co.uk</code></td></tr></tbody></table>

### Response

```javascript
[
  {
    "available": false,
    "domain": "somebusinessname.com"
  },
  {
    "available": false,
    "domain": "somebusinessname.net"
  },
  {
    "available": true,
    "domain": "somebusinessname.org"
  }
]
```

## List domains

List all domains currently registered

```
GET /api/v2/domains/
```

### Response

```javascript
{
  "meta": {
    "limit": 20,
    "next": "/api/v2/businesses/?limit=20&offset=20",
    "offset": 0,
    "previous": null,
    "total_count": 1039
  },
  "objects": [
    {
      "auto_renew": false,
      "expires": "2016-06-26",
      "id": 1401,
      "registered": "2013-06-26",
      "registrar": "namecom",
      "resource_uri": "/api/v2/domains/1401/",
      "sld": "somebusinessname",
      "tld": "com",
      "user_id": 248114,
      "whois_privacy": false,
      "whois_privacy_expires": null
    },
    ...
  ]
}
```

## Register a domain

Register a domain by providing the domain name as well as the registrant contact details (name, address, etc)

```
POST /api/v2/domains/
```

### Parameters

| Name                    | Type      | Description                                                                                                                                                                                                   |
| ----------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `first_name`            | `string`  | **required** First name of domain owner                                                                                                                                                                       |
| `last_name`             | `string`  | **required** Last name of domain owner                                                                                                                                                                        |
| `address_1`             | `string`  | **required** Street address of domain owner                                                                                                                                                                   |
| `city`                  | `string`  | **required**                                                                                                                                                                                                  |
| `state`                 | `string`  | **required** Two character state/provence code                                                                                                                                                                |
| `zip`                   | `string`  | **required**                                                                                                                                                                                                  |
| `country`               | `string`  | **required** Two character country code (i.e. US, CA)                                                                                                                                                         |
| `phone`                 | `string`  | **required** Contact phone number                                                                                                                                                                             |
| `email`                 | `string`  | **required** Contact email address                                                                                                                                                                            |
| `period`                | `integer` | **required** Number of years to register the domain                                                                                                                                                           |
|                         |           |                                                                                                                                                                                                               |
| **Optional**            |           |                                                                                                                                                                                                               |
| `address_2`             | `string`  | Apt/unit number                                                                                                                                                                                               |
| `organization`          | `string`  | Name of the business/organization. Optional but required for `.org` domains                                                                                                                                   |
| `partner_domain_id`     | `string`  | Unique partner ID for this domain for tracking purposes (billing, account ID). Only one domain can exist for each for these IDs.                                                                              |
| `partner_domain_sub_id` | `string`  | Partner ID that is not unique for tracking purposes.                                                                                                                                                          |
| `language_code`         | `string`  | <p>Only required for certain TLDs and for IDNA (Punycode) language domains, but safe to send for all registrations.<br><br>Pass just the 2 character language code (i.e. <code>es</code>) for the domain.</p> |

### Response

A status code of `201 created` is returned on a successful creation and contains the created domain object as JSON

## Registrant details

For an individual domain, you can retrieve the registrant details like name, address and contact information on the domain.

```
GET /api/v2/domains/:id/detail/
```

### Response

```javascript
{
   "auto_renew":false,
   "contacts":[
      {
         "address_1":"555 Main St",
         "address_2":"",
         "city":"Seattle",
         "country":"US",
         "email":"contact@example.com",
         "fax":"",
         "first_name":"John",
         "last_name":"Doe",
         "organization":"",
         "phone":"+12065555555",
         "state":"WA",
         "tax_id":"",
         "type":[
            "registrant",
            "administrative",
            "billing",
            "technical"
         ],
         "zip":"98121"
      }
   ],
   "create_date":"2019-01-29T23:27:58",
   "domain_name":"domainname.com",
   "expire_date":"2020-01-29T23:27:58",
   "locked":true,
   "nameservers":[
      "ns1mtw.name.com",
      "ns2bkr.name.com",
      "ns3cqz.name.com",
      "ns4fmw.name.com"
   ]
}
```

## Renew a Domain

Renew a domain for a period of years.

```
POST /api/v2/domains/:id/renew/
```

### Parameters

| Name     | Type      | Description                                                 |
| -------- | --------- | ----------------------------------------------------------- |
| `period` | `integer` | **required** Number of additional years to renew the domain |

### Response

A status code of `202 accepted` is returned on a successful renewal of the domain and contains the domain object as JSON

## Reset DNS zone for domain

This method will reset the DNS entries assigned to a domain to defaults for the instance. This is helpful if you have changed values and would like to update an older domain's DNS records.

```
PUT /api/v2/domains/:id/reset_zone/
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://api-docs.devhub.com/core-resources/domains.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
