Returns the list of short domains available to your account. The values from this list are what belongs in the `url_type` parameter when [shortening a link](https://www.bulkgate.com/en/docs/shortener/shortener-shorten/).

## API URL

The URL used to send the HTTP requests:

```url
https://portal.bulkgate.com/api/1.0/shortener/domains
```

> [!NOTE]
> If the request does not reach its destination, repeat it on the [backup server](https://www.bulkgate.com/en/docs/api-administration-tokens/api-backup-server/) `backup1.bulkgate.com`.

## Supported HTTP methods

- `POST` - `application/json`

```http
POST /api/1.0/shortener/domains HTTP/1.1
Host: portal.bulkgate.com
Content-Type: application/json
```

> [!NOTE]
> The API has a quota of `20` requests per minute.

## Parameters table

| PARAMETER NAME    | VALUE                                                                          | MANDATORY | DEFAULT VALUE |
|:------------------|:---------------------------------------------------------------------------------|:----------|:--------------|
| application_id    | [Application ID](https://www.bulkgate.com/en/docs/api-administration-tokens/api-administration/)                                  | **Yes**   | -             | 
| application_token | [Application authentication token](https://www.bulkgate.com/en/docs/api-administration-tokens/api-tokens/)	                      | **Yes**   | -             |
| variant           | Shape of the response - `list`, `key_value` or `label_value`, see [Response shapes](#response-shapes) | No        | `list`        |

### Response shapes

All three variants carry the same domains and differ only in structure - pick the one your form consumes directly.

| VALUE         | SHAPE OF `data`                                          |
|:--------------|:-----------------------------------------------------------|
| `list`        | An array of strings.                                       |
| `key_value`   | An object where both the key and the value is the domain.  |
| `label_value` | An array of `{"label": …, "value": …}` objects.            |

> [!NOTE]
> The list is not the same for every account. It also contains your [own domains](https://www.bulkgate.com/en/helpdesk/campaign/url-shortener/) if you have any, and those come first - the first domain in the list is also the one `shorten` uses when you omit `url_type`.

## Request example

```http-json
POST /api/1.0/shortener/domains HTTP/1.1
Host: portal.bulkgate.com
Content-Type: application/json

{
  "application_id": 451,
  "application_token": "NKN02TWE6NfBkfl-your-secret-token-Wf05GaqLIWLW4aBj",
  "variant": "list"
}
```

## Response

**In case of success:**

```json
{
    "data": [
        "ur7.wf",
        "ms6.fr",
        "ur7.yt",
        "ur7.tf",
        "ms6.wf",
        "ms6.tf",
        "track-message.com"
    ]
}
```

The same list in the `key_value` variant:

```json
{
    "data": {
        "ur7.wf": "ur7.wf",
        "ms6.fr": "ms6.fr"
    }
}
```

And in the `label_value` variant:

```json
{
    "data": [
        {"label": "ur7.wf", "value": "ur7.wf"},
        {"label": "ms6.fr", "value": "ms6.fr"}
    ]
}
```

**In case of error:**

```json
{
    "type": "the_per_minute_quota_has_been_exceeded",
    "code": 400,
    "error": "The per minute quota has been exceeded",
    "detail": null
}
```

Where:

- **type** and **error** (description of the error) can be found in the [error types table](https://www.bulkgate.com/en/docs/api-administration-tokens/api-error-types/)
- **code** is the HTTP error code
- **detail** is additional information about the error

### Shortener API error types

Besides the [general types](https://www.bulkgate.com/en/docs/api-administration-tokens/api-error-types/), this endpoint returns its own:

| TYPE                                    | WHEN IT HAPPENS                                                        |
|:----------------------------------------|:-----------------------------------------------------------------------|
| `the_per_minute_quota_has_been_exceeded`| The quota of 20 requests per minute is used up.                        |
