## Create a project type (desk:admin)

`POST /api/desk/v1/project-types`

Module: Desk · operationId: `createProjectType` · Tag: Projects · Auth: access token (`Authorization: Bearer <accessToken>`)

Project types come with the bootstrap (`projectTypes`). Their workflow must be a workflow of scope `project`.

### Request body

`application/json` (required)

- `key` (string, required): Lower-case letters, digits, - or _; fixed
- `name` (string, required): Name of the project type (max length 200)
- `workflowId` (string, required): A workflow of scope project
- `archived` (boolean): Archived: the project type is kept for existing data but no longer offered in pickers
- `color` (string): Display color of the project type
- `description` (string): Description of the project type
- `icon` (string): Icon of the project type
- `id` (string, read-only): Id of the project type
- `layout` (array of LayoutField): Custom fields ("cf.<key>") of the project record; sections facts, main, aside
  - `key` (string, required): System field (priority, dueAt, customer, …) or "cf.<key>"
  - `required` (boolean): The field must be filled
  - `section` (string): Section of the record page the field is shown in (one of `facts`, `main`, `aside`, `closure`)
- `settings` (object): Settings of the project type
  - `billing` (object): Project billing
    - `autoDraft` (boolean): Request a payment (hand its draft to trade) as soon as it is due; default off
    - `hourUnit` (string): No longer used: hourly billing is HR's (ADR 0040); ignored on write and no longer returned (max length 20)
    - `taxRate` (number): VAT rate of new payments (default 19) (max 100)
    - `unit` (string): Unit of the payment invoice lines (default Pauschal) (max length 20)
  - `taskSpaceId` (string): Space template tasks are created in (id or key on input)
  - `taskTypeId` (string): Item type of template tasks that name none (id or key on input)
- `sortOrder` (integer): Position in lists (ascending)
- `version` (integer): Version of the project type; send it back on change (409 version_conflict when it is outdated)

Example:

```json
{
  "archived": false,
  "color": "primary",
  "description": "Projekt mit Meilensteinen, Zeitplan und Abrechnung nach Zahlungsplan",
  "icon": "i-lucide-briefcase",
  "id": "6e3f4a5b-7c8d-4e9f-8a1b-3c4d5e6f7a01",
  "key": "kundenprojekt",
  "layout": [
    {
      "key": "cf.auftragsnummer",
      "section": "facts"
    },
    {
      "key": "cf.ansprechpartner_kunde",
      "section": "facts"
    }
  ],
  "name": "Kundenprojekt",
  "settings": {
    "billing": {
      "autoDraft": false,
      "taxRate": 19,
      "unit": "Pauschal"
    },
    "taskSpaceId": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7d00",
    "taskTypeId": "5d2e3f4a-6b7c-4d8e-9f0a-2b3c4d5e6f07"
  },
  "sortOrder": 1,
  "version": 1,
  "workflowId": "4c1d2e3f-5a6b-4c7d-8e9f-1a2b3c4d5e03"
}
```

### Responses

- **201** Project type (`application/json`)

Fields of the 201 answer:

- `key` (string, required): Lower-case letters, digits, - or _; fixed
- `name` (string, required): Name of the project type (max length 200)
- `workflowId` (string, required): A workflow of scope project
- `archived` (boolean): Archived: the project type is kept for existing data but no longer offered in pickers
- `color` (string): Display color of the project type
- `description` (string): Description of the project type
- `icon` (string): Icon of the project type
- `id` (string, read-only): Id of the project type
- `layout` (array of LayoutField): Custom fields ("cf.<key>") of the project record; sections facts, main, aside
  - `key` (string, required): System field (priority, dueAt, customer, …) or "cf.<key>"
  - `required` (boolean): The field must be filled
  - `section` (string): Section of the record page the field is shown in (one of `facts`, `main`, `aside`, `closure`)
- `settings` (object): Settings of the project type
  - `billing` (object): Project billing
    - `autoDraft` (boolean): Request a payment (hand its draft to trade) as soon as it is due; default off
    - `hourUnit` (string): No longer used: hourly billing is HR's (ADR 0040); ignored on write and no longer returned (max length 20)
    - `taxRate` (number): VAT rate of new payments (default 19) (max 100)
    - `unit` (string): Unit of the payment invoice lines (default Pauschal) (max length 20)
  - `taskSpaceId` (string): Space template tasks are created in (id or key on input)
  - `taskTypeId` (string): Item type of template tasks that name none (id or key on input)
- `sortOrder` (integer): Position in lists (ascending)
- `version` (integer): Version of the project type; send it back on change (409 version_conflict when it is outdated)

Example 201 answer:

```json
{
  "archived": false,
  "color": "primary",
  "description": "Projekt mit Meilensteinen, Zeitplan und Abrechnung nach Zahlungsplan",
  "icon": "i-lucide-briefcase",
  "id": "6e3f4a5b-7c8d-4e9f-8a1b-3c4d5e6f7a01",
  "key": "kundenprojekt",
  "layout": [
    {
      "key": "cf.auftragsnummer",
      "section": "facts"
    },
    {
      "key": "cf.ansprechpartner_kunde",
      "section": "facts"
    }
  ],
  "name": "Kundenprojekt",
  "settings": {
    "billing": {
      "autoDraft": false,
      "taxRate": 19,
      "unit": "Pauschal"
    },
    "taskSpaceId": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7d00",
    "taskTypeId": "5d2e3f4a-6b7c-4d8e-9f0a-2b3c4d5e6f07"
  },
  "sortOrder": 1,
  "version": 1,
  "workflowId": "4c1d2e3f-5a6b-4c7d-8e9f-1a2b3c4d5e03"
}
```

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/desk/v1/project-types' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"archived":false,"color":"primary","description":"Projekt mit Meilensteinen, Zeitplan und Abrechnung nach Zahlungsplan","icon":"i-lucide-briefcase","id":"6e3f4a5b-7c8d-4e9f-8a1b-3c4d5e6f7a01","key":"kundenprojekt","layout":[{"key":"cf.auftragsnummer","section":"facts"},{"key":"cf.ansprechpartner_kunde","section":"facts"}],"name":"Kundenprojekt","settings":{"billing":{"autoDraft":false,"taxRate":19,"unit":"Pauschal"},"taskSpaceId":"9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7d00","taskTypeId":"5d2e3f4a-6b7c-4d8e-9f0a-2b3c4d5e6f07"},"sortOrder":1,"version":1,"workflowId":"4c1d2e3f-5a6b-4c7d-8e9f-1a2b3c4d5e03"}'
```
