> ## Documentation Index
> Fetch the complete documentation index at: https://developer.qminder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating a Line

> Create a new line (queue) within a location.

To create a line, send a POST request to `/v1/locations/{locationId}/lines`:

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://api.qminder.com/v1/locations/12345/lines \
    -H "X-Qminder-REST-API-Key: YOUR_API_KEY" \
    -H "X-Qminder-API-Version: 2020-09-01" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Customer Support",
      "color": "TEAL"
    }'
  ```

  ```typescript TypeScript theme={null}
  import { Qminder } from 'qminder-api';
  Qminder.setKey('YOUR_API_KEY');

  const response = await Qminder.Line.create(12345, {
    name: 'Customer Support',
    color: 'TEAL',
  });
  console.log(response.id);
  ```
</CodeGroup>

**Required fields:**

* `name` - Line name (max 30 characters)
* `color` - Line color. One of: `VIOLET`, `LAVENDER`, `MARSHMALLOW`, `TEAL`, `MINT`, `CORAL`, `YELLOW`, `ROSE`, `INDIGO`, `BLUE`

**Optional fields:**

* `disabled` - Whether the line starts disabled (default: `false`)
* `translations` - Name translations for multi-language support (see below)
* `appointmentSettings` - Appointment configuration (see below)

**Response (201 Created):**

```json theme={null}
{
  "id": "12345"
}
```

### Translations

You can provide name translations for multi-language support:

```json theme={null}
{
  "name": "Customer Support",
  "color": "TEAL",
  "translations": [
    { "languageCode": "fr", "name": "Service client" },
    { "languageCode": "es", "name": "Atención al cliente" }
  ]
}
```

Each translation object has:

* `languageCode` (string, required) - Language code (e.g. "fr", "es", "de")
* `name` (string, optional) - Translated line name (max 30 characters)

### Appointment Settings

You can enable appointments and set a default duration:

```json theme={null}
{
  "name": "Customer Support",
  "color": "TEAL",
  "appointmentSettings": {
    "enabled": true,
    "duration": 30
  }
}
```

* `enabled` (boolean, required) - Whether appointments are enabled for this line
* `duration` (integer, required) - Default appointment duration in minutes. Allowed values: `15`, `30`, `45`, `60`, `90`, `120`, `180`

### Error Responses

| Status | Description                           | Example                                                                                          |
| ------ | ------------------------------------- | ------------------------------------------------------------------------------------------------ |
| 400    | Name is blank                         | `{"code": "parameter_invalid_blank", "message": "...", "param": "name"}`                         |
| 400    | Name too long (>30 chars)             | `{"code": "parameter_invalid_size", "message": "...", "param": "name"}`                          |
| 400    | Invalid color name                    | `{"code": "parameter_invalid", "message": "...", "param": "color"}`                              |
| 400    | Invalid appointment duration          | `{"code": "parameter_invalid", "message": "...", "param": "appointmentSettings.duration"}`       |
| 400    | Language code is blank                | `{"code": "parameter_invalid_blank", "message": "...", "param": "translations[0].languageCode"}` |
| 400    | Translation name is blank             | `{"code": "parameter_invalid", "message": "...", "param": "translations[0].name"}`               |
| 400    | Translation name too long (>30 chars) | `{"code": "parameter_invalid_size", "message": "...", "param": "translations[0].name"}`          |
| 409    | Line with same name already exists    | Conflict error                                                                                   |
