# Claiming a domain

> Take over a domain that another account has already verified by proving DNS control through the claim flow.

When you try to add a domain that **another account** has already verified, SendDart blocks the creation and tells you the domain can be **claimed**. Claiming lets you prove control of the domain over DNS and transfer it to your account — entirely over the API.

## How it works

1. **Start a claim** — Call [Claim domain](https://www.senddart.com/docs/domains/claim) with the domain name. SendDart creates a placeholder domain on your account and returns a `domain_claim` containing a TXT `record` to add to your DNS.
2. **Add the TXT record** — Publish the returned TXT record at your DNS provider. It proves you control the domain.
3. **Verify the claim** — Call [Verify domain claim](https://www.senddart.com/docs/domains/claim). SendDart checks the TXT record and, once it resolves, transfers the domain to your account.
4. **Track the status** — Poll [Get domain claim](https://www.senddart.com/docs/domains/claim) until the claim reaches `completed`.

## Claim statuses

| Status | Meaning |
| --- | --- |
| `pending` | Waiting for DNS verification. |
| `verified` | DNS proof accepted; the transfer is in progress. |
| `completed` | The domain now belongs to your account. |
| `failed` | The claim could not be completed. |
| `expired` | The claim window passed before it completed. |

## Start a claim

**Node.js**

```js
import { SendDart } from 'senddart';

const mb = new SendDart('mb_xxxxxxxxx');

const { data, error } = await mb.domains.claim({ "name": "example.com" });
console.log({ data, error });
```

**Ruby**

```ruby
require "senddart"

SendDart.api_key = "mb_xxxxxxxxx"

SendDart::Domains.claim({
  "name": "example.com"
})
```

**PHP**

```php
<?php
require 'vendor/autoload.php';

use SendDart\SendDart;

$senddart = SendDart::client('mb_xxxxxxxxx');

$senddart->domains->claim([
  'name' => "example.com"
]);
```

**Python**

```python
import senddart

senddart.api_key = "mb_xxxxxxxxx"

senddart.Domains.claim({
  "name": "example.com"
})
```

**Go**

```go
import "github.com/shekhu10/senddart-sdks/senddart-go"

client := senddart.NewClient("mb_xxxxxxxxx")

claim, err := client.Domains.Claim(&senddart.ClaimDomainRequest{
    Name: "example.com",
})
```

**Rust**

```rust
use senddart::{ClaimDomainOptions, SendDart};

let mb = SendDart::new("mb_xxxxxxxxx");

let _claim = mb.domains.claim(ClaimDomainOptions::new("example.com")).await?;
```

**Java**

```java
import com.senddart.SendDart;
import com.senddart.SendDartResponse;
import com.senddart.requests.ClaimDomainRequest;

SendDart senddart = new SendDart("mb_xxxxxxxxx");

SendDartResponse response = senddart.domains().claim(ClaimDomainRequest.builder().name("example.com").build());
```

**.NET**

```csharp
using SendDart;

ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx");

var resp = await senddart.DomainClaimAsync(new DomainClaimOptions { Name = "example.com" });
```

**cURL**

```bash
curl -X POST 'https://www.senddart.com/api/domains/claim' \
  -H 'Authorization: Bearer mb_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{ "name": "example.com" }'
```

**CLI**

```bash
senddart domains claim start example.com
```

## Canceling a claim

Cancel a pending claim by deleting its placeholder domain with [Delete domain](https://www.senddart.com/docs/api/domains-delete), using the `domain_id` from the `domain_claim` object.

> **Note:** The claim flow only ever transfers a domain after DNS ownership has been proven by the TXT record, so a domain can only be claimed by someone who controls its DNS.
