{
  "openapi": "3.1.0",
  "info": {
    "title": "GPS Tracs API",
    "version": "24 November 2026",
    "description": "Objects and live positions, position history, trips, alerts, geofences, drivers and tasks. The human-readable reference, with webhooks, is at https://gpstracs.com/developers.html. Answers may carry fields that are not described here: do not rely on them.",
    "contact": {
      "email": "support@gpstracs.com",
      "url": "https://gpstracs.com/developers.html"
    }
  },
  "servers": [
    {
      "url": "https://track.gpstracs.com"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Account"
    },
    {
      "name": "Objects and positions",
      "description": "An object is anything on the map: a vehicle or an asset with a tracker, or a phone that reports during a shift."
    },
    {
      "name": "Alerts",
      "description": "To be told the moment an alert fires, use a webhook. To catch up or to check you missed nothing, read them here."
    },
    {
      "name": "Places and drivers"
    },
    {
      "name": "Tasks",
      "description": "A task is a job for one object: a delivery, a visit, a pick-up. It appears in the driver's or field worker's app, and its status changes as they work. Tasks need a plan that includes them."
    }
  ],
  "paths": {
    "/api/v2/me": {
      "get": {
        "operationId": "me",
        "tags": [
          "Account"
        ],
        "summary": "The account behind a key",
        "description": "Says which account a key belongs to. Call it first: if it answers, the key works.",
        "responses": {
          "200": {
            "description": "It worked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "description": "1 when the call worked."
                    },
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "description": "The account."
                        },
                        "email": {
                          "type": "string",
                          "description": "The owner's sign-in address."
                        },
                        "account_email": {
                          "type": "string",
                          "description": "The same address: the account the data belongs to."
                        },
                        "role": {
                          "type": "string",
                          "description": "Always owner for a key."
                        },
                        "lang": {
                          "type": "string",
                          "description": "The account's language, for example en."
                        },
                        "unit_of_distance": {
                          "type": "string",
                          "description": "km or mi. Speeds in history are km/h or mph accordingly."
                        },
                        "unit_of_altitude": {
                          "type": "string",
                          "description": "The account's unit for altitude."
                        },
                        "expired": {
                          "type": "boolean",
                          "description": "True when the subscription has run out: other calls then answer 402."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": 1,
                  "user": {
                    "id": 7,
                    "email": "owner@example.com",
                    "account_email": "owner@example.com",
                    "role": "owner",
                    "lang": "en",
                    "unit_of_distance": "km",
                    "unit_of_altitude": "mt",
                    "expired": false
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/api/v2/devices": {
      "get": {
        "operationId": "objectsList",
        "tags": [
          "Objects and positions"
        ],
        "summary": "Every object, with where it is now",
        "description": "All objects of the account with their latest position. Poll it for a live view: every 10 to 30 seconds is plenty.",
        "responses": {
          "200": {
            "description": "It worked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "description": "1 when the call worked."
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "The object. Use it as device_id in the other calls."
                          },
                          "name": {
                            "type": "string",
                            "description": "Its name in the portal."
                          },
                          "imei": {
                            "type": "string",
                            "description": "The tracker's identifier."
                          },
                          "plate": {
                            "type": "string",
                            "description": "Number plate, when one was entered."
                          },
                          "model": {
                            "type": "string",
                            "description": "Vehicle model, when one was entered."
                          },
                          "active": {
                            "type": "boolean",
                            "description": "Whether the object is ticked to show on the map."
                          },
                          "group": {
                            "type": "object",
                            "description": "The group it is in: id and title. Absent when ungrouped."
                          },
                          "status": {
                            "type": "string",
                            "description": "online (moving), ack (in contact, standing still) or offline (not heard from)."
                          },
                          "time": {
                            "type": "string",
                            "description": "When it was last heard from, in the account's time zone: 2026-11-18 09:41:07. Or Not connected (never reported) or Expired."
                          },
                          "stop_seconds": {
                            "type": "integer",
                            "description": "Seconds since it last moved."
                          },
                          "driver": {
                            "type": "string",
                            "description": "The driver assigned now, when there is one."
                          },
                          "address": {
                            "type": "string",
                            "description": "The address of the position, when it is known."
                          },
                          "position": {
                            "type": "object",
                            "description": "The latest position, or null for an object that never reported.",
                            "properties": {
                              "lat": {
                                "type": "number",
                                "description": "Latitude, decimal degrees."
                              },
                              "lng": {
                                "type": "number",
                                "description": "Longitude, decimal degrees."
                              },
                              "speed_kmh": {
                                "type": "number",
                                "description": "Speed in km/h, whatever the account's units."
                              },
                              "course": {
                                "type": "number",
                                "description": "Heading in degrees, 0 is north."
                              },
                              "altitude": {
                                "type": "number",
                                "description": "Altitude in metres."
                              },
                              "fix_time": {
                                "type": "string",
                                "description": "When the position was taken, UTC, RFC 3339."
                              },
                              "accuracy": {
                                "type": "number",
                                "description": "Accuracy in metres, when the device gives it (phones do)."
                              }
                            }
                          }
                        }
                      },
                      "description": "One entry for each object."
                    }
                  }
                },
                "example": {
                  "status": 1,
                  "items": [
                    {
                      "id": 61,
                      "name": "Truck 01",
                      "imei": "358480086858802",
                      "plate": "AB-123-CD",
                      "active": true,
                      "group": {
                        "id": 4,
                        "title": "North depot"
                      },
                      "status": "online",
                      "time": "2026-11-18 12:41:07",
                      "stop_seconds": 0,
                      "driver": "Ayşe D.",
                      "position": {
                        "lat": 25.2854,
                        "lng": 51.531,
                        "speed_kmh": 48,
                        "course": 182,
                        "altitude": 12,
                        "fix_time": "2026-11-18T09:41:07Z"
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/api/v2/history/positions": {
      "get": {
        "operationId": "positions",
        "tags": [
          "Objects and positions"
        ],
        "summary": "Stored positions of one object",
        "description": "Every position an object reported in a period, oldest first, in pages.",
        "parameters": [
          {
            "name": "device_id",
            "in": "query",
            "required": true,
            "description": "The object, as id from the objects list.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "from_date",
            "in": "query",
            "required": true,
            "description": "First day, YYYY-MM-DD, in the account's time zone.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "from_time",
            "in": "query",
            "required": true,
            "description": "Time on that day, HH:MM or HH:MM:SS.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to_date",
            "in": "query",
            "required": true,
            "description": "Last day, YYYY-MM-DD.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to_time",
            "in": "query",
            "required": true,
            "description": "Time on that day. The period may cover at most 31 days.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Positions on a page: 50 (default), 100, 200 or 400.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "sorting",
            "in": "query",
            "required": false,
            "description": "desc for newest first.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "The page to return, from 1. See pages.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "It worked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "description": "1 when the call worked."
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "The position."
                          },
                          "fix_time": {
                            "type": "string",
                            "description": "When it was taken, UTC, RFC 3339. Use this one in programs."
                          },
                          "time": {
                            "type": "string",
                            "description": "The same moment in the account's time zone and date notation, as the portal shows it."
                          },
                          "latitude": {
                            "type": "number",
                            "description": "Latitude, decimal degrees."
                          },
                          "longitude": {
                            "type": "number",
                            "description": "Longitude, decimal degrees."
                          },
                          "altitude": {
                            "type": "number",
                            "description": "Altitude in metres, rounded."
                          },
                          "speed": {
                            "type": "number",
                            "description": "Speed in the account's unit (km/h, or mph when unit_of_distance is mi), rounded."
                          },
                          "course": {
                            "type": "number",
                            "description": "Heading in degrees."
                          }
                        }
                      },
                      "description": "The positions of this page."
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "description": "The page returned."
                        },
                        "last_page": {
                          "type": "integer",
                          "description": "The last page there is."
                        },
                        "total": {
                          "type": "integer",
                          "description": "How many items there are in all."
                        },
                        "per_page": {
                          "type": "integer",
                          "description": "Items on a page."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": 1,
                  "items": [
                    {
                      "id": 90412233,
                      "fix_time": "2026-11-17T05:12:40Z",
                      "time": "2026-11-17 08:12:40",
                      "latitude": 25.2811,
                      "longitude": 51.5204,
                      "altitude": 9,
                      "speed": 42,
                      "course": 96
                    }
                  ],
                  "pagination": {
                    "page": 1,
                    "last_page": 38,
                    "total": 1874,
                    "per_page": 50
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/api/v2/history/trips": {
      "get": {
        "operationId": "trips",
        "tags": [
          "Objects and positions"
        ],
        "summary": "Trips, with distance and duration",
        "description": "The journeys of one or all objects in a period: each drive from setting off to stopping, with its distance, duration and top speed, newest first.",
        "parameters": [
          {
            "name": "device_id",
            "in": "query",
            "required": false,
            "description": "One object. Repeat the parameter for several. Without it: every object of the account, up to 200.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "from_date",
            "in": "query",
            "required": true,
            "description": "First day, YYYY-MM-DD, in the account's time zone.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "from_time",
            "in": "query",
            "required": true,
            "description": "Time on that day, HH:MM or HH:MM:SS.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to_date",
            "in": "query",
            "required": true,
            "description": "Last day, YYYY-MM-DD.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to_time",
            "in": "query",
            "required": true,
            "description": "Time on that day. The period may cover at most 31 days.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "It worked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "description": "1 when the call worked."
                    },
                    "trips": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "device_id": {
                            "type": "integer",
                            "description": "The object."
                          },
                          "device": {
                            "type": "string",
                            "description": "Its name."
                          },
                          "start_utc": {
                            "type": "string",
                            "description": "When it set off, UTC, RFC 3339."
                          },
                          "end_utc": {
                            "type": "string",
                            "description": "When it stopped, UTC, RFC 3339."
                          },
                          "start": {
                            "type": "string",
                            "description": "The start in the account's time zone, YYYY-MM-DD HH:MM:SS."
                          },
                          "end": {
                            "type": "string",
                            "description": "The end in the account's time zone."
                          },
                          "seconds": {
                            "type": "integer",
                            "description": "How long the trip took."
                          },
                          "duration": {
                            "type": "string",
                            "description": "The same, written for people: 1h 12min."
                          },
                          "distance": {
                            "type": "number",
                            "description": "Distance driven, in distance_unit."
                          },
                          "top_speed": {
                            "type": "number",
                            "description": "Highest speed, in speed_unit."
                          },
                          "start_lat": {
                            "type": "number",
                            "description": "Where it started: latitude."
                          },
                          "start_lng": {
                            "type": "number",
                            "description": "Where it started: longitude."
                          },
                          "end_lat": {
                            "type": "number",
                            "description": "Where it ended: latitude."
                          },
                          "end_lng": {
                            "type": "number",
                            "description": "Where it ended: longitude."
                          },
                          "driver": {
                            "type": "string",
                            "description": "The driver, when one was recorded for the trip."
                          },
                          "stop_before": {
                            "type": "integer",
                            "description": "Seconds the object stood before this trip, when known."
                          }
                        }
                      },
                      "description": "One entry for each trip."
                    },
                    "objects": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "The object."
                          },
                          "name": {
                            "type": "string",
                            "description": "Its name."
                          },
                          "trips": {
                            "type": "integer",
                            "description": "Number of trips in the period."
                          },
                          "distance": {
                            "type": "number",
                            "description": "Total distance, in distance_unit."
                          },
                          "drive_sec": {
                            "type": "integer",
                            "description": "Total driving time in seconds."
                          }
                        }
                      },
                      "description": "A summary for each object asked for."
                    },
                    "distance_unit": {
                      "type": "string",
                      "description": "The unit of every distance in this answer, for example km."
                    },
                    "speed_unit": {
                      "type": "string",
                      "description": "The unit of every speed in this answer, for example kph."
                    }
                  }
                },
                "example": {
                  "status": 1,
                  "trips": [
                    {
                      "device_id": 61,
                      "device": "Truck 01",
                      "start_utc": "2026-11-17T05:12:40Z",
                      "end_utc": "2026-11-17T06:24:55Z",
                      "start": "2026-11-17 08:12:40",
                      "end": "2026-11-17 09:24:55",
                      "seconds": 4335,
                      "duration": "1h 12min",
                      "distance": 58.4,
                      "top_speed": 96,
                      "start_lat": 25.1701,
                      "start_lng": 51.4502,
                      "end_lat": 25.3237,
                      "end_lng": 51.531,
                      "driver": "Ayşe D.",
                      "stop_before": 1260
                    }
                  ],
                  "objects": [
                    {
                      "id": 61,
                      "name": "Truck 01",
                      "trips": 1,
                      "distance": 58.4,
                      "drive_sec": 4335
                    }
                  ],
                  "distance_unit": "km",
                  "speed_unit": "kph"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/api/v2/monitor/address": {
      "get": {
        "operationId": "address",
        "tags": [
          "Objects and positions"
        ],
        "summary": "The address of a place",
        "description": "Turns a latitude and longitude into an address, in the account's language.",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "description": "Latitude, −90 to 90.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "lng",
            "in": "query",
            "required": true,
            "description": "Longitude, −180 to 180.",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "It worked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "description": "1 when the call worked."
                    },
                    "address": {
                      "type": "string",
                      "description": "The address. When none can be found the answer has status 0 and a message instead."
                    }
                  }
                },
                "example": {
                  "status": 1,
                  "address": "Al Corniche Street, Doha, Qatar"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/api/v2/monitor/events": {
      "get": {
        "operationId": "events",
        "tags": [
          "Alerts"
        ],
        "summary": "Alerts that fired",
        "description": "The alerts of the last days, newest first: speeding, a geofence crossed, an SOS, a tracker gone quiet. At most 200.",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "How many days back: 2 by default, at most 30.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "device_id",
            "in": "query",
            "required": false,
            "description": "Only the alerts of one object.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "It worked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "description": "1 when the call worked."
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "The alert event."
                          },
                          "time_utc": {
                            "type": "string",
                            "description": "When it fired, UTC, RFC 3339."
                          },
                          "time": {
                            "type": "string",
                            "description": "The same moment in the account's time zone and date notation."
                          },
                          "device_id": {
                            "type": "integer",
                            "description": "The object."
                          },
                          "device_name": {
                            "type": "string",
                            "description": "Its name."
                          },
                          "type": {
                            "type": "string",
                            "description": "What kind: overspeed, zone_in, zone_out (a geofence entered or left), stop_duration, idle_duration, offline_duration, ignition_duration, time_duration, distance, driver, fuel_fill, fuel_theft, task_complete, sos, custom and others. Treat an unknown value as a new kind, not as an error."
                          },
                          "message": {
                            "type": "string",
                            "description": "The alert in words, in the account's language."
                          },
                          "speed": {
                            "type": "number",
                            "description": "Speed at that moment, in the account's unit."
                          },
                          "latitude": {
                            "type": "number",
                            "description": "Where it happened: latitude."
                          },
                          "longitude": {
                            "type": "number",
                            "description": "Where it happened: longitude."
                          }
                        }
                      },
                      "description": "One entry for each alert."
                    }
                  }
                },
                "example": {
                  "status": 1,
                  "items": [
                    {
                      "id": 5521,
                      "time_utc": "2026-11-18T09:41:07Z",
                      "time": "2026-11-18 12:41:07",
                      "device_id": 61,
                      "device_name": "Truck 01",
                      "type": "overspeed",
                      "message": "Overspeed (90 kph)",
                      "speed": 97,
                      "latitude": 25.2854,
                      "longitude": 51.531
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/api/v2/geofences": {
      "get": {
        "operationId": "geofences",
        "tags": [
          "Places and drivers"
        ],
        "summary": "Geofences",
        "description": "The places drawn on the map, by group. A group lists its first 100 geofences; ask for the rest with group_id and page.",
        "parameters": [
          {
            "name": "s",
            "in": "query",
            "required": false,
            "description": "Only geofences whose name contains this text.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "group_id",
            "in": "query",
            "required": false,
            "description": "One group's geofences, 100 on a page (0 is the ungrouped ones). The answer is then items and has_more instead of groups.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "The page to return, from 1. See pages.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "It worked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "description": "1 when the call worked."
                    },
                    "groups": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "The group."
                          },
                          "title": {
                            "type": "string",
                            "description": "Its name."
                          },
                          "count": {
                            "type": "integer",
                            "description": "How many geofences it has."
                          },
                          "has_more": {
                            "type": "boolean",
                            "description": "True when it has more than the 100 listed."
                          },
                          "geofences": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "integer",
                                  "description": "The geofence."
                                },
                                "name": {
                                  "type": "string",
                                  "description": "Its name."
                                },
                                "active": {
                                  "type": "boolean",
                                  "description": "Whether it is shown on the map."
                                },
                                "type": {
                                  "type": "string",
                                  "description": "polygon or circle."
                                },
                                "polygon_color": {
                                  "type": "string",
                                  "description": "Its colour, for example #d000df."
                                },
                                "group_id": {
                                  "type": "integer",
                                  "description": "The group it is in, 0 for none."
                                },
                                "coordinates": {
                                  "type": "array",
                                  "items": {
                                    "type": "object"
                                  },
                                  "description": "The corners of a polygon, each lat and lng."
                                },
                                "center": {
                                  "type": "object",
                                  "description": "The centre of a circle (lat, lng), null for a polygon."
                                },
                                "radius": {
                                  "type": "number",
                                  "description": "The radius of a circle in metres, null for a polygon."
                                }
                              }
                            },
                            "description": "Its geofences."
                          }
                        }
                      },
                      "description": "The groups that have geofences. Group 0 holds the ungrouped ones."
                    }
                  }
                },
                "example": {
                  "status": 1,
                  "groups": [
                    {
                      "id": 0,
                      "title": "Ungrouped",
                      "count": 1,
                      "has_more": false,
                      "geofences": [
                        {
                          "id": 12,
                          "name": "North delivery zone",
                          "active": true,
                          "type": "polygon",
                          "polygon_color": "#1d4e89",
                          "group_id": 0,
                          "coordinates": [
                            {
                              "lat": 25.33,
                              "lng": 51.5
                            },
                            {
                              "lat": 25.33,
                              "lng": 51.55
                            },
                            {
                              "lat": 25.3,
                              "lng": 51.55
                            }
                          ],
                          "center": null,
                          "radius": null
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/api/v2/me/drivers": {
      "get": {
        "operationId": "drivers",
        "tags": [
          "Places and drivers"
        ],
        "summary": "Drivers",
        "description": "The drivers of the account, 15 on a page, newest first.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "The page to return, from 1. See pages.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "It worked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "description": "1 when the call worked."
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "The driver."
                          },
                          "name": {
                            "type": "string",
                            "description": "Their name."
                          },
                          "device_id": {
                            "type": "integer",
                            "description": "The object they are assigned to now, or null."
                          },
                          "device_name": {
                            "type": "string",
                            "description": "Its name, or empty."
                          },
                          "rfid": {
                            "type": "string",
                            "description": "The key fob or card that identifies them, when one is set."
                          },
                          "phone": {
                            "type": "string",
                            "description": "Phone number, when entered."
                          },
                          "email": {
                            "type": "string",
                            "description": "Email address, when entered."
                          },
                          "description": {
                            "type": "string",
                            "description": "Notes."
                          }
                        }
                      },
                      "description": "The drivers of this page."
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "description": "The page returned."
                        },
                        "last_page": {
                          "type": "integer",
                          "description": "The last page there is."
                        },
                        "total": {
                          "type": "integer",
                          "description": "How many items there are in all."
                        },
                        "per_page": {
                          "type": "integer",
                          "description": "Items on a page."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": 1,
                  "items": [
                    {
                      "id": 3,
                      "name": "Ayşe D.",
                      "device_id": 61,
                      "device_name": "Truck 01",
                      "rfid": "0A1B2C3D",
                      "phone": "",
                      "email": "",
                      "description": ""
                    }
                  ],
                  "pagination": {
                    "page": 1,
                    "last_page": 1,
                    "total": 1,
                    "per_page": 15
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/api/v2/tasks": {
      "get": {
        "operationId": "tasksList",
        "tags": [
          "Tasks"
        ],
        "summary": "Tasks",
        "description": "The tasks of the account, 10 on a page, newest first.",
        "parameters": [
          {
            "name": "search_device_id",
            "in": "query",
            "required": false,
            "description": "Only the tasks of one object.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search_task_status",
            "in": "query",
            "required": false,
            "description": "1 new, 2 in progress, 9 completed, 3 failed.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search_invoice_number",
            "in": "query",
            "required": false,
            "description": "Only the tasks with this reference.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search_time_from",
            "in": "query",
            "required": false,
            "description": "Only tasks to be delivered from this moment, YYYY-MM-DD HH:MM:SS.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search_time_to",
            "in": "query",
            "required": false,
            "description": "Only tasks to be delivered by this moment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "The page to return, from 1. See pages.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "It worked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "description": "1 when the call worked."
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "The task."
                          },
                          "title": {
                            "type": "string",
                            "description": "Its title."
                          },
                          "device_name": {
                            "type": "string",
                            "description": "The object it is for."
                          },
                          "status": {
                            "type": "integer",
                            "description": "1 new, 2 in progress, 9 completed, 3 failed."
                          },
                          "status_name": {
                            "type": "string",
                            "description": "The status in words, in the account's language."
                          },
                          "priority_name": {
                            "type": "string",
                            "description": "The priority in words."
                          },
                          "invoice_number": {
                            "type": "string",
                            "description": "Your own reference."
                          },
                          "pickup_time_from": {
                            "type": "string",
                            "description": "Earliest start, in the account's date notation."
                          },
                          "delivery_time_from": {
                            "type": "string",
                            "description": "Earliest arrival, in the account's date notation."
                          },
                          "has_signature": {
                            "type": "boolean",
                            "description": "True when the task was closed with a signature."
                          }
                        }
                      },
                      "description": "The tasks of this page."
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "description": "The page returned."
                        },
                        "last_page": {
                          "type": "integer",
                          "description": "The last page there is."
                        },
                        "total": {
                          "type": "integer",
                          "description": "How many items there are in all."
                        },
                        "per_page": {
                          "type": "integer",
                          "description": "Items on a page."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": 1,
                  "items": [
                    {
                      "id": 204,
                      "title": "Deliver order 10482",
                      "device_name": "Truck 01",
                      "status": 9,
                      "status_name": "Completed",
                      "priority_name": "Normal",
                      "invoice_number": "10482",
                      "pickup_time_from": "2026-11-19 08:00:00",
                      "delivery_time_from": "2026-11-19 10:00:00",
                      "has_signature": true
                    }
                  ],
                  "pagination": {
                    "page": 1,
                    "last_page": 1,
                    "total": 1,
                    "per_page": 10
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "post": {
        "operationId": "taskCreate",
        "tags": [
          "Tasks"
        ],
        "summary": "Create a task",
        "description": "Creates a task for an object. It shows in the app of the phone linked to that object. Send JSON.",
        "responses": {
          "200": {
            "description": "It worked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "description": "1 when the call worked."
                    },
                    "id": {
                      "type": "integer",
                      "description": "The new task."
                    }
                  }
                },
                "example": {
                  "status": 1,
                  "id": 204
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "device_id",
                  "title",
                  "priority",
                  "pickup_address",
                  "pickup_address_lat",
                  "pickup_address_lng",
                  "pickup_time_from",
                  "pickup_time_to",
                  "delivery_address",
                  "delivery_address_lat",
                  "delivery_address_lng",
                  "delivery_time_from",
                  "delivery_time_to"
                ],
                "properties": {
                  "device_id": {
                    "type": "integer",
                    "description": "The object (vehicle or phone) the task is for."
                  },
                  "title": {
                    "type": "string",
                    "description": "What the driver or field worker sees."
                  },
                  "priority": {
                    "type": "integer",
                    "description": "1 low, 2 normal, 3 high."
                  },
                  "pickup_address": {
                    "type": "string",
                    "description": "Where the task starts."
                  },
                  "pickup_address_lat": {
                    "type": "number",
                    "description": "Its latitude."
                  },
                  "pickup_address_lng": {
                    "type": "number",
                    "description": "Its longitude."
                  },
                  "pickup_time_from": {
                    "type": "string",
                    "description": "Earliest start, YYYY-MM-DD HH:MM:SS."
                  },
                  "pickup_time_to": {
                    "type": "string",
                    "description": "Latest start. Not before pickup_time_from."
                  },
                  "delivery_address": {
                    "type": "string",
                    "description": "Where the task ends."
                  },
                  "delivery_address_lat": {
                    "type": "number",
                    "description": "Its latitude."
                  },
                  "delivery_address_lng": {
                    "type": "number",
                    "description": "Its longitude."
                  },
                  "delivery_time_from": {
                    "type": "string",
                    "description": "Earliest arrival, YYYY-MM-DD HH:MM:SS."
                  },
                  "delivery_time_to": {
                    "type": "string",
                    "description": "Latest arrival. Not before delivery_time_from."
                  },
                  "comment": {
                    "type": "string",
                    "description": "Notes for the person doing it."
                  },
                  "invoice_number": {
                    "type": "string",
                    "description": "Your own reference: an order or invoice number. You can search tasks by it."
                  }
                }
              },
              "example": {
                "device_id": 61,
                "title": "Deliver order 10482",
                "priority": 2,
                "invoice_number": "10482",
                "comment": "Ring twice. Fragile.",
                "pickup_address": "Depot North, Industrial Area",
                "pickup_address_lat": 25.1701,
                "pickup_address_lng": 51.4502,
                "pickup_time_from": "2026-11-19 08:00:00",
                "pickup_time_to": "2026-11-19 09:00:00",
                "delivery_address": "12 Marina Street, West Bay",
                "delivery_address_lat": 25.3237,
                "delivery_address_lng": 51.531,
                "delivery_time_from": "2026-11-19 10:00:00",
                "delivery_time_to": "2026-11-19 12:00:00"
              }
            }
          }
        }
      }
    },
    "/api/v2/tasks/{id}": {
      "get": {
        "operationId": "taskGet",
        "tags": [
          "Tasks"
        ],
        "summary": "One task",
        "description": "A task with all its details. The times come back as they were sent.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The task.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "It worked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "description": "1 when the call worked."
                    },
                    "item": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "description": "The task."
                        },
                        "device_id": {
                          "type": "integer",
                          "description": "The object it is for."
                        },
                        "title": {
                          "type": "string",
                          "description": "Its title."
                        },
                        "comment": {
                          "type": "string",
                          "description": "Notes for the person doing it."
                        },
                        "invoice_number": {
                          "type": "string",
                          "description": "Your own reference."
                        },
                        "priority": {
                          "type": "integer",
                          "description": "1 low, 2 normal, 3 high."
                        },
                        "status": {
                          "type": "integer",
                          "description": "1 new, 2 in progress, 9 completed, 3 failed."
                        },
                        "pickup_address": {
                          "type": "string",
                          "description": "Where it starts."
                        },
                        "pickup_address_lat": {
                          "type": "number",
                          "description": "Latitude."
                        },
                        "pickup_address_lng": {
                          "type": "number",
                          "description": "Longitude."
                        },
                        "pickup_time_from": {
                          "type": "string",
                          "description": "Earliest start."
                        },
                        "pickup_time_to": {
                          "type": "string",
                          "description": "Latest start."
                        },
                        "delivery_address": {
                          "type": "string",
                          "description": "Where it ends."
                        },
                        "delivery_address_lat": {
                          "type": "number",
                          "description": "Latitude."
                        },
                        "delivery_address_lng": {
                          "type": "number",
                          "description": "Longitude."
                        },
                        "delivery_time_from": {
                          "type": "string",
                          "description": "Earliest arrival."
                        },
                        "delivery_time_to": {
                          "type": "string",
                          "description": "Latest arrival."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": 1,
                  "item": {
                    "id": 204,
                    "status": 1,
                    "device_id": 61,
                    "title": "Deliver order 10482",
                    "priority": 2,
                    "invoice_number": "10482",
                    "comment": "Ring twice. Fragile.",
                    "pickup_address": "Depot North, Industrial Area",
                    "pickup_address_lat": 25.1701,
                    "pickup_address_lng": 51.4502,
                    "pickup_time_from": "2026-11-19 08:00:00",
                    "pickup_time_to": "2026-11-19 09:00:00",
                    "delivery_address": "12 Marina Street, West Bay",
                    "delivery_address_lat": 25.3237,
                    "delivery_address_lng": 51.531,
                    "delivery_time_from": "2026-11-19 10:00:00",
                    "delivery_time_to": "2026-11-19 12:00:00"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "put": {
        "operationId": "taskUpdate",
        "tags": [
          "Tasks"
        ],
        "summary": "Change a task",
        "description": "Replaces a task's details. Send every field, as when creating; add status to change it (1 new, 2 in progress, 9 completed, 3 failed).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The task.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "It worked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "description": "1 when the call worked."
                    }
                  }
                },
                "example": {
                  "status": 1
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "device_id",
                  "title",
                  "priority",
                  "pickup_address",
                  "pickup_address_lat",
                  "pickup_address_lng",
                  "pickup_time_from",
                  "pickup_time_to",
                  "delivery_address",
                  "delivery_address_lat",
                  "delivery_address_lng",
                  "delivery_time_from",
                  "delivery_time_to"
                ],
                "properties": {
                  "device_id": {
                    "type": "integer",
                    "description": "The object (vehicle or phone) the task is for."
                  },
                  "title": {
                    "type": "string",
                    "description": "What the driver or field worker sees."
                  },
                  "priority": {
                    "type": "integer",
                    "description": "1 low, 2 normal, 3 high."
                  },
                  "pickup_address": {
                    "type": "string",
                    "description": "Where the task starts."
                  },
                  "pickup_address_lat": {
                    "type": "number",
                    "description": "Its latitude."
                  },
                  "pickup_address_lng": {
                    "type": "number",
                    "description": "Its longitude."
                  },
                  "pickup_time_from": {
                    "type": "string",
                    "description": "Earliest start, YYYY-MM-DD HH:MM:SS."
                  },
                  "pickup_time_to": {
                    "type": "string",
                    "description": "Latest start. Not before pickup_time_from."
                  },
                  "delivery_address": {
                    "type": "string",
                    "description": "Where the task ends."
                  },
                  "delivery_address_lat": {
                    "type": "number",
                    "description": "Its latitude."
                  },
                  "delivery_address_lng": {
                    "type": "number",
                    "description": "Its longitude."
                  },
                  "delivery_time_from": {
                    "type": "string",
                    "description": "Earliest arrival, YYYY-MM-DD HH:MM:SS."
                  },
                  "delivery_time_to": {
                    "type": "string",
                    "description": "Latest arrival. Not before delivery_time_from."
                  },
                  "comment": {
                    "type": "string",
                    "description": "Notes for the person doing it."
                  },
                  "invoice_number": {
                    "type": "string",
                    "description": "Your own reference: an order or invoice number. You can search tasks by it."
                  },
                  "status": {
                    "type": "integer",
                    "description": "1 new, 2 in progress, 9 completed, 3 failed."
                  }
                }
              },
              "example": {
                "device_id": 61,
                "title": "Deliver order 10482",
                "priority": 2,
                "invoice_number": "10482",
                "comment": "Ring twice. Fragile.",
                "pickup_address": "Depot North, Industrial Area",
                "pickup_address_lat": 25.1701,
                "pickup_address_lng": 51.4502,
                "pickup_time_from": "2026-11-19 08:00:00",
                "pickup_time_to": "2026-11-19 09:00:00",
                "delivery_address": "12 Marina Street, West Bay",
                "delivery_address_lat": 25.3237,
                "delivery_address_lng": 51.531,
                "delivery_time_from": "2026-11-19 10:00:00",
                "delivery_time_to": "2026-11-19 13:00:00"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key (gtk_...) made in the portal under Settings > API keys. Header only: a key in the address is refused."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "const": 0
          },
          "message": {
            "type": "string"
          },
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "The fields that were wrong, each with why."
          }
        }
      }
    },
    "responses": {
      "E401": {
        "description": "No key, an unknown or revoked key, or a key sent in the address.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E402": {
        "description": "The subscription has run out.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E403": {
        "description": "The key may not make this call.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E422": {
        "description": "Something sent is missing or wrong.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E429": {
        "description": "More than 120 calls a minute with one key. See Retry-After.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}
