Skip to content

Travel Orders

The Travel Order object

object

Attributes

idstring

Unique travel order identifier.

Other attributes
Examplejson
{
  "id": "tro_65f0c0ffee0000000000abcd",
  "entity_id": "ent_65f0c0ffee0000000000abcd",
  "number": "PN-2026-0001",
  "status": "draft",
  "date": "2026-09-17",
  "traveler_name": "Janez Novak",
  "traveler_position": "Vodja prodaje",
  "purpose": "Sestanek s stranko ABC d.o.o.",
  "origin": "Ljubljana",
  "destination": "Maribor",
  "trip_type": "domestic",
  "destination_country_code": null,
  "departure_at": "2026-09-18T05:00:00.000Z",
  "return_at": "2026-09-18T15:30:00.000Z",
  "transport": "own_vehicle",
  "vehicle_registration": "LJ AB-123",
  "distance_km": 280,
  "per_diem_enabled": true,
  "breakfasts_provided": 0,
  "foreign_daily_rate": null,
  "advance_amount": 50,
  "costs": [
    {
      "type": "parking",
      "description": "Parkirnina Maribor",
      "amount": 6.5,
      "date": "2026-09-18"
    }
  ],
  "note": null,
  "currency_code": "EUR",
  "calculation": {
    "duration_hours": 10.5,
    "per_diem": {
      "enabled": true,
      "full_days": 0,
      "remainder_hours": 10.5,
      "reference_rate": null,
      "periods": [
        {
          "index": 1,
          "hours": 10.5,
          "band": "over_8_to_12",
          "base_amount": 13.88,
          "breakfast_reduction_percent": 0,
          "breakfast_reduction": 0,
          "amount": 13.88
        }
      ],
      "total": 13.88
    },
    "mileage": {
      "applicable": true,
      "distance_km": 280,
      "rate": 0.43,
      "total": 120.4
    },
    "costs_total": 6.5,
    "total": 140.78,
    "advance_amount": 50,
    "amount_due": 90.78,
    "rates_source": "Uredba o davčni obravnavi povračil stroškov in drugih dohodkov iz delovnega razmerja (Uradni list RS, št. 140/06 – 162/22)"
  },
  "approved_at": null,
  "settled_at": null,
  "canceled_at": null,
  "created_at": "2026-09-17T09:00:00.000Z",
  "updated_at": "2026-09-17T09:00:00.000Z"
}

Create a travel order

POST/travel-orders

Creates a draft travel order for a Slovenian entity, assigns the next sequential number (PN-{yyyy}-{nnnn}), and computes per diem and mileage.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Body parameters

traveler_namestringrequired

Full name of the traveling employee or contractor.

purposestringrequired

Business purpose of the trip.

destinationstringrequired

Trip destination location.

departure_atstring<date-time>required

Departure date and time, ISO 8601 with UTC offset.

return_atstring<date-time>required

Return date and time, ISO 8601 with UTC offset. Must be after departure_at, and the trip must not exceed 60 days.

transportstringrequired

Mode of transport used for the trip. Mileage reimbursement only applies to own_vehicle.

Possible values: "own_vehicle", "company_vehicle", "public_transport", "other"

Other parameters
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.travelOrders.create({
  traveler_name: "Janez Novak",
  traveler_position: "Vodja prodaje",
  date: "2026-09-17",
  purpose: "Sestanek s stranko ABC d.o.o.",
  origin: "Ljubljana",
  destination: "Maribor",
  trip_type: "domestic",
  destination_country_code: null,
  departure_at: "2026-09-18T07:00:00+02:00",
  return_at: "2026-09-18T17:30:00+02:00",
  transport: "own_vehicle",
  vehicle_registration: "LJ AB-123",
  distance_km: 280,
  per_diem_enabled: true,
  breakfasts_provided: 0,
  foreign_daily_rate: null,
  advance_amount: 50,
  costs: [
    {
      type: "parking",
      description: "Parkirnina Maribor",
      amount: 6.5,
      date: "2026-09-18"
    }
  ],
  note: null
}, {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);
Example:

Returns

idstring

Unique travel order identifier.

Other parameters
json
{
  "id": "tro_65f0c0ffee0000000000abcd",
  "entity_id": "ent_65f0c0ffee0000000000abcd",
  "number": "PN-2026-0001",
  "status": "draft",
  "date": "2026-09-17",
  "traveler_name": "Janez Novak",
  "traveler_position": "Vodja prodaje",
  "purpose": "Sestanek s stranko ABC d.o.o.",
  "origin": "Ljubljana",
  "destination": "Maribor",
  "trip_type": "domestic",
  "destination_country_code": null,
  "departure_at": "2026-09-18T05:00:00.000Z",
  "return_at": "2026-09-18T15:30:00.000Z",
  "transport": "own_vehicle",
  "vehicle_registration": "LJ AB-123",
  "distance_km": 280,
  "per_diem_enabled": true,
  "breakfasts_provided": 0,
  "foreign_daily_rate": null,
  "advance_amount": 50,
  "costs": [
    {
      "type": "parking",
      "description": "Parkirnina Maribor",
      "amount": 6.5,
      "date": "2026-09-18"
    }
  ],
  "note": null,
  "currency_code": "EUR",
  "calculation": {
    "duration_hours": 10.5,
    "per_diem": {
      "enabled": true,
      "full_days": 0,
      "remainder_hours": 10.5,
      "reference_rate": null,
      "periods": [
        {
          "index": 1,
          "hours": 10.5,
          "band": "over_8_to_12",
          "base_amount": 13.88,
          "breakfast_reduction_percent": 0,
          "breakfast_reduction": 0,
          "amount": 13.88
        }
      ],
      "total": 13.88
    },
    "mileage": {
      "applicable": true,
      "distance_km": 280,
      "rate": 0.43,
      "total": 120.4
    },
    "costs_total": 6.5,
    "total": 140.78,
    "advance_amount": 50,
    "amount_due": 90.78,
    "rates_source": "Uredba o davčni obravnavi povračil stroškov in drugih dohodkov iz delovnega razmerja (Uradni list RS, št. 140/06 – 162/22)"
  },
  "approved_at": null,
  "settled_at": null,
  "canceled_at": null,
  "created_at": "2026-09-17T09:00:00.000Z",
  "updated_at": "2026-09-17T09:00:00.000Z"
}

List travel orders

GET/travel-orders

Cursor-paginated list of travel orders for the entity, newest first by date then created_at. Excludes deleted orders.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Query parameters

limitintegeroptional

Number of results per request.

Default: 10

next_cursorstringoptional

Opaque cursor to fetch the next page of results. Reuse only with the same effective ordering. Use the value from pagination.next_cursor in the previous response.

prev_cursorstringoptional

Opaque cursor to fetch the previous page of results. Reuse only with the same effective ordering. Use the value from pagination.prev_cursor in the previous response.

include_total_countbooleanoptional

Whether to include the total count of items in pagination.total.
Default is true.
When false, pagination.total returns -1 for better performance.

statusoptional

Filter by lifecycle status.

searchstringoptional

Full-text search query to filter results.
Searches are case-insensitive and match partial strings.
Searches across number, traveler name, purpose, origin, and destination.

import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.travelOrders.list({
  limit: 20,
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

dataarray of objects
paginationobject

Pagination metadata including cursors and result counts

json
{
  "data": [
    {
      "id": "tro_65f0c0ffee0000000000abcd",
      "entity_id": "ent_65f0c0ffee0000000000abcd",
      "number": "PN-2026-0001",
      "status": "draft",
      "date": "2026-09-17",
      "traveler_name": "Janez Novak",
      "traveler_position": "Vodja prodaje",
      "purpose": "Sestanek s stranko ABC d.o.o.",
      "origin": "Ljubljana",
      "destination": "Maribor",
      "trip_type": "domestic",
      "destination_country_code": null,
      "departure_at": "2026-09-18T05:00:00.000Z",
      "return_at": "2026-09-18T15:30:00.000Z",
      "transport": "own_vehicle",
      "vehicle_registration": "LJ AB-123",
      "distance_km": 280,
      "per_diem_enabled": true,
      "breakfasts_provided": 0,
      "foreign_daily_rate": null,
      "advance_amount": 50,
      "costs": [
        {
          "type": "parking",
          "description": "Parkirnina Maribor",
          "amount": 6.5,
          "date": "2026-09-18"
        }
      ],
      "note": null,
      "currency_code": "EUR",
      "calculation": {
        "duration_hours": 10.5,
        "per_diem": {
          "enabled": true,
          "full_days": 0,
          "remainder_hours": 10.5,
          "reference_rate": null,
          "periods": [
            {
              "index": 1,
              "hours": 10.5,
              "band": "over_8_to_12",
              "base_amount": 13.88,
              "breakfast_reduction_percent": 0,
              "breakfast_reduction": 0,
              "amount": 13.88
            }
          ],
          "total": 13.88
        },
        "mileage": {
          "applicable": true,
          "distance_km": 280,
          "rate": 0.43,
          "total": 120.4
        },
        "costs_total": 6.5,
        "total": 140.78,
        "advance_amount": 50,
        "amount_due": 90.78,
        "rates_source": "Uredba o davčni obravnavi povračil stroškov in drugih dohodkov iz delovnega razmerja (Uradni list RS, št. 140/06 – 162/22)"
      },
      "approved_at": null,
      "settled_at": null,
      "canceled_at": null,
      "created_at": "2026-09-17T09:00:00.000Z",
      "updated_at": "2026-09-17T09:00:00.000Z"
    }
  ],
  "pagination": {
    "total": 1,
    "next_cursor": null,
    "prev_cursor": null,
    "has_more": false
  }
}

Get a travel order

GET/travel-orders/{id}

Get a travel order

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

idstring<resource-id>required

Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.

import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.travelOrders.get('TRAVELORDERS_ID', {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

idstring

Unique travel order identifier.

Other parameters
json
{
  "id": "tro_65f0c0ffee0000000000abcd",
  "entity_id": "ent_65f0c0ffee0000000000abcd",
  "number": "PN-2026-0001",
  "status": "draft",
  "date": "2026-09-17",
  "traveler_name": "Janez Novak",
  "traveler_position": "Vodja prodaje",
  "purpose": "Sestanek s stranko ABC d.o.o.",
  "origin": "Ljubljana",
  "destination": "Maribor",
  "trip_type": "domestic",
  "destination_country_code": null,
  "departure_at": "2026-09-18T05:00:00.000Z",
  "return_at": "2026-09-18T15:30:00.000Z",
  "transport": "own_vehicle",
  "vehicle_registration": "LJ AB-123",
  "distance_km": 280,
  "per_diem_enabled": true,
  "breakfasts_provided": 0,
  "foreign_daily_rate": null,
  "advance_amount": 50,
  "costs": [
    {
      "type": "parking",
      "description": "Parkirnina Maribor",
      "amount": 6.5,
      "date": "2026-09-18"
    }
  ],
  "note": null,
  "currency_code": "EUR",
  "calculation": {
    "duration_hours": 10.5,
    "per_diem": {
      "enabled": true,
      "full_days": 0,
      "remainder_hours": 10.5,
      "reference_rate": null,
      "periods": [
        {
          "index": 1,
          "hours": 10.5,
          "band": "over_8_to_12",
          "base_amount": 13.88,
          "breakfast_reduction_percent": 0,
          "breakfast_reduction": 0,
          "amount": 13.88
        }
      ],
      "total": 13.88
    },
    "mileage": {
      "applicable": true,
      "distance_km": 280,
      "rate": 0.43,
      "total": 120.4
    },
    "costs_total": 6.5,
    "total": 140.78,
    "advance_amount": 50,
    "amount_due": 90.78,
    "rates_source": "Uredba o davčni obravnavi povračil stroškov in drugih dohodkov iz delovnega razmerja (Uradni list RS, št. 140/06 – 162/22)"
  },
  "approved_at": null,
  "settled_at": null,
  "canceled_at": null,
  "created_at": "2026-09-17T09:00:00.000Z",
  "updated_at": "2026-09-17T09:00:00.000Z"
}

Update a travel order

PATCH/travel-orders/{id}

Only draft or approved travel orders can be updated. The calculation is recomputed and stored on every successful update.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

idstring<resource-id>required

Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.

Body parameters

import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.travelOrders.update('TRAVELORDERS_ID', {
  distance_km: 300,
  advance_amount: 60
}, {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

idstring

Unique travel order identifier.

Other parameters
json
{
  "id": "tro_65f0c0ffee0000000000abcd",
  "entity_id": "ent_65f0c0ffee0000000000abcd",
  "number": "PN-2026-0001",
  "status": "draft",
  "date": "2026-09-17",
  "traveler_name": "Janez Novak",
  "traveler_position": "Vodja prodaje",
  "purpose": "Sestanek s stranko ABC d.o.o.",
  "origin": "Ljubljana",
  "destination": "Maribor",
  "trip_type": "domestic",
  "destination_country_code": null,
  "departure_at": "2026-09-18T05:00:00.000Z",
  "return_at": "2026-09-18T15:30:00.000Z",
  "transport": "own_vehicle",
  "vehicle_registration": "LJ AB-123",
  "distance_km": 300,
  "per_diem_enabled": true,
  "breakfasts_provided": 0,
  "foreign_daily_rate": null,
  "advance_amount": 60,
  "costs": [
    {
      "type": "parking",
      "description": "Parkirnina Maribor",
      "amount": 6.5,
      "date": "2026-09-18"
    }
  ],
  "note": null,
  "currency_code": "EUR",
  "calculation": {
    "duration_hours": 10.5,
    "per_diem": {
      "enabled": true,
      "full_days": 0,
      "remainder_hours": 10.5,
      "reference_rate": null,
      "periods": [
        {
          "index": 1,
          "hours": 10.5,
          "band": "over_8_to_12",
          "base_amount": 13.88,
          "breakfast_reduction_percent": 0,
          "breakfast_reduction": 0,
          "amount": 13.88
        }
      ],
      "total": 13.88
    },
    "mileage": {
      "applicable": true,
      "distance_km": 280,
      "rate": 0.43,
      "total": 120.4
    },
    "costs_total": 6.5,
    "total": 140.78,
    "advance_amount": 50,
    "amount_due": 90.78,
    "rates_source": "Uredba o davčni obravnavi povračil stroškov in drugih dohodkov iz delovnega razmerja (Uradni list RS, št. 140/06 – 162/22)"
  },
  "approved_at": null,
  "settled_at": null,
  "canceled_at": null,
  "created_at": "2026-09-17T09:00:00.000Z",
  "updated_at": "2026-09-17T09:00:00.000Z"
}

Delete a draft travel order

DELETE/travel-orders/{id}

Only draft travel orders can be deleted. Soft-deletes via deleted_at.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

idstring<resource-id>required

Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.

import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

await sdk.travelOrders.delete('TRAVELORDERS_ID', {
  entity_id: "YOUR_ENTITY_ID"
});

console.log('Deleted successfully');

Preview a travel order calculation

POST/travel-orders/preview

Validates and calculates per diem, mileage, and totals for the given body without persisting anything or consuming a document number.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Body parameters

traveler_namestringrequired

Full name of the traveling employee or contractor.

purposestringrequired

Business purpose of the trip.

destinationstringrequired

Trip destination location.

departure_atstring<date-time>required

Departure date and time, ISO 8601 with UTC offset.

return_atstring<date-time>required

Return date and time, ISO 8601 with UTC offset. Must be after departure_at, and the trip must not exceed 60 days.

transportstringrequired

Mode of transport used for the trip. Mileage reimbursement only applies to own_vehicle.

Possible values: "own_vehicle", "company_vehicle", "public_transport", "other"

Other parameters
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.travelOrders.preview({
  traveler_name: "Janez Novak",
  traveler_position: "Vodja prodaje",
  date: "2026-09-17",
  purpose: "Sestanek s stranko ABC d.o.o.",
  origin: "Ljubljana",
  destination: "Maribor",
  trip_type: "domestic",
  destination_country_code: null,
  departure_at: "2026-09-18T07:00:00+02:00",
  return_at: "2026-09-18T17:30:00+02:00",
  transport: "own_vehicle",
  vehicle_registration: "LJ AB-123",
  distance_km: 280,
  per_diem_enabled: true,
  breakfasts_provided: 0,
  foreign_daily_rate: null,
  advance_amount: 50,
  costs: [
    {
      type: "parking",
      description: "Parkirnina Maribor",
      amount: 6.5,
      date: "2026-09-18"
    }
  ],
  note: null
}, {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

json
{
  "duration_hours": 10.5,
  "per_diem": {
    "enabled": true,
    "full_days": 0,
    "remainder_hours": 10.5,
    "reference_rate": null,
    "periods": [
      {
        "index": 1,
        "hours": 10.5,
        "band": "over_8_to_12",
        "base_amount": 13.88,
        "breakfast_reduction_percent": 0,
        "breakfast_reduction": 0,
        "amount": 13.88
      }
    ],
    "total": 13.88
  },
  "mileage": {
    "applicable": true,
    "distance_km": 280,
    "rate": 0.43,
    "total": 120.4
  },
  "costs_total": 6.5,
  "total": 140.78,
  "advance_amount": 50,
  "amount_due": 90.78,
  "rates_source": "Uredba o davčni obravnavi povračil stroškov in drugih dohodkov iz delovnega razmerja (Uradni list RS, št. 140/06 – 162/22)"
}

Render a travel order preview

POST/travel-orders/render

Renders an HTML preview of a travel order from an unsaved draft body — the same shape as POST /travel-orders/preview — for live previews in the create/edit form. Validates and calculates per diem, mileage, and totals the same way POST /travel-orders/preview does (the same 422s apply), but returns the formatted document instead of the raw calculation. Nothing is persisted: no document number is consumed, and no activity is recorded. The number field shows a localized draft placeholder since an unsaved draft has no assigned sequence number.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Query parameters

localestringoptionalnullable

Locale for number and date formatting. When not specified, uses the entity's configured locale. Only Slovenian ('sl', 'sl-SI') resolves to Slovenian formatting; every other value resolves to English.

languagestringoptionalnullable

Language for document labels. When not specified, uses the same value as locale. Use this to get entity-locale formatting with different-language labels.

Body parameters

traveler_namestringrequired

Full name of the traveling employee or contractor.

purposestringrequired

Business purpose of the trip.

destinationstringrequired

Trip destination location.

departure_atstring<date-time>required

Departure date and time, ISO 8601 with UTC offset.

return_atstring<date-time>required

Return date and time, ISO 8601 with UTC offset. Must be after departure_at, and the trip must not exceed 60 days.

transportstringrequired

Mode of transport used for the trip. Mileage reimbursement only applies to own_vehicle.

Possible values: "own_vehicle", "company_vehicle", "public_transport", "other"

Other parameters
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.travelOrders.renderTravelOrderPreview({
  traveler_name: "Janez Novak",
  traveler_position: "Vodja prodaje",
  date: "2026-09-17",
  purpose: "Sestanek s stranko ABC d.o.o.",
  origin: "Ljubljana",
  destination: "Maribor",
  trip_type: "domestic",
  destination_country_code: null,
  departure_at: "2026-09-18T07:00:00+02:00",
  return_at: "2026-09-18T17:30:00+02:00",
  transport: "own_vehicle",
  vehicle_registration: "LJ AB-123",
  distance_km: 280,
  per_diem_enabled: true,
  breakfasts_provided: 0,
  foreign_daily_rate: null,
  advance_amount: 50,
  costs: [
    {
      type: "parking",
      description: "Parkirnina Maribor",
      amount: 6.5,
      date: "2026-09-18"
    }
  ],
  note: null
}, undefined, {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);
Example:

Approve a travel order

POST/travel-orders/{id}/approve

Transitions a draft travel order to approved and sets approved_at.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

idstring<resource-id>required

Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.

import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.travelOrders.approveTravelOrder('TRAVELORDERS_ID', {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

idstring

Unique travel order identifier.

Other parameters
json
{
  "id": "tro_65f0c0ffee0000000000abcd",
  "entity_id": "ent_65f0c0ffee0000000000abcd",
  "number": "PN-2026-0001",
  "status": "approved",
  "date": "2026-09-17",
  "traveler_name": "Janez Novak",
  "traveler_position": "Vodja prodaje",
  "purpose": "Sestanek s stranko ABC d.o.o.",
  "origin": "Ljubljana",
  "destination": "Maribor",
  "trip_type": "domestic",
  "destination_country_code": null,
  "departure_at": "2026-09-18T05:00:00.000Z",
  "return_at": "2026-09-18T15:30:00.000Z",
  "transport": "own_vehicle",
  "vehicle_registration": "LJ AB-123",
  "distance_km": 280,
  "per_diem_enabled": true,
  "breakfasts_provided": 0,
  "foreign_daily_rate": null,
  "advance_amount": 50,
  "costs": [
    {
      "type": "parking",
      "description": "Parkirnina Maribor",
      "amount": 6.5,
      "date": "2026-09-18"
    }
  ],
  "note": null,
  "currency_code": "EUR",
  "calculation": {
    "duration_hours": 10.5,
    "per_diem": {
      "enabled": true,
      "full_days": 0,
      "remainder_hours": 10.5,
      "reference_rate": null,
      "periods": [
        {
          "index": 1,
          "hours": 10.5,
          "band": "over_8_to_12",
          "base_amount": 13.88,
          "breakfast_reduction_percent": 0,
          "breakfast_reduction": 0,
          "amount": 13.88
        }
      ],
      "total": 13.88
    },
    "mileage": {
      "applicable": true,
      "distance_km": 280,
      "rate": 0.43,
      "total": 120.4
    },
    "costs_total": 6.5,
    "total": 140.78,
    "advance_amount": 50,
    "amount_due": 90.78,
    "rates_source": "Uredba o davčni obravnavi povračil stroškov in drugih dohodkov iz delovnega razmerja (Uradni list RS, št. 140/06 – 162/22)"
  },
  "approved_at": "2026-09-17T10:00:00.000Z",
  "settled_at": null,
  "canceled_at": null,
  "created_at": "2026-09-17T09:00:00.000Z",
  "updated_at": "2026-09-17T09:00:00.000Z"
}

Settle a travel order

POST/travel-orders/{id}/settle

Transitions an approved travel order to settled, recomputes the calculation one last time, and freezes it. Requires distance_km when transport is own_vehicle.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

idstring<resource-id>required

Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.

import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.travelOrders.settleTravelOrder('TRAVELORDERS_ID', {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

idstring

Unique travel order identifier.

Other parameters
json
{
  "id": "tro_65f0c0ffee0000000000abcd",
  "entity_id": "ent_65f0c0ffee0000000000abcd",
  "number": "PN-2026-0001",
  "status": "settled",
  "date": "2026-09-17",
  "traveler_name": "Janez Novak",
  "traveler_position": "Vodja prodaje",
  "purpose": "Sestanek s stranko ABC d.o.o.",
  "origin": "Ljubljana",
  "destination": "Maribor",
  "trip_type": "domestic",
  "destination_country_code": null,
  "departure_at": "2026-09-18T05:00:00.000Z",
  "return_at": "2026-09-18T15:30:00.000Z",
  "transport": "own_vehicle",
  "vehicle_registration": "LJ AB-123",
  "distance_km": 280,
  "per_diem_enabled": true,
  "breakfasts_provided": 0,
  "foreign_daily_rate": null,
  "advance_amount": 50,
  "costs": [
    {
      "type": "parking",
      "description": "Parkirnina Maribor",
      "amount": 6.5,
      "date": "2026-09-18"
    }
  ],
  "note": null,
  "currency_code": "EUR",
  "calculation": {
    "duration_hours": 10.5,
    "per_diem": {
      "enabled": true,
      "full_days": 0,
      "remainder_hours": 10.5,
      "reference_rate": null,
      "periods": [
        {
          "index": 1,
          "hours": 10.5,
          "band": "over_8_to_12",
          "base_amount": 13.88,
          "breakfast_reduction_percent": 0,
          "breakfast_reduction": 0,
          "amount": 13.88
        }
      ],
      "total": 13.88
    },
    "mileage": {
      "applicable": true,
      "distance_km": 280,
      "rate": 0.43,
      "total": 120.4
    },
    "costs_total": 6.5,
    "total": 140.78,
    "advance_amount": 50,
    "amount_due": 90.78,
    "rates_source": "Uredba o davčni obravnavi povračil stroškov in drugih dohodkov iz delovnega razmerja (Uradni list RS, št. 140/06 – 162/22)"
  },
  "approved_at": "2026-09-17T10:00:00.000Z",
  "settled_at": "2026-09-19T08:00:00.000Z",
  "canceled_at": null,
  "created_at": "2026-09-17T09:00:00.000Z",
  "updated_at": "2026-09-17T09:00:00.000Z"
}

Cancel a travel order

POST/travel-orders/{id}/cancel

Transitions a draft or approved travel order to canceled and sets canceled_at.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

idstring<resource-id>required

Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.

import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.travelOrders.cancelTravelOrder('TRAVELORDERS_ID', {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);

Returns

idstring

Unique travel order identifier.

Other parameters
json
{
  "id": "tro_65f0c0ffee0000000000abcd",
  "entity_id": "ent_65f0c0ffee0000000000abcd",
  "number": "PN-2026-0001",
  "status": "canceled",
  "date": "2026-09-17",
  "traveler_name": "Janez Novak",
  "traveler_position": "Vodja prodaje",
  "purpose": "Sestanek s stranko ABC d.o.o.",
  "origin": "Ljubljana",
  "destination": "Maribor",
  "trip_type": "domestic",
  "destination_country_code": null,
  "departure_at": "2026-09-18T05:00:00.000Z",
  "return_at": "2026-09-18T15:30:00.000Z",
  "transport": "own_vehicle",
  "vehicle_registration": "LJ AB-123",
  "distance_km": 280,
  "per_diem_enabled": true,
  "breakfasts_provided": 0,
  "foreign_daily_rate": null,
  "advance_amount": 50,
  "costs": [
    {
      "type": "parking",
      "description": "Parkirnina Maribor",
      "amount": 6.5,
      "date": "2026-09-18"
    }
  ],
  "note": null,
  "currency_code": "EUR",
  "calculation": {
    "duration_hours": 10.5,
    "per_diem": {
      "enabled": true,
      "full_days": 0,
      "remainder_hours": 10.5,
      "reference_rate": null,
      "periods": [
        {
          "index": 1,
          "hours": 10.5,
          "band": "over_8_to_12",
          "base_amount": 13.88,
          "breakfast_reduction_percent": 0,
          "breakfast_reduction": 0,
          "amount": 13.88
        }
      ],
      "total": 13.88
    },
    "mileage": {
      "applicable": true,
      "distance_km": 280,
      "rate": 0.43,
      "total": 120.4
    },
    "costs_total": 6.5,
    "total": 140.78,
    "advance_amount": 50,
    "amount_due": 90.78,
    "rates_source": "Uredba o davčni obravnavi povračil stroškov in drugih dohodkov iz delovnega razmerja (Uradni list RS, št. 140/06 – 162/22)"
  },
  "approved_at": null,
  "settled_at": null,
  "canceled_at": "2026-09-17T10:00:00.000Z",
  "created_at": "2026-09-17T09:00:00.000Z",
  "updated_at": "2026-09-17T09:00:00.000Z"
}

Download a travel order PDF

GET/travel-orders/{id}/pdf

Renders the travel order as a printable PDF (potni nalog), in Slovenian or English depending on the entity's locale. Cached; a hit is reported via the X-Pdf-Cache response header.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

idstring<resource-id>required

Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.

Query parameters

localestringoptionalnullable

Locale for number and date formatting. When not specified, uses the entity's configured locale. Only Slovenian ('sl', 'sl-SI') resolves to Slovenian formatting; every other value resolves to English.

languagestringoptionalnullable

Language for document labels. When not specified, uses the same value as locale. Use this to get entity-locale formatting with different-language labels.

import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const blob = await sdk.travelOrders.renderPdf('TRAVELORDERS_ID', undefined, {
  entity_id: "YOUR_ENTITY_ID"
});

const arrayBuffer = await blob.arrayBuffer();
const { writeFile } = await import('node:fs/promises');
await writeFile('download.bin', Buffer.from(arrayBuffer));
console.log('Saved download.bin');

Render a travel order as HTML

GET/travel-orders/{id}/html

Renders the travel order as an HTML fragment for in-app preview (same convention as the document render module's GET /documents/{id}/html), in Slovenian or English depending on the entity's locale. Supports conditional GET via ETag.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Path parameters

idstring<resource-id>required

Unique resource identifier. Prefix depends on the resource, for example inv_, cus_, or ent_.

Query parameters

localestringoptionalnullable

Locale for number and date formatting. When not specified, uses the entity's configured locale. Only Slovenian ('sl', 'sl-SI') resolves to Slovenian formatting; every other value resolves to English.

languagestringoptionalnullable

Language for document labels. When not specified, uses the same value as locale. Use this to get entity-locale formatting with different-language labels.

import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';

const sdk = new SpaceInvoices('YOUR_API_KEY');

const response = await sdk.travelOrders.renderHtml('TRAVELORDERS_ID', undefined, {
  entity_id: "YOUR_ENTITY_ID"
});

console.log(response);