# Domains

## List of all domain

<mark style="color:blue;">`GET`</mark> `https://api.kdmarc.com/api/v1/domain`

Contain all the list of domains in your account

#### Headers

| Name          | Type   | Description                                                                                                                                                        |
| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Authorization | string | The HTTP Authorization request header contains the credentials to authenticate a user agent with a server, this can be generated through Dashboard within settings |

{% tabs %}
{% tab title="200 JSON format representing the domain" %}

```
{
    "data": [
        {
            "name": "kratikal.com",
            "isActive": true,
            "dmarc": {
                "valid": true,
                "record": "v=DMARC1; p=reject; rua=mailto:dmarc@kratikal.com,mailto:d7e45d4d@inbox.ondmarc.com,mailto:kratikal@rua.azure.kdmarc.com; ruf=mailto:dmarc@kratikal.com,mailto:kratikal@ruf.azure.kdmarc.com; fo=1; adkim=s;",
                "value": "p=reject;",
                "subPolicy": "Sub policy is not configured",
                "subPolicyValid": false
            },
            "spf": {
                "valid": true,
                "value": "SPF Present [~all]",
                "record": "v=spf1 include:_spf.google.com ip4:54.240.37.117 ip4:168.245.74.19 include:zoho.com include:spf1.zoho.com include:transmail.net include:zcsend.net include:_spf.getresponse.com ~all"
            }
        }
    ]
}
```

{% endtab %}

{% tab title="404 Specified domain is not managed by this account." %}

```
{
    "errors": [
        "user not found"
    ]
}
```

{% endtab %}
{% endtabs %}

## Retrieve details of the domain

<mark style="color:blue;">`GET`</mark> `https://api.kdmarc.com/api/v1/domain/{domain}`

Fetch the detail of the specified domain.

#### Path Parameters

| Name          | Type   | Description                                                                                                                                                        |
| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| domain        | string | To fetch the details of the domain you have to put the domain name for e.g. example.com                                                                            |
| Authorization | string | The HTTP Authorization request header contains the credentials to authenticate a user agent with a server, this can be generated through Dashboard within settings |

{% tabs %}
{% tab title="200 JSON format representing the domain " %}

```
{
    "data": {
        "name": "kratikal.com",
        "dmarc": {
            "record": "v=DMARC1; p=reject; rua=mailto:dmarc@kratikal.com,mailto:d7e45d4d@inbox.ondmarc.com,mailto:kratikal@rua.azure.kdmarc.com; ruf=mailto:dmarc@kratikal.com,mailto:kratikal@ruf.azure.kdmarc.com; fo=1; adkim=s;",
            "tags": {
                "v": {
                    "description": "The v tag is required and represents the protocol version. An example is v=DMARC1",
                    "value": "DMARC1"
                },
                "p": {
                    "description": "The required p tag demonstrates the policy for domain (or requested handling policy). It directs the receiver to report, quarantine, or reject emails that fail authentication checks. Policy options are: 1) None 2) Quarantine or 3) Reject.",
                    "value": "reject"
                },
                "rua": {
                    "description": "This optional tag is designed for reporting URI(s) for aggregate data. An rua example is rua=mailto:CUSTOMER@for.example.com.",
                    "value": "mailto:dmarc@kratikal.com,mailto:d7e45d4d@inbox.ondmarc.com,mailto:kratikal@rua.azure.kdmarc.com"
                },
                "ruf": {
                    "description": "Like the rua tag, the ruf designation is an optional tag. It directs addresses to which message-specific forensic information is to be reported (i.e., comma-separated plain-text list of URIs). An ruf example is ruf=mailto:CUSTOMER@for.example.com.",
                    "value": "mailto:dmarc@kratikal.com,mailto:kratikal@ruf.azure.kdmarc.com"
                },
                "fo": {
                    "description": "The FO tag pertains to how forensic reports are created and presented to DMARC users.",
                    "value": "1"
                },
                "adkim": {
                    "description": "Similar to aspf, the optional adkim tag is the alignment mode for the DKIM protocol. A sample tag is adkim=r.",
                    "value": "s"
                }
            }
        },
        "spf": {
            "record": "v=spf1 include:_spf.google.com ip4:54.240.37.117 ip4:168.245.74.19 include:zoho.com include:spf1.zoho.com include:transmail.net include:zcsend.net include:_spf.getresponse.com ~all",
            "tags": {
                "mechanisms": [
                    {
                        "prefix": "v",
                        "type": "version",
                        "description": "The SPF record version",
                        "value": "spf1"
                    },
                    {
                        "prefix": "+",
                        "prefixdesc": "Pass",
                        "type": "include",
                        "description": "The specified domain is searched for an 'allow'",
                        "value": "_spf.google.com"
                    },
                    {
                        "prefix": "+",
                        "prefixdesc": "Pass",
                        "type": "ip4",
                        "description": "Match if IP is in the given range",
                        "value": "54.240.37.117"
                    },
                    {
                        "prefix": "+",
                        "prefixdesc": "Pass",
                        "type": "ip4",
                        "description": "Match if IP is in the given range",
                        "value": "168.245.74.19"
                    },
                    {
                        "prefix": "+",
                        "prefixdesc": "Pass",
                        "type": "include",
                        "description": "The specified domain is searched for an 'allow'",
                        "value": "zoho.com"
                    },
                    {
                        "prefix": "+",
                        "prefixdesc": "Pass",
                        "type": "include",
                        "description": "The specified domain is searched for an 'allow'",
                        "value": "spf1.zoho.com"
                    },
                    {
                        "prefix": "+",
                        "prefixdesc": "Pass",
                        "type": "include",
                        "description": "The specified domain is searched for an 'allow'",
                        "value": "transmail.net"
                    },
                    {
                        "prefix": "+",
                        "prefixdesc": "Pass",
                        "type": "include",
                        "description": "The specified domain is searched for an 'allow'",
                        "value": "zcsend.net"
                    },
                    {
                        "prefix": "+",
                        "prefixdesc": "Pass",
                        "type": "include",
                        "description": "The specified domain is searched for an 'allow'",
                        "value": "_spf.getresponse.com"
                    },
                    {
                        "prefix": "~",
                        "prefixdesc": "SoftFail",
                        "type": "all",
                        "description": "Always matches. It goes at the end of your record"
                    }
                ],
                "valid": true
            },
            "issues": [
                "Multiple Spf Record Found"
            ]
        },
        "bimi": {
            "record": "v=BIMI1;l=https://www.kratikal.com/assets/images/logo/kratikal-1.svg;",
            "issues": []
        },
        "mx": [
            {
                "domain": "kratikal.com.",
                "type": "MX",
                "ttl": "300",
                "class": "IN",
                "value": {
                    "priority": "50",
                    "server": "aspmx3.googlemail.com."
                }
            },
            {
                "domain": "kratikal.com.",
                "type": "MX",
                "ttl": "300",
                "class": "IN",
                "value": {
                    "priority": "10",
                    "server": "aspmx.l.google.com."
                }
            },
            {
                "domain": "kratikal.com.",
                "type": "MX",
                "ttl": "300",
                "class": "IN",
                "value": {
                    "priority": "20",
                    "server": "alt1.aspmx.l.google.com."
                }
            },
            {
                "domain": "kratikal.com.",
                "type": "MX",
                "ttl": "300",
                "class": "IN",
                "value": {
                    "priority": "30",
                    "server": "alt2.aspmx.l.google.com."
                }
            },
            {
                "domain": "kratikal.com.",
                "type": "MX",
                "ttl": "300",
                "class": "IN",
                "value": {
                    "priority": "40",
                    "server": "aspmx2.googlemail.com."
                }
            }
        ]
    }
}
```

{% endtab %}

{% tab title="404 Specified domain is not managed by this account " %}

```
{
    "errors": [
        "user not found"
    ]
}
```

{% endtab %}
{% endtabs %}

## ​Create a domain&#x20;

<mark style="color:green;">`POST`</mark> `https://api.kdmarc.com/api/v1/domain/`

Start creating a new domain within this account.

#### Path Parameters

| Name          | Type   | Description                                                                                                                                                        |
| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Authorization | string | The HTTP Authorization request header contains the credentials to authenticate a user agent with a server, this can be generated through Dashboard within settings |

#### Request Body

| Name | Type   | Description                                          |
| ---- | ------ | ---------------------------------------------------- |
| name | object | <p>Example<br>{<br>  "name":"kratikal.com" <br>}</p> |

{% tabs %}
{% tab title="200 " %}

```
{
  "data": {
    "domain": "managed.example.com",
    "dmarc": {
      "policy": "none",
      "domain": "domain.com",
    },
    "raw": "v=DMARC1; p=none; pct=100; fo=1; ri=3600; rua=mailto:xxxxxxxx@rua.kdmarc.com; ruf=mailto:xxxxxxxx@ruf.kdmarc.com;"
  }
}
```

{% endtab %}

{% tab title="402 Domain Limit has been exceeded" %}

```
{
    "errors": [
        "Domain limit exceeded! Kindly upgrade your package."
    ]
}
```

{% endtab %}

{% tab title="404 " %}

```
{
    "errors": [
        "user not found"
    ]
}
```

{% endtab %}
{% endtabs %}

## Deleting a domain

<mark style="color:red;">`DELETE`</mark> `https://api.kdmarc.com/api/v1/domain/{domain}`

Stop managing a domain with this account.

#### Path Parameters

| Name          | Type   | Description                                                                                                                                                        |
| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| domain        | string | <p>To delete the specific domain you have to put the domain name <br>for e.g. example.com </p>                                                                     |
| Authorization | string | The HTTP Authorization request header contains the credentials to authenticate a user agent with a server, this can be generated through Dashboard within settings |

{% tabs %}
{% tab title="200 Domain is no longer managed by this account " %}

```
{
    "success": true
}
```

{% endtab %}

{% tab title="404 Domain not found " %}

```
{
    "errors": [
        "user not found"
    ]
}
```

{% endtab %}
{% endtabs %}
