### Get User Request (PHP) Source: https://safetagtracking.readme.io/reference/get-geofences-copy Example of how to make a GET request to the 'Get User' endpoint using PHP. This code demonstrates fetching user details from the API. ```php // PHP example would go here if provided ``` -------------------------------- ### Get User Request (Ruby) Source: https://safetagtracking.readme.io/reference/get-geofences-copy Example of how to make a GET request to the 'Get User' endpoint using Ruby. This snippet shows how to retrieve user information via the API. ```ruby # Ruby example would go here if provided ``` -------------------------------- ### Get User Request (Python) Source: https://safetagtracking.readme.io/reference/get-geofences-copy Example of how to make a GET request to the 'Get User' endpoint using Python. This snippet illustrates retrieving user information and processing the response. ```python # Python example would go here if provided ``` -------------------------------- ### Get User Request (Node.js) Source: https://safetagtracking.readme.io/reference/get-geofences-copy Example of how to make a GET request to the 'Get User' endpoint using Node.js. This code snippet demonstrates fetching user data and handling the response. ```javascript // Node.js example would go here if provided ``` -------------------------------- ### Get User Request (cURL) Source: https://safetagtracking.readme.io/reference/get-geofences-copy Example of how to make a GET request to the 'Get User' endpoint using cURL. This command fetches user details from the specified URL, including the required 'accept' header. ```shell curl --request GET \ --url https://api.safetagtracking.com/api/v1/user/you%40email.com \ --header 'accept: application/json' ``` -------------------------------- ### Get Alerts using OpenAPI definition Source: https://safetagtracking.readme.io/reference/get-alerts This snippet defines the OpenAPI 3.1.0 specification for the 'Get Alerts' endpoint. It details the API server URL, security schemes (API Key), request parameters (username, device_id, page), and the structure of successful (200) and error (400) responses, including example alert data. ```json { "openapi": "3.1.0", "info": { "title": "SafeTag Tracking API", "version": "1.0" }, "servers": [ { "url": "https://api.safetagtracking.com/api/v1" } ], "components": { "securitySchemes": { "sec0": { "type": "apiKey", "in": "header", "name": "X-API-KEY" } } }, "security": [ { "sec0": [] } ], "paths": { "/alerts/{username}/{device_id/all}": { "get": { "summary": "Get Alerts", "description": "", "operationId": "get-alerts", "parameters": [ { "name": "username", "in": "path", "description": "Your account's email address", "schema": { "type": "string", "default": "you@email.com" }, "required": true }, { "name": "device_id", "in": "path", "description": "The device_id of the tracker whose alerts you're looking for. Or provide \"all\" to get all tracker alerts.", "schema": { "type": "string", "default": "865203478092" }, "required": true }, { "name": "page", "in": "query", "description": "Which interval of the last 400 alerts to get when querying \"all\" tracker alerts", "schema": { "type": "integer", "format": "int32", "default": 1 } } ], "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Result": { "value": "[\n {\n \"timestamp\": \"2024-04-11T08:25:13.406Z\",\n \"alert\": {\n \"title\": \"8650000000000 has exceeded its speed limit.\",\n \"body\": \"Your SafeTag Tracker has exceeded the speed limit you set of 31 MPH (Speed 34 MPH)\",\n \"speed\": 55,\n \"location\": \"51.390763333,0.0943116666\"\n },\n \"category\": \"speed\"\n },\n {\n \"timestamp\": \"2024-04-11T08:23:14.404Z\",\n \"alert\": {\n \"title\": \"8650800000000 has exceeded its speed limit.\",\n \"body\": \"Your SafeTag Tracker has exceeded the speed limit you set of 31 MPH (Speed 32 MPH)\",\n \"speed\": 52,\n \"location\": \"51.382308888,0.0881111111\"\n },\n \"category\": \"speed\"\n }\n ]" } }, "schema": { "type": "array", "items": { "type": "object", "properties": { "timestamp": { "type": "string", "example": "2024-04-11T08:25:13.406Z" }, "alert": { "type": "object", "properties": { "title": { "type": "string", "example": "8650000000000 has exceeded its speed limit." }, "body": { "type": "string", "example": "Your SafeTag Tracker has exceeded the speed limit you set of 31 MPH (Speed 34 MPH)" }, "speed": { "type": "integer", "example": 55, "default": 0 }, "location": { "type": "string", "example": "51.390763333,0.0943116666" } } }, "category": { "type": "string", "example": "speed" } } } } } } }, "400": { "description": "400", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } } }, "deprecated": false } } }, "x-readme": { "headers": [], "explorer-enabled": true, "proxy-enabled": true }, "x-readme-fauxas": true, "_id": "6615605350554d0012d9b15b:6615655a735ead00115a1236" } ``` -------------------------------- ### GET /devices/{username} Source: https://safetagtracking.readme.io/reference/get-trackers Retrieves a list of trackers associated with a given username. Supports filtering by device IDs and pagination. ```APIDOC ## GET /devices/{username} ### Description Retrieves a list of trackers associated with a given username. You can filter the results by providing a comma-separated list of device IDs (IMEI) or paginate through the results. ### Method GET ### Endpoint /devices/{username} ### Parameters #### Path Parameters - **username** (string) - Required - Your account's email address #### Query Parameters - **page** (integer) - Optional - Pagination attribute for skipping pages of 500 trackers. Defaults to 1. - **ids** (string) - Optional - Enter a device_id (IMEI) or a comma separated list of device_ids to retrieve just those tracker's data e.g. "868036536467228,898036230847228" ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **_id** (string) - The unique identifier for the tracker. - **model** (integer) - The model number of the tracker. - **product** (integer) - The product code for the tracker. - **owner** (object) - Information about the tracker's owner. - **id** (string) - The owner's ID. - **username** (string) - The owner's username (email address). - **subscription** (object) - Details about the tracker's subscription. - **id** (string) - The subscription ID. - **status** (string) - The current status of the subscription (e.g., "active"). - **trialing** (boolean) - Indicates if the subscription is currently in a trial period. - **trialed** (boolean) - Indicates if the subscription has been trialed before. - **price** (integer) - The subscription price. - **currency** (string) - The currency of the subscription price. - **term** (string) - The subscription term. - **current_period_start** (null) - The start date of the current subscription period. - **current_period_end** (null) - The end date of the current subscription period. - **canceled_at** (string) - The date the subscription was canceled. - **created** (integer) - The creation timestamp of the subscription. - **interval** (integer) - The subscription interval. - **trial_days** (integer) - The number of trial days. - **prefs** (object) - User preferences for the tracker. - **name** (string) - The name assigned to the tracker. - **category** (string) - The category of the tracker. - **marker** (string) - The marker style for the tracker. - **geofence** (object) - Geofence settings. - **centre** (string) - The center coordinates of the geofence. - **size** (integer) - The size of the geofence. - **geofences** (array) - A list of custom geofences. - **speed_limit** (integer) - The speed limit alert setting. - **alerts** (object) - Alert configurations. - **battery** (boolean) - Battery alert status. - **geofence** (boolean) - Geofence alert status. - **activated** (boolean) - General alert activation status. - **speed** (boolean) - Speed alert status. - **movement** (boolean) - Movement alert status. - **tamper** (boolean) - Tamper alert status. - **acc** (boolean) - Acceleration alert status. - **schedules** (object) - Scheduled alerts. - **movement** (array) - Scheduled movement alerts. - **geofence** (array) - Scheduled geofence alerts. - **status** (object) - The current status of the tracker. - **location** (string) - The current location of the tracker (latitude,longitude). - **speed** (integer) - The current speed of the tracker. - **course** (integer) - The current course (direction) of the tracker. - **status** (integer) - The status code of the tracker. - **battery** (integer) - The battery level of the tracker. - **signal** (integer) - The signal strength of the tracker. - **geofence** (boolean) - Indicates if the tracker is within a geofence. - **last_updated** (string) - The timestamp of the last location update. - **status_last_updated** (string) - The timestamp of the last status update. - **coords** (object) - Coordinate details. - **lat** (number) - The latitude. - **lon** (number) - The longitude. #### Response Example ```json { "_id": "865080040000000", "model": 0, "product": 0, "owner": { "id": "64de44366230ac4656cae", "username": "api@safetagtracking.com" }, "subscription": { "id": "sub_id", "status": "active", "trialing": false, "trialed": true, "price": 0, "currency": "gbp", "term": "", "current_period_start": null, "current_period_end": null, "canceled_at": "2000-01-01T00:00:00.000Z", "created": 0, "interval": 0, "trial_days": 7 }, "prefs": { "name": "My Tracker", "category": "default", "marker": "default", "geofence": { "centre": "", "size": 0 }, "geofences": [], "speed_limit": 0, "alerts": { "battery": false, "geofence": false, "activated": true, "speed": false, "movement": false, "tamper": false, "acc": false, "schedules": { "movement": [], "geofence": [] } } }, "status": { "location": "51.398385,0.1104222222", "speed": 0, "course": 0, "status": 11, "battery": 6, "signal": 100, "geofence": true, "last_updated": "2024-04-11T13:44:42.000Z", "status_last_updated": "2024-04-11T15:58:37.888Z", "coords": { "lat": 51.398385, "lon": 0.11042222222222223 } } } ``` -------------------------------- ### OpenAPI Definition for SafeTag Tracking API Source: https://safetagtracking.readme.io/reference/get-trackers This JSON document defines the OpenAPI 3.1.0 specification for the SafeTag Tracking API. It details the API's structure, including server information, security mechanisms, and available endpoints like 'Get Trackers'. It also includes example request and response payloads. ```json { "openapi": "3.1.0", "info": { "title": "SafeTag Tracking API", "version": "1.0" }, "servers": [ { "url": "https://api.safetagtracking.com/api/v1" } ], "components": { "securitySchemes": { "sec0": { "type": "apiKey", "in": "header", "name": "X-API-KEY" } } }, "security": [ { "sec0": [] } ], "paths": { "/devices/{username}": { "get": { "summary": "Get Trackers", "description": "", "operationId": "get-trackers", "parameters": [ { "name": "username", "in": "path", "description": "Your account's email address", "schema": { "type": "string", "default": "you@email.com" }, "required": true }, { "name": "page", "in": "query", "description": "Pagination attribute for skipping pages of 500 trackers.", "schema": { "type": "integer", "format": "int32", "default": 1 } }, { "name": "ids", "in": "query", "description": "Enter a device_id (IMEI) or a comma separated list of device_ids to retrieve just those tracker's data e.g. \"868036536467228,898036230847228\"", "schema": { "type": "string" } } ], "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Result": { "value": " {\n \"_id\": \"865080040000000\",\n \"model\": 0,\n \"product\": 0,\n \"owner\": {\n \"id\": \"64de44366230ac4656cae\",\n \"username\": \"api@safetagtracking.com\"\n },\n \"subscription\": {\n \"id\": \"sub_id\",\n \"status\": \"active\",\n \"trialing\": false,\n \"trialed\": true,\n \"price\": 0,\n \"currency\": \"gbp\",\n \"term\": \"\",\n \"current_period_start\": null,\n \"current_period_end\": null,\n \"canceled_at\": \"2000-01-01T00:00:00.000Z\",\n \"created\": 0,\n \"interval\": 0,\n \"trial_days\": 7\n },\n \"prefs\": {\n \"name\": \"My Tracker\",\n \"category\": \"default\",\n \"marker\": \"default\",\n \"geofence\": {\n \"centre\": \"\",\n \"size\": 0\n },\n \"geofences\": [],\n \"speed_limit\": 0,\n \"alerts\": {\n \"battery\": false,\n \"geofence\": false,\n \"activated\": true,\n \"speed\": false,\n \"movement\": false,\n \"tamper\": false,\n \"acc\": false,\n \"schedules\": {\n \"movement\": [],\n \"geofence\": []\n }\n }\n },\n \"status\": {\n \"location\": \"51.398385,0.1104222222\",\n \"speed\": 0,\n \"course\": 0,\n \"status\": 11,\n \"battery\": 6,\n \"signal\": 100,\n \"geofence\": true,\n \"last_updated\": \"2024-04-11T13:44:42.000Z\",\n \"status_last_updated\": \"2024-04-11T15:58:37.888Z\",\n \"coords\": {\n \"lat\": 51.398385,\n \"lon\": 0.11042222222222223\n }\n }\n },\n " } } } } }, "400": { "description": "400", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } } }, "deprecated": false } } }, "x-readme": { "headers": [], "explorer-enabled": true, "proxy-enabled": true }, "x-readme-fauxas": true, "_id": "6615605350554d0012d9b15b:66156369f8e7be0051f4dccc" } ``` -------------------------------- ### GET /alerts/{username}/{device_id/all} Source: https://safetagtracking.readme.io/reference/get-alerts Retrieves alerts for a specific device or all devices associated with a user account. You can specify a device ID or use 'all' to get alerts for all trackers. An optional 'page' query parameter can be used to paginate through historical alerts when querying for 'all' trackers. ```APIDOC ## GET /alerts/{username}/{device_id/all} ### Description Retrieves alerts for a specific device or all devices associated with a user account. You can specify a device ID or use 'all' to get alerts for all trackers. An optional 'page' query parameter can be used to paginate through historical alerts when querying for 'all' trackers. ### Method GET ### Endpoint `/alerts/{username}/{device_id/all}` ### Parameters #### Path Parameters - **username** (string) - Required - Your account's email address - **device_id** (string) - Required - The device_id of the tracker whose alerts you're looking for. Or provide "all" to get all tracker alerts. #### Query Parameters - **page** (integer) - Optional - Which interval of the last 400 alerts to get when querying "all" tracker alerts ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **timestamp** (string) - The timestamp when the alert was generated. - **alert** (object) - Details about the alert. - **title** (string) - The title of the alert. - **body** (string) - A descriptive body of the alert. - **speed** (integer) - The speed recorded when the alert was triggered. - **location** (string) - The geographical coordinates (latitude, longitude) of the alert. - **category** (string) - The category of the alert (e.g., "speed"). #### Response Example ```json [ { "timestamp": "2024-04-11T08:25:13.406Z", "alert": { "title": "8650000000000 has exceeded its speed limit.", "body": "Your SafeTag Tracker has exceeded the speed limit you set of 31 MPH (Speed 34 MPH)", "speed": 55, "location": "51.390763333,0.0943116666" }, "category": "speed" }, { "timestamp": "2024-04-11T08:23:14.404Z", "alert": { "title": "8650800000000 has exceeded its speed limit.", "body": "Your SafeTag Tracker has exceeded the speed limit you set of 31 MPH (Speed 32 MPH)", "speed": 52, "location": "51.382308888,0.0881111111" }, "category": "speed" } ] ``` #### Error Response (400) (Details for 400 responses are not specified in the OpenAPI definition, typically indicates a bad request.) ``` -------------------------------- ### GET /user/{username} Source: https://safetagtracking.readme.io/reference/get-user Retrieves information about a specific user identified by their username (email address). ```APIDOC ## GET /user/{username} ### Description Retrieves information about a specific user identified by their username (email address). ### Method GET ### Endpoint `/user/{username}` ### Parameters #### Path Parameters - **username** (string) - Required - Your account's email address ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **_id** (string) - Unique identifier for the user - **username** (string) - The user's email address - **name** (string) - The user's name - **country** (string) - The user's country code - **locale** (string) - The user's locale setting - **contact** (boolean) - Indicates if the user is available for contact - **registered_on** (string) - Timestamp of user registration - **last_login** (string) - Timestamp of the last user login #### Response Example ```json { "_id": "64de4436ab26230ac4656cae", "username": "api@safetagtracking.com", "name": "Testing", "country": "GB", "locale": "en-GB", "contact": true, "registered_on": "2023-08-17T16:00:54.192Z", "last_login": "2024-04-11T14:45:04.543Z" } ``` ``` -------------------------------- ### PATCH /devices/activation/{username}/{state} Source: https://safetagtracking.readme.io/reference/activate-trackers Activates or deactivates trackers for a given user. This endpoint requires a custom activation plan setup and the tracker must be paired to your account. ```APIDOC ## PATCH /devices/activation/{username}/{state} ### Description This API Endpoint is only available if you have set up a custom activation plan with us directly. If that's you, you'll be receiving a custom monthly invoice for your whole account from us. Also, the tracker will need to be paired to your account, so if they don't appear in your account after ordering, please get in touch with us first. ### Method PATCH ### Endpoint https://api.safetagtracking.com/api/v1/devices/activation/{username}/{state} ### Parameters #### Path Parameters - **username** (string) - Required - Your account's email address - **state** (string) - Required - Activate (activate) or Cancel (cancel) Trackers #### Query Parameters - **contract** (string) - Optional - The ID String of the custom plan we've set up for you in our system. Please get in touch to receive the plan ID. #### Request Body - **devices** (array) - Required - A list of tracker IDs to activate or deactivate. - Each item in the array is a string representing a tracker ID. ### Request Example ```json { "devices": [ "083432042307", "082340843720" ] } ``` ### Response #### Success Response (200) This endpoint returns an empty JSON object `{}` upon successful activation or deactivation. #### Response Example ```json { "Result": {} } ``` ``` -------------------------------- ### Get User Source: https://safetagtracking.readme.io/reference/get-geofences-copy Retrieves user information based on the provided username. This endpoint allows you to fetch details of a specific user account. ```APIDOC ## GET /api/v1/user/{username} ### Description Retrieves user information based on the provided username. This endpoint allows you to fetch details of a specific user account. ### Method GET ### Endpoint https://api.safetagtracking.com/api/v1/user/{username} ### Parameters #### Path Parameters - **username** (string) - Required - Your account's email address. Defaults to you@email.com ### Request Example ```json { "example": "Request body not applicable for GET request" } ``` ### Response #### Success Response (200) - **_id** (string) - User's unique identifier - **username** (string) - User's email address - **name** (string) - User's full name - **country** (string) - User's country - **locale** (string) - User's locale - **contact** (boolean) - Indicates if the user wants to be contacted. Defaults to true. - **registered_on** (string) - Timestamp of user registration - **last_login** (string) - Timestamp of the last user login #### Response Example ```json { "_id": "60f1b2c3d4e5f6a7b8c9d0e1", "username": "you@email.com", "name": "John Doe", "country": "US", "locale": "en-US", "contact": true, "registered_on": "2023-01-01T10:00:00Z", "last_login": "2023-10-27T15:30:00Z" } ``` #### Error Response (400) - **error** (object) - Contains error details ```json { "error": { "code": "INVALID_USERNAME", "message": "The provided username is invalid." } } ``` ``` -------------------------------- ### Get Geofences Source: https://safetagtracking.readme.io/reference/get-geofences Retrieves a list of geofences associated with a specific username. Requires an X-API-KEY in the request headers. ```APIDOC ## GET /geofences/{username} ### Description Retrieves a list of geofences for a given user. ### Method GET ### Endpoint `/geofences/{username}` ### Parameters #### Path Parameters - **username** (string) - Required - Your account's email address ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **_id** (string) - The unique identifier for the geofence. - **name** (string) - The name of the geofence. - **colour** (string) - The color associated with the geofence. - **type** (string) - The shape type of the geofence (e.g., 'circle'). - **zone** (object) - Contains details about the geofence's zone. - **centre** (string) - The center coordinates of the zone (latitude,longitude). - **size** (number) - The size of the geofence zone. - **owner** (string) - The email address of the geofence owner. - **last_updated** (string) - The timestamp of the last update. #### Response Example ```json { "example": "[ { "_id": "65f3391a05ff9630025b501c", "name": "Warehouse", "colour": "pink", "type": "circle", "zone": { "centre": "51.02260,-0.14120", "size": 297.73 }, "owner": "api@safetagtracking.com", "last_updated": "2024-04-04T17:09:54.970Z" }, ]" } ``` ``` -------------------------------- ### Get Geofences OpenAPI Definition Source: https://safetagtracking.readme.io/reference/get-geofences This is the OpenAPI 3.1.0 definition for the SafeTag Tracking API. It outlines the 'get-geofences' operation, which allows retrieval of geofence data associated with a specific username. Authentication is handled via an 'X-API-KEY' header. ```json { "openapi": "3.1.0", "info": { "title": "SafeTag Tracking API", "version": "1.0" }, "servers": [ { "url": "https://api.safetagtracking.com/api/v1" } ], "components": { "securitySchemes": { "sec0": { "type": "apiKey", "in": "header", "name": "X-API-KEY" } } }, "security": [ { "sec0": [] } ], "paths": { "/geofences/{username}": { "get": { "summary": "Get Geofences", "description": "", "operationId": "get-geofences", "parameters": [ { "name": "username", "in": "path", "description": "Your account's email address", "schema": { "type": "string", "default": "you@email.com" }, "required": true } ], "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Result": { "value": "[ { "_id": "65f3391a05ff9630025b501c", "name": "Warehouse", "colour": "pink", "type": "circle", "zone": { "centre": "51.02260,-0.14120", "size": 297.73 }, "owner": "api@safetagtracking.com", "last_updated": "2024-04-04T17:09:54.970Z" }, ]" } } } } }, "400": { "description": "400", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } } }, "deprecated": false } } }, "x-readme": { "headers": [], "explorer-enabled": true, "proxy-enabled": true }, "x-readme-fauxas": true, "_id": "6615605350554d0012d9b15b:66156307ee3ee6005f9c84ae" } ``` -------------------------------- ### OpenAPI Definition for SafeTag Tracking API Source: https://safetagtracking.readme.io/reference/get-locations This JSON object defines the structure and endpoints of the SafeTag Tracking API. It includes server URLs, security schemes, and detailed path parameters for the 'Get Locations' endpoint. The definition specifies request parameters such as username, device ID, date range, and timezone, along with possible response codes. ```json { "openapi": "3.1.0", "info": { "title": "SafeTag Tracking API", "version": "1.0" }, "servers": [ { "url": "https://api.safetagtracking.com/api/v1" } ], "components": { "securitySchemes": { "sec0": { "type": "apiKey", "in": "header", "name": "X-API-KEY" } } }, "security": [ { "sec0": [] } ], "paths": { "/locations/range/{username}/{device_id}": { "get": { "summary": "Get Locations", "description": "", "operationId": "get-locations", "parameters": [ { "name": "username", "in": "path", "description": "Your account's email address", "schema": { "type": "string", "default": "you@email.com" }, "required": true }, { "name": "device_id", "in": "path", "description": "Tracker IMEI for tracker you'd like to see history for", "schema": { "type": "string", "default": "86523470237402" }, "required": true }, { "name": "start", "in": "query", "description": "The start date for location history in YYYY-MM-DD", "schema": { "type": "string", "default": "2022-02-22" } }, { "name": "end", "in": "query", "description": "The end date for location history in YYYY-MM-DD format", "schema": { "type": "string", "default": "2022-04-22" } }, { "name": "tz", "in": "query", "description": "Add an IANA format timezone to get the precise start of date and end of date in your timezone. Omit for UTC.", "schema": { "type": "string", "default": "Europe/London" } } ], "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } }, "400": { "description": "400", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } } }, "deprecated": false } } }, "x-readme": { "headers": [], "explorer-enabled": true, "proxy-enabled": true }, "x-readme-fauxas": true, "_id": "6615605350554d0012d9b15b:661565b3f1ca720052caa91a" } ``` -------------------------------- ### GET /locations/range/{username}/{device_id} Source: https://safetagtracking.readme.io/reference/get-locations Retrieves location history for a specific device within a given date range. The 'Distance' header in the response contains the total kilometers traveled during the specified period. ```APIDOC ## GET /locations/range/{username}/{device_id} ### Description Retrieves location history for a specific device within a given date range. The 'Distance' header in the response contains the total kilometers traveled during the specified period. ### Method GET ### Endpoint /locations/range/{username}/{device_id} ### Parameters #### Path Parameters - **username** (string) - Required - Your account's email address - **device_id** (string) - Required - Tracker IMEI for tracker you'd like to see history for #### Query Parameters - **start** (string) - Optional - The start date for location history in YYYY-MM-DD - **end** (string) - Optional - The end date for location history in YYYY-MM-DD format - **tz** (string) - Optional - Add an IANA format timezone to get the precise start of date and end of date in your timezone. Omit for UTC. ### Request Example ```json { "username": "you@email.com", "device_id": "86523470237402", "start": "2022-02-22", "end": "2022-04-22", "tz": "Europe/London" } ``` ### Response #### Success Response (200) - **(object)** - The response body is an empty object as per the OpenAPI definition, actual location data might be within the response payload or headers. #### Response Example ```json { "Distance": "150.5km" } ``` ``` -------------------------------- ### WebSocket Stream API Source: https://safetagtracking.readme.io/reference/websocket-early-access Connect to this WebSocket endpoint to receive a continuous stream of location data for your trackers. Ensure you include the necessary authentication headers. ```APIDOC ## WebSocket Stream ### Description Connect to the WebSocket to receive periodic arrays of IDs and Location Payloads for real-time data streaming. You are limited to 5 open connections per account. ### Method Connect via WebSocket ### Endpoint wss://api.safetagtracking.com/api/v1/stream ### Parameters #### Headers - **X-API-KEY** (string) - Required - Your API Key for authentication. - **username** (string) - Required - Your account username or email for authentication. ### Response #### Success Response (200) - **Array of Status Objects**: Each object contains tracker information including ID and status details. #### Response Example ```json [ { "_id": "865080040008275", "status": { "location": "", "speed": 0, "course": 0, "status": 0, "battery": 101, "signal": 0, "geofence": true, "last_updated": "", "status_last_updated": "", "coords": {}, "relay": false, "power": false } } ] ``` *See [Get Trackers](https://safetagtracking.readme.io/reference/get-trackers) endpoint for details on the Status object values.* ``` -------------------------------- ### Enable/Disable Tracker Alerts (OpenAPI) Source: https://safetagtracking.readme.io/reference/enabledisable-tracker-alerts This OpenAPI definition details the PATCH endpoint for enabling or disabling various tracker alerts. It specifies the request parameters, including username and device ID, and the request body schema which allows toggling alerts like geofence, activated, tamper, speed, movement, battery, turning, accel, and deccel. The endpoint returns a 200 status on success or 400 on failure. ```json { "openapi": "3.1.0", "info": { "title": "SafeTag Tracking API", "version": "1.0" }, "servers": [ { "url": "https://api.safetagtracking.com/api/v1" } ], "components": { "securitySchemes": { "sec0": { "type": "apiKey", "in": "header", "name": "X-API-KEY" } } }, "security": [ { "sec0": [] } ], "paths": { "/devices/{username}/{device_id}/alerts": { "patch": { "summary": "Enable/Disable Tracker Alerts", "description": "", "operationId": "enabledisable-tracker-alerts", "parameters": [ { "name": "username", "in": "path", "description": "Your account's email address", "schema": { "type": "string", "default": "you@email.com" }, "required": true }, { "name": "device_id", "in": "path", "description": "The IMEI of the tracker whose alerts you want to modify", "schema": { "type": "string", "default": "98073480734922" }, "required": true } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "geofence": { "type": "boolean", "description": "Exiting or entering geofences enabled on the tracker" }, "activated": { "type": "boolean", "description": "Notifications when the tracker is activated, cancelled or is overdue" }, "tamper": { "type": "boolean", "description": "[Wired Only] Receive a notification when the tracker is removed from it's power source" }, "speed": { "type": "boolean", "description": "Notification if the tracker exceeds the speed limit applied to it by the owner" }, "movement": { "type": "boolean", "description": "Be notified when the tracker starts moving (exceeds 3 KPH) and stops moving (goes below 3 KPH)" }, "battery": { "type": "boolean", "description": "[Rechargeable Only] Low battery notification to indicate when your tracker needs a recharge" }, "turning": { "type": "boolean", "description": "[Plug 4G 2nd Gen] Sharp Turning Alert" }, "accel": { "type": "boolean", "description": "[Plug 4G 2nd Gen] Harsh Acceleration Alert" }, "deccel": { "type": "boolean", "description": "[Plug 4G 2nd Gen] Sudden Braking Alert" } } } } } }, "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } }, "400": { "description": "400", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } } }, "deprecated": false } } }, "x-readme": { "headers": [], "explorer-enabled": true, "proxy-enabled": true }, "x-readme-fauxas": true, "_id": "6615605350554d0012d9b15b:68c2c74df0190594cf428b52" } ``` -------------------------------- ### Rate Limiting Policy Source: https://safetagtracking.readme.io/reference/rate-limiting Details the rate limiting policy for API requests. ```APIDOC ## Rate Limiting Policy ### Description This section details the rate limiting policy for all API requests. Your account is subject to a limit on the number of requests you can make within a specific time frame. ### Method N/A (This is a policy description, not a specific endpoint) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## Discussion If you need to discuss a raised rate limit or require an increase, please contact support. ```