> For the complete documentation index, see [llms.txt](https://developers.getafile.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.getafile.io/domains/create.md).

# Create a Domain

Create a new file serving Domain under your account.

**Please note:** Offensive domain names will be replaced with \*\*\*\*

<mark style="color:green;">`POST`</mark> `https://{region}.getafile.io/api/v1/teams/:team_id/domain`

This endpoint allows you to create a new Domain.

#### Path Parameters

| Name     | Type   | Description    |
| -------- | ------ | -------------- |
| team\_id | number | ID of the team |

#### Request Body

| Name                                                             | Type   | Description                                                                                       |
| ---------------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------- |
| domain<mark style="color:red;">\*</mark>                         | string | The Domain you wish to use: eg test.getafile.online                                               |
| name<mark style="color:red;">\*</mark>                           | string | Reference name for the Domain                                                                     |
| google\_analytics\_id\_consent<mark style="color:red;">\*</mark> | number | <p>Specify if this is your own domain, or a subdomain of getafile.online<br>1 = Yes<br>0 = No</p> |
| google\_analytics\_id                                            | string | The google analytics ID tied to the domain (required if google\_analytics\_id\_consent = 0)       |
| google\_analytics\_id\_secret                                    | string | The google analytics secret tied to the domain (required if google\_analytics\_id\_consent = 0)   |
| domaincustom                                                     | array  | An array of CustomDomain objects. See example request payload                                     |

{% tabs %}
{% tab title="201 Domain successfully created." %}

```json
{
    "name": "Testing",
    "domain": "testing.getafile.online",
    "google_analytics_id_consent": 0,
    "user_id": 1,
    "team_id": "8",
    "active": 1,
    "created_at": "2024-04-18T13:43:55.088+10:00",
    "updated_at": "2024-04-18T13:43:55.089+10:00",
    "id": 1,
    "domaincustom": [
        {
            "id": 1,
            "domain_id": 1,
            "custom_domain": "test.example.com",
            "resolved": 0,
            "setup": 0
        }
    ],
    "logo_uri": null,
    "favicon_uri": null
}
```

{% endtab %}

{% tab title="400 Error with JSON payload." %}

```json
{
    "errors": [
        {
            "message": "That domain is already in use",
            "rule": "domainCheck",
            "field": "domain"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

#### Example Request

```json
{
    "name": "Testing",
    "domain": "testing",
    "domaincustom": [
        {
            "custom_domain": "test.example.com"
        }
    ],
    "google_analytics_id_consent": 0
}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.getafile.io/domains/create.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
