# Template Parameters

Last updated:

<!-- -->

October 18, 2026

<!-- -->

\| 11 minutes read

<br />

<br />

The **Template Rest API** allows you to manage templates within the Fleet Management system. You can create, retrieve, update, and delete templates. This Rest API supports filtering, sorting, and pagination to help manage large datasets efficiently.

**Template Parameters** are used solely for **storing configuration data** as reusable templates. These templates can later be retrieved and applied to operations, enabling consistent and efficient reuse of pre-defined settings.

### Template Parameters Object Fields[​](#template-parameters-object-fields "Direct link to Template Parameters Object Fields")

| Field                          | Type    | Description                                                                                                                                 |
| ------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                           | Integer | Unique identifier for the template.                                                                                                         |
| `name`                         | String  | Name of the template.                                                                                                                       |
| `ignoreTimeWindow`             | Boolean | Whether to ignore the time window. Default: `false`.                                                                                        |
| `balancedRoutes`               | Boolean | Whether the routes should have a similar number of orders.                                                                                  |
| `optimizationCriterion`        | Integer | Optimization criterion:`0` - Distance`1` - Time (default)                                                                                   |
| `arrangeCriterion`             | Integer | Order arrangement criterion (used only if optimizing by distance):`0` - Matrix (default)`1` - Euclidean`2` - Exact Euclidean`3` - Manhattan |
| `optimizationQuality`          | Integer | Optimization quality:`0` - Unoptimized`1` - Fast`2` - Optimized (default)`3` - Best                                                         |
| `maxTimeToOptimize`            | Integer | Maximum time (seconds) for optimization (only used if optimization quality is Best). Default: `300`.                                        |
| `maxWaitTime`                  | Integer | Maximum wait time (seconds) before arriving at the next order. Default: `99999999`.                                                         |
| `routeType`                    | Integer | Route type:`0` - Round Route (default)`1` - End Anywhere`2` - Custom End                                                                    |
| `matrixBuiltType`              | Integer | Matrix build type:`0` - Set by user using "matrices" field`1` - Real road distances and times                                               |
| `restrictions`                 | Integer | Road restrictions:`0` - None (default)`1` - Tolls`2` - Highways                                                                             |
| `vehicleCategory`              | Integer | Vehicle category:`0` - None Electric (default)`1` - Electric                                                                                |
| `sameDepartureForAll`          | Boolean | Whether all routes share the same departure point. Default: `false`.                                                                        |
| `sameDestinationForAll`        | Boolean | Whether all routes share the same destination. Default: `false`.                                                                            |
| `sameVehicleConstraintsForAll` | Boolean | Whether all vehicles share the same constraints. Default: `false`.                                                                          |

***

## Endpoints[​](#endpoints "Direct link to Endpoints")

### 1. Create Template Parameters[​](#1-create-template-parameters "Direct link to 1. Create Template Parameters")

**Description:** Adds a new template to the database.

* **Base URL:** `https://api.magiclane.net/api/v1`

* **Endpoint:** `POST /fleetmanagement/templates`

* **Headers:**

  * `Authorization: YOUR_API_KEY`
  * `Content-Type: application/json`

* **Returned error codes:**

| Error Code                  | Description                               |
| --------------------------- | ----------------------------------------- |
| `200 Successful`            | Successful operation.                     |
| `400 Bad Request`           | Invalid input or missing required fields. |
| `401 Unauthorized`          | API key is missing or invalid.            |
| `405 Method Not Allowed`    | Incorrect method type.                    |
| `500 Internal Server Error` | Database error occurred.                  |

Note

If the operation is successful, the `Template Parameters` object will have its `id` field populated. If the operation fails, an error code is returned, which can be interpreted as described in the **Returned error codes** section.

#### Example:[​](#example "Direct link to Example:")

* **Request Body:**

- Schema View
- JSON Example
- JSON View

* `name`(

  <!-- -->

  string

  <!-- -->

  )

  Name of the template.

* `ignoreTimeWindow`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether to ignore the time window. Default: false.

* `balancedRoutes`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether the routes should have a similar number of orders.

* `optimizationCriterion`(

  <!-- -->

  integer

  <!-- -->

  )

  Optimization criterion:

  <br />

  `0` - Distance

  <br />

  `1` - Time (default)

* `arrangeCriterion`(

  <!-- -->

  integer

  <!-- -->

  )

  Order arrangement criterion (used only if optimizing by distance):

  <br />

  `0` - Matrix (default)

  <br />

  `1` - Euclidean

  <br />

  `2` - Exact Euclidean

  <br />

  `3` - Manhattan

* `optimizationQuality`(

  <!-- -->

  integer

  <!-- -->

  )

  Optimization quality:

  <br />

  `0` - Unoptimized

  <br />

  `1` - Fast

  <br />

  `2` - Optimized (default)

  <br />

  `3` - Best

* `maxTimeToOptimize`(

  <!-- -->

  integer

  <!-- -->

  )

  Maximum time (seconds) for optimization (only used if optimization quality is Best). Default: 300.

* `maxWaitTime`(

  <!-- -->

  integer

  <!-- -->

  )

  Maximum wait time (seconds) before arriving at the next order. Default: 99999999.

* `routeType`(

  <!-- -->

  integer

  <!-- -->

  )

  Route type:

  <br />

  `0` - Round Route (default)

  <br />

  `1` - End Anywhere

  <br />

  `2` - Custom End

* `matrixBuiltType`(

  <!-- -->

  integer

  <!-- -->

  )

  Matrix build type:

  <br />

  `0` - Set by user using "matrices" field

  <br />

  `1` - Real road distances and times

* `restrictions`(

  <!-- -->

  integer

  <!-- -->

  )

  Road restrictions:

  <br />

  `0` - None (default)

  <br />

  `1` - Tolls

  <br />

  `2` - Highways

* `vehicleCategory`(

  <!-- -->

  integer

  <!-- -->

  )

  Vehicle category:

  <br />

  `0` - None Electric (default)

  <br />

  `1` - Electric

* `sameDepartureForAll`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether all routes share the same departure point. Default: false.

* `sameDestinationForAll`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether all routes share the same destination. Default: false.

* `sameVehicleConstraintsForAll`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether all vehicles share the same constraints. Default: false.

```json
{
  "name": "Paris - test Optimization 50 vehicles in Berlin",
  "ignoreTimeWindow": false,
  "balancedRoutes": 0,
  "optimizationCriterion": 1,
  "arrangeCriterion": 0,
  "optimizationQuality": 2,
  "maxTimeToOptimize": 600,
  "maxWaitTime": 800,
  "routeType": 2,
  "matrixBuiltType": 1,
  "restrictions": 0,
  "vehicleCategory": 0,
  "sameDepartureForAll": false,
  "sameDestinationForAll": false,
  "sameVehicleConstraintsForAll": true
}

```

```json
{
  "name": "string",
  "ignoreTimeWindow": false,
  "balancedRoutes": 0,
  "optimizationCriterion": 0,
  "arrangeCriterion": 0,
  "optimizationQuality": 0,
  "maxTimeToOptimize": 0,
  "maxWaitTime": 0,
  "routeType": 0,
  "matrixBuiltType": 0,
  "restrictions": 0,
  "vehicleCategory": 0,
  "sameDepartureForAll": false,
  "sameDestinationForAll": false,
  "sameVehicleConstraintsForAll": false
}

```

* **Response Body:** (error code `200`)

- Schema View
- JSON Example
- JSON View

* ▶`templatesParameters`(

  <!-- -->

  array\[object]

  <!-- -->

  )

  List of template parameters objects.

```json
{
  "id": 87988,
  "name": "Paris - test Optimization 50 vehicles in Berlin",
  "ignoreTimeWindow": false,
  "balancedRoutes": 0,
  "optimizationCriterion": 1,
  "arrangeCriterion": 0,
  "optimizationQuality": 2,
  "maxTimeToOptimize": 600,
  "maxWaitTime": 800,
  "routeType": 2,
  "matrixBuiltType": 1,
  "restrictions": 0,
  "vehicleCategory": 0,
  "sameDepartureForAll": false,
  "sameDestinationForAll": false,
  "sameVehicleConstraintsForAll": true
}

```

```json
{
  "id": 0,
  "name": "string",
  "ignoreTimeWindow": false,
  "balancedRoutes": 0,
  "optimizationCriterion": 0,
  "arrangeCriterion": 0,
  "optimizationQuality": 0,
  "maxTimeToOptimize": 0,
  "maxWaitTime": 0,
  "routeType": 0,
  "matrixBuiltType": 0,
  "restrictions": 0,
  "vehicleCategory": 0,
  "sameDepartureForAll": false,
  "sameDestinationForAll": false,
  "sameVehicleConstraintsForAll": false
}

```

***

### 2. Get All Templates Parameters[​](#2-get-all-templates-parameters "Direct link to 2. Get All Templates Parameters")

**Description:** Fetches a list of all templates with optional filtering.

* **Base URL:** `https://api.magiclane.net/api/v1`

* **Endpoint:** `GET /fleetmanagement/templates`

* **Headers:**
  * `Authorization: YOUR_API_KEY`

* **Query Parameters:**

  * `search` (string, *optional*) – General search term across optimizations.
  * `id` (string, *optional*) – Filter by optimization ID (`id=value:exact` for exact match).
  * `name` (string, *optional*) – Filter by optimization name (`name=value:exact` for exact match).
  * `creationTime` (string, *optional*) – Filter by creation time (`creationTime=value:exact` for exact match).
  * `ignoreTimeWindow` (string, *optional*) – Filter optimizations that ignore time windows (`ignoreTimeWindow=value:exact` for exact match).
  * `balancedRoutes` (string, *optional*) – Determines if routes have a similar number of orders.
  * `routeType` (string, *optional*) – Filter by route type (`routeType=value`).
  * `vehicleCategory` (string, *optional*) – Filter by vehicle type (electric or non-electric).
  * `sameVehicleConstraints` (string, *optional*) – Determines if only one vehicle constraint will be used for all vehicles.
  * `sameDeparture` (string, *optional*) – Determines if all routes start from the same departure point.
  * `sameDestination` (string, *optional*) – Determines if all routes end at the same destination.
  * `sort` (string, *optional*) – Sorting format: – Sorting format: `column1:asc/desc,column2:asc/desc`
    * Available columns: `id, name, creationTime, ignoreTimeWindow, optimizeBy, optimizationQuality, maxOptimizeTime, routeType, matricesBuildType, restrictions, maxWaitTimeOrders, arrangeCriterion, balancedRoutes`
  * `page` (integer, *optional*) – Page number for pagination.
  * `per_page` (integer, *optional*) – Number of items per page.

* **Returned error codes:**

| Error Code                  | Description                               |
| --------------------------- | ----------------------------------------- |
| `200 Successful`            | Successful operation.                     |
| `400 Bad Request`           | Invalid input or missing required fields. |
| `401 Unauthorized`          | API key is missing or invalid.            |
| `405 Method Not Allowed`    | Incorrect method type.                    |
| `500 Internal Server Error` | Database error occurred.                  |

#### Example:[​](#example-1 "Direct link to Example:")

* **Response Body:** (error code `200`)

- Schema View
- JSON Example
- JSON View

* ▶`templatesParameters`(

  <!-- -->

  array\[object]

  <!-- -->

  )

  List of template parameters objects.

```json
{
  "templatesParameters": [
    {
      "id": 87987,
      "name": "Paris - test Optimization 50 vehicles in Berlin",
      "ignoreTimeWindow": false,
      "balancedRoutes": 0,
      "optimizationCriterion": 1,
      "arrangeCriterion": 0,
      "optimizationQuality": 2,
      "maxTimeToOptimize": 600,
      "maxWaitTime": 800,
      "routeType": 2,
      "matrixBuiltType": 1,
      "restrictions": 0,
      "vehicleCategory": 0,
      "sameDepartureForAll": false,
      "sameDestinationForAll": false,
      "sameVehicleConstraintsForAll": true
    },
    {
      "id": 87988,
      "name": "Paris - test Optimization 25 vehicles in Berlin",
      "ignoreTimeWindow": false,
      "balancedRoutes": 0,
      "optimizationCriterion": 1,
      "arrangeCriterion": 0,
      "optimizationQuality": 2,
      "maxTimeToOptimize": 600,
      "maxWaitTime": 800,
      "routeType": 2,
      "matrixBuiltType": 1,
      "restrictions": 0,
      "vehicleCategory": 0,
      "sameDepartureForAll": false,
      "sameDestinationForAll": false,
      "sameVehicleConstraintsForAll": true
    }
  ]
}

```

```json
{
  "templatesParameters": [
    {
      "id": 0,
      "name": "string",
      "ignoreTimeWindow": false,
      "balancedRoutes": 0,
      "optimizationCriterion": 0,
      "arrangeCriterion": 0,
      "optimizationQuality": 0,
      "maxTimeToOptimize": 0,
      "maxWaitTime": 0,
      "routeType": 0,
      "matrixBuiltType": 0,
      "restrictions": 0,
      "vehicleCategory": 0,
      "sameDepartureForAll": false,
      "sameDestinationForAll": false,
      "sameVehicleConstraintsForAll": false
    }
  ]
}

```

***

### 3. Get a Template Parameters by ID[​](#3-get-a-template-parameters-by-id "Direct link to 3. Get a Template Parameters by ID")

**Description:** Retrieves a specific template by ID.

* **Base URL:** `https://api.magiclane.net/api/v1`
* **Endpoint:** `GET /fleetmanagement/templates/{id}`
* **Headers:**
  * `Authorization: YOUR_API_KEY`
* **Path Parameter:**
  * `id` (integer, \**required*) - The unique template ID.
* **Returned error codes:**

| Error Code                  | Description                               |
| --------------------------- | ----------------------------------------- |
| `200 Successful`            | Successful operation.                     |
| `400 Bad Request`           | Invalid input or missing required fields. |
| `401 Unauthorized`          | API key is missing or invalid.            |
| `404 Not Found`             | Template not found in database.           |
| `405 Method Not Allowed`    | Incorrect method type.                    |
| `500 Internal Server Error` | Database error occurred.                  |

#### Example:[​](#example-2 "Direct link to Example:")

* **Response Body:** (error code `200`)

- Schema View
- JSON Example
- JSON View

* `id`(

  <!-- -->

  integer

  <!-- -->

  )

  Unique identifier for the template.

* `name`(

  <!-- -->

  string

  <!-- -->

  )

  Name of the template.

* `ignoreTimeWindow`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether to ignore the time window. Default: false.

* `balancedRoutes`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether the routes should have a similar number of orders.

* `optimizationCriterion`(

  <!-- -->

  integer

  <!-- -->

  )

  Optimization criterion:

  <br />

  `0` - Distance

  <br />

  `1` - Time (default)

* `arrangeCriterion`(

  <!-- -->

  integer

  <!-- -->

  )

  Order arrangement criterion (used only if optimizing by distance):

  <br />

  `0` - Matrix (default)

  <br />

  `1` - Euclidean

  <br />

  `2` - Exact Euclidean

  <br />

  `3` - Manhattan

* `optimizationQuality`(

  <!-- -->

  integer

  <!-- -->

  )

  Optimization quality:

  <br />

  `0` - Unoptimized

  <br />

  `1` - Fast

  <br />

  `2` - Optimized (default)

  <br />

  `3` - Best

* `maxTimeToOptimize`(

  <!-- -->

  integer

  <!-- -->

  )

  Maximum time (seconds) for optimization (only used if optimization quality is Best). Default: 300.

* `maxWaitTime`(

  <!-- -->

  integer

  <!-- -->

  )

  Maximum wait time (seconds) before arriving at the next order. Default: 99999999.

* `routeType`(

  <!-- -->

  integer

  <!-- -->

  )

  Route type:

  <br />

  `0` - Round Route (default)

  <br />

  `1` - End Anywhere

  <br />

  `2` - Custom End

* `matrixBuiltType`(

  <!-- -->

  integer

  <!-- -->

  )

  Matrix build type:

  <br />

  `0` - Set by user using "matrices" field

  <br />

  `1` - Real road distances and times

* `restrictions`(

  <!-- -->

  integer

  <!-- -->

  )

  Road restrictions:

  <br />

  `0` - None (default)

  <br />

  `1` - Tolls

  <br />

  `2` - Highways

* `vehicleCategory`(

  <!-- -->

  integer

  <!-- -->

  )

  Vehicle category:

  <br />

  `0` - None Electric (default)

  <br />

  `1` - Electric

* `sameDepartureForAll`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether all routes share the same departure point. Default: false.

* `sameDestinationForAll`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether all routes share the same destination. Default: false.

* `sameVehicleConstraintsForAll`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether all vehicles share the same constraints. Default: false.

```json
{
  "id": 87988,
  "name": "Paris - test Optimization 50 vehicles in Berlin",
  "ignoreTimeWindow": false,
  "balancedRoutes": 0,
  "optimizationCriterion": 1,
  "arrangeCriterion": 0,
  "optimizationQuality": 2,
  "maxTimeToOptimize": 600,
  "maxWaitTime": 800,
  "routeType": 2,
  "matrixBuiltType": 1,
  "restrictions": 0,
  "vehicleCategory": 0,
  "sameDepartureForAll": false,
  "sameDestinationForAll": false,
  "sameVehicleConstraintsForAll": true
}

```

```json
{
  "id": 0,
  "name": "string",
  "ignoreTimeWindow": false,
  "balancedRoutes": 0,
  "optimizationCriterion": 0,
  "arrangeCriterion": 0,
  "optimizationQuality": 0,
  "maxTimeToOptimize": 0,
  "maxWaitTime": 0,
  "routeType": 0,
  "matrixBuiltType": 0,
  "restrictions": 0,
  "vehicleCategory": 0,
  "sameDepartureForAll": false,
  "sameDestinationForAll": false,
  "sameVehicleConstraintsForAll": false
}

```

***

### 4. Update a Template Parameters[​](#4-update-a-template-parameters "Direct link to 4. Update a Template Parameters")

**Description:** Updates an existing template record.

* **Base URL:** `https://api.magiclane.net/api/v1`

* **Endpoint:** `PUT /fleetmanagement/templates/{id}`

* **Headers:**

  * `Authorization: YOUR_API_KEY`
  * `Content-Type: application/json`

* **Path Parameter:**
  * `id` (integer, \**required*) - The unique template ID.

* **Returned error codes:**

| Error Code                  | Description                               |
| --------------------------- | ----------------------------------------- |
| `200 Successful`            | Successful operation.                     |
| `400 Bad Request`           | Invalid input or missing required fields. |
| `401 Unauthorized`          | API key is missing or invalid.            |
| `404 Not Found`             | Template not found in database.           |
| `405 Method Not Allowed`    | Incorrect method type.                    |
| `500 Internal Server Error` | Database error occurred.                  |

#### Example:[​](#example-3 "Direct link to Example:")

* **Request Body:**

- Schema View
- JSON Example
- JSON View

* `id`(

  <!-- -->

  integer

  <!-- -->

  )

  Unique identifier for the template.

* `name`(

  <!-- -->

  string

  <!-- -->

  )

  Name of the template.

* `ignoreTimeWindow`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether to ignore the time window. Default: false.

* `balancedRoutes`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether the routes should have a similar number of orders.

* `optimizationCriterion`(

  <!-- -->

  integer

  <!-- -->

  )

  Optimization criterion:

  <br />

  `0` - Distance

  <br />

  `1` - Time (default)

* `arrangeCriterion`(

  <!-- -->

  integer

  <!-- -->

  )

  Order arrangement criterion (used only if optimizing by distance):

  <br />

  `0` - Matrix (default)

  <br />

  `1` - Euclidean

  <br />

  `2` - Exact Euclidean

  <br />

  `3` - Manhattan

* `optimizationQuality`(

  <!-- -->

  integer

  <!-- -->

  )

  Optimization quality:

  <br />

  `0` - Unoptimized

  <br />

  `1` - Fast

  <br />

  `2` - Optimized (default)

  <br />

  `3` - Best

* `maxTimeToOptimize`(

  <!-- -->

  integer

  <!-- -->

  )

  Maximum time (seconds) for optimization (only used if optimization quality is Best). Default: 300.

* `maxWaitTime`(

  <!-- -->

  integer

  <!-- -->

  )

  Maximum wait time (seconds) before arriving at the next order. Default: 99999999.

* `routeType`(

  <!-- -->

  integer

  <!-- -->

  )

  Route type:

  <br />

  `0` - Round Route (default)

  <br />

  `1` - End Anywhere

  <br />

  `2` - Custom End

* `matrixBuiltType`(

  <!-- -->

  integer

  <!-- -->

  )

  Matrix build type:

  <br />

  `0` - Set by user using "matrices" field

  <br />

  `1` - Real road distances and times

* `restrictions`(

  <!-- -->

  integer

  <!-- -->

  )

  Road restrictions:

  <br />

  `0` - None (default)

  <br />

  `1` - Tolls

  <br />

  `2` - Highways

* `vehicleCategory`(

  <!-- -->

  integer

  <!-- -->

  )

  Vehicle category:

  <br />

  `0` - None Electric (default)

  <br />

  `1` - Electric

* `sameDepartureForAll`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether all routes share the same departure point. Default: false.

* `sameDestinationForAll`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether all routes share the same destination. Default: false.

* `sameVehicleConstraintsForAll`(

  <!-- -->

  boolean

  <!-- -->

  )

  Whether all vehicles share the same constraints. Default: false.

```json
{
  "id": 87988,
  "name": "Paris - test Optimization 50 vehicles in Berlin",
  "ignoreTimeWindow": false,
  "balancedRoutes": 0,
  "optimizationCriterion": 1,
  "arrangeCriterion": 0,
  "optimizationQuality": 2,
  "maxTimeToOptimize": 600,
  "maxWaitTime": 800,
  "routeType": 2,
  "matrixBuiltType": 1,
  "restrictions": 0,
  "vehicleCategory": 0,
  "sameDepartureForAll": false,
  "sameDestinationForAll": false,
  "sameVehicleConstraintsForAll": true
}

```

```json
{
  "id": 0,
  "name": "string",
  "ignoreTimeWindow": false,
  "balancedRoutes": 0,
  "optimizationCriterion": 0,
  "arrangeCriterion": 0,
  "optimizationQuality": 0,
  "maxTimeToOptimize": 0,
  "maxWaitTime": 0,
  "routeType": 0,
  "matrixBuiltType": 0,
  "restrictions": 0,
  "vehicleCategory": 0,
  "sameDepartureForAll": false,
  "sameDestinationForAll": false,
  "sameVehicleConstraintsForAll": false
}

```

* **Response Body:** (error code `200`)

```json
{
  "message": "Operation done successfully"
}

```

***

### 5. Delete Templates Parameters[​](#5-delete-templates-parameters "Direct link to 5. Delete Templates Parameters")

**Description:** Deletes templates from the system.

* **Base URL:** `https://api.magiclane.net/api/v1`
* **Endpoint:** `DELETE /fleetmanagement/templates`
* **Headers:**
  * `Authorization: YOUR_API_KEY`
* **Returned error codes:**

| Error Code                  | Description                                                                   |
| --------------------------- | ----------------------------------------------------------------------------- |
| `200 Successful`            | Successful operation.                                                         |
| `400 Bad Request`           | Invalid input or missing required fields.                                     |
| `401 Unauthorized`          | API key is missing or invalid.                                                |
| `404 Not Found`             | Can't delete template parameters because at least one of them does not exist. |
| `405 Method Not Allowed`    | Incorrect method type.                                                        |
| `500 Internal Server Error` | Database error occurred.                                                      |

#### Example:[​](#example-4 "Direct link to Example:")

* **Request Body:**

```json
{
  "ids": [101, 102]
}

```

* **Response Body:** (error code `200`)

```json
{
 "message": "Operation done successfully"
}

```

***
