Trip Templates
Templates are blueprints for recurring routes. They store all trip configuration except status and timestamps. Weight is a default suggestion only — users must confirm or change it every time a trip is created from a template.
Template Fields
| Field | Type | Description |
|---|---|---|
id | UUID | Template ID |
name | string | Template name |
description | string? | Optional description |
category_id | UUID? | Transport category |
origin_id | UUID? | Sender location |
destination_id | UUID? | Receiver location |
device_id | UUID? | Default GPS device |
gps_logging_enabled | bool | Whether GPS logging should be enabled by default |
default_weight_kg | float? | Pre-fill suggestion — user must confirm |
notes | string? | Free-text notes |
tags | string[] | Default tags |
No status, started_at, or ended_at — templates are blueprints, not active trips.
REST Endpoints
| Method | Path | Permission | Description |
|---|---|---|---|
| GET | /v1/trip-templates | trips:read | List templates |
| GET | /v1/trip-templates/{id} | trips:read | Get template |
| POST | /v1/trip-templates | trips:write | Create template |
| PATCH | /v1/trip-templates/{id} | trips:write | Update template |
| DELETE | /v1/trip-templates/{id} | trips:delete | Delete template |
| POST | /v1/trip-templates/{id}/create-trip | trips:write | Create trip from template |
GraphQL
tripTemplates(page, limit)→PaginatedTripTemplatestripTemplate(id)→GqlTripTemplatecreateTripTemplate(input)→GqlTripTemplateupdateTripTemplate(id, input)→GqlTripTemplatedeleteTripTemplate(id)→BooleancreateTripFromTemplate(templateId: String!, weightKg: Float!)→GqlTrip
Create Template
POST /v1/trip-templates
{
"name": "Mannheim → Köln (Schrott)",
"category_id": "<schrott-uuid>",
"origin_id": "<mannheim-uuid>",
"destination_id": "<koeln-uuid>",
"device_id": "<peplink-uuid>",
"gps_logging_enabled": true,
"default_weight_kg": 24000,
"tags": ["recurring", "rhein"]
}
Create Trip from Template
POST /v1/trip-templates/{id}/create-trip
{ "weight_kg": 23500 }
Or via GraphQL:
mutation {
createTripFromTemplate(templateId: "<id>", weightKg: 23500) {
id
name
status
weightKg
}
}
The created trip has status: "draft". weight_kg is required — even if the template has a default_weight_kg, the caller must explicitly pass the confirmed weight.
Using Templates
Templates can be used in two ways:
- From Templates page — Click "Use Template" on any template card, redirects to
/trips/create?template=ID - From Trip Create page — Select a template from the "Load from template" dropdown at the top of the form
When a template is loaded, all form fields are pre-filled (name, description, origin, destination, category, weight, GPS settings, device, tags, notes). The weight field is highlighted and required for confirmation.
Save as Template
On the trip create page, click "Save as Template" to save the current form values as a new template. The template name defaults to the trip name but is editable.
GraphQL Note
The tripTemplates query returns a flat Vec<GqlTripTemplate> (not paginated). The API route wraps the response in the standard { items, total, page, limit, has_more } format for frontend consistency.