Download OpenAPI specification:
The Operations API allows third party access to Urban Sharing operator functionality.
The API provides access to the following data:
The Operations API sends events to webhooks. The available events are:
| Date | Version | Notes |
|---|---|---|
| Thu Oct 31 2024 | 1.9.0 | Add isAvailable to vehicles |
| Mon Sep 02 2024 | 1.8.0 | Add title to dock-groups |
| Thu Aug 22 2024 | 1.7.0 | Add GET asset-types Add tags and damage IDs to vehicle statuses Add tags to dock groups |
| Mon Jul 29 2024 | 1.6.0 | Add vehicle location to vehicle endpoints Add GET operation-location and GET operations-location/:operationLocationId endpoints |
| Thu Apr 18 2024 | 1.5.0 | Add vehicles/gbfs/:vehicleId endpoint Add vehicles/qrCode/:qrCode endpoint |
| Mon Nov 20 2023 | 1.1.0 | Add operations API webhooks - trips, alerts, faults, connectivity, damage and lost |
| Wed Nov 15 2023 | 1.0.4 | Add reported and max virtual dock count to dock groups |
| Wed Aug 30 2023 | 1.0.3 | Update the description of the trips endpoint |
| Mon Aug 28 2023 | 1.0.2 | Remove deprecated "with_administrator" state from externalState |
| Sun Aug 27 2023 | 1.0.1 | Moved all array responses to row property. e.g. [ data ] -> { rows: [ data ] } |
| Tue Aug 15 2023 | 1.0.0 | Initial release |
| Sun Jan 22 2023 | 1.4.0 | Remove "operations/" prefix from all webhooks |
To use this API you must first obtain API credentials from Urban Sharing. These API credentials can then be used to generate a JWT token which must be passed in the Authorization header when accessing resources in this API.
For more information, please refer to the Urban Sharing Auth API
Urban Sharing generates webhook signatures using a hash-based message authentication code (HMAC) with SHA-256. You can validate the signature of the request body as follows:
validateWebhookSignature(
clientSecret: string,
signature: string,
data: unknown,
maxAgeMs = 5000,
): boolean {
const [timestampPair, ...signatures] = signature.split(',');
const timestamp = +timestampPair.split('=')[1];
// Check that the timestamp is not too old
if (maxAgeMs > 0) {
const latestTimestamp = new Date().getTime() - maxAgeMs;
if (timestamp < latestTimestamp) {
return false;
}
}
// Convert signatures into an object
const signatureObject: any = signatures.reduce((acc, curr) => {
const [key, value] = curr.split('=');
acc[key] = value;
return acc;
}, {});
// Build the signed payload
const signed_payload = `${timestamp}.${JSON.stringify(data)}`;
// Validate the v0 signature
if (signatureObject.v0) {
const expectedSignature = crypto
.createHmac('sha256', clientSecret)
.update(signed_payload)
.digest('hex');
return signatureObject.v0 === expectedSignature;
}
return false;
}
Urban Sharing APIs refer to docks, dock groups and vehicles as our platform is designed to support multiple modes of transport. In the case of bike share systems, docks are individual bike parking spots, dock groups are stations and vehicles are bikes.
Returns a list of static vehicle data
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "rows": [
- {
- "id": 4554,
- "assetModelId": 4112,
- "name": "Vehicle 1",
- "number": "42",
- "category": "ebike",
- "qrCode": "424242",
- "externalId": "2469394",
- "broken": true,
- "state": "on_trip",
- "location": {
- "timestamp": "2019-08-24T14:15:22Z",
- "coords": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}, - "dock": {
- "dockGroupId": 2232,
- "dockNumber": 21
}, - "operationLocationId": 0
}, - "charge": 95,
- "lowBattery": false,
- "tags": [
- "red",
- "big wheels"
], - "damageIds": [
- 43,
- 546
], - "lastSeen": "2020-01-01T00:00:00Z",
- "isAvailable": true,
- "blockedAt": "2020-01-01T00:00:00Z",
- "lockMechanismState": "locked",
- "iotCharge": 85
}
]
}Returns a list of vehicle statuses
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "rows": [
- {
- "id": 4554,
- "assetModelId": 4112,
- "name": "Vehicle 1",
- "number": "42",
- "category": "ebike",
- "qrCode": "424242",
- "externalId": "2469394",
- "broken": true,
- "state": "on_trip",
- "location": {
- "timestamp": "2019-08-24T14:15:22Z",
- "coords": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}, - "dock": {
- "dockGroupId": 2232,
- "dockNumber": 21
}, - "operationLocationId": 0
}, - "charge": 95,
- "lowBattery": false,
- "tags": [
- "red",
- "big wheels"
], - "damageIds": [
- 43,
- 546
], - "lastSeen": "2020-01-01T00:00:00Z",
- "isAvailable": true,
- "blockedAt": "2020-01-01T00:00:00Z",
- "lockMechanismState": "locked",
- "iotCharge": 85
}
]
}Returns a single vehicle status
| vehicleId required | number |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "id": 4554,
- "assetModelId": 4112,
- "name": "Vehicle 1",
- "number": "42",
- "category": "ebike",
- "qrCode": "424242",
- "externalId": "2469394",
- "broken": true,
- "state": "on_trip",
- "location": {
- "timestamp": "2019-08-24T14:15:22Z",
- "coords": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}, - "dock": {
- "dockGroupId": 2232,
- "dockNumber": 21
}, - "operationLocationId": 0
}, - "charge": 95,
- "lowBattery": false,
- "tags": [
- "red",
- "big wheels"
], - "damageIds": [
- 43,
- 546
], - "lastSeen": "2020-01-01T00:00:00Z",
- "isAvailable": true,
- "blockedAt": "2020-01-01T00:00:00Z",
- "lockMechanismState": "locked",
- "iotCharge": 85
}Returns a single vehicle
| vehicleId required | number |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "id": 4554,
- "assetModelId": 4112,
- "name": "Vehicle 1",
- "number": "42",
- "category": "ebike",
- "qrCode": "424242",
- "externalId": "2469394",
- "broken": true,
- "state": "on_trip",
- "location": {
- "timestamp": "2019-08-24T14:15:22Z",
- "coords": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}, - "dock": {
- "dockGroupId": 2232,
- "dockNumber": 21
}, - "operationLocationId": 0
}, - "charge": 95,
- "lowBattery": false,
- "tags": [
- "red",
- "big wheels"
], - "damageIds": [
- 43,
- 546
], - "lastSeen": "2020-01-01T00:00:00Z",
- "isAvailable": true,
- "blockedAt": "2020-01-01T00:00:00Z",
- "lockMechanismState": "locked",
- "iotCharge": 85
}Sends a command to a vehicle
| vehicleId required | number |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
| operatorId required | string The ID of the operator performing the command. This is used for validation and logging purposes |
| commandType required | string Enum: "unlock" "battery_unlock" The type of command to send to the vehicle |
| parameters | Array of strings Optional parameters to send with the command |
{- "operatorId": "oper_2435",
- "commandType": "battery_unlock",
- "parameters": [ ]
}{- "status": "OK"
}Returns a list of vehicle repairs
| vehicleId required | number |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
| operatorId required | string The ID of the operator performing the repair. This is used for validation and logging purposes |
required | Array of objects (OperationsVehicleRepairDamageType) The damage types that have been repaired |
Array of objects (OperationsVehicleRepairType) The repair types that have been performed. These are custom repairs performed outside of the necessary repairs dictated by the damageTypes. Repairs done as part of repairing a specific damage type should be specified inside the damageTypes instead. This property is used to log additional repairs that are not directly related to an active damage type. | |
| startedAt | string <date-time> When the maintenance operation was started |
{- "operatorId": "oper_2435",
- "damageTypes": [
- {
- "id": 1,
- "repairType": {
- "id": 1,
- "parts": [
- 1,
- 2,
- 3
]
}
}
], - "repairTypes": [
- {
- "id": 1,
- "parts": [
- 1,
- 2,
- 3
]
}
], - "startedAt": "2024-12-31T23:59:59.999Z"
}{- "status": "OK"
}Returns a list of trips that have ended filtered by year, month and optional day. The timezone of the system is used for the trip end date.
| year required | number [ 2000 .. 3000 ] Example: year=2012 Select data for a specific year |
| month required | number [ 1 .. 12 ] Example: month=7 Select data for a specific month |
| day | number [ 1 .. 31 ] Example: day=14 Select data for a specific day - optional |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "rows": [
- {
- "state": "starting",
- "vehicle": {
- "id": 4554,
- "assetModelId": 4112,
- "name": "Vehicle 1",
- "number": "42",
- "category": "ebike",
- "qrCode": "424242",
- "externalId": "2469394"
}, - "startedAtLocation": {
- "timestamp": "2019-08-24T14:15:22Z",
- "coords": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}, - "dock": {
- "dockGroupId": 2232,
- "dockNumber": 21
}, - "operationLocationId": 0
}, - "endedAtLocation": {
- "timestamp": "2019-08-24T14:15:22Z",
- "coords": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}, - "dock": {
- "dockGroupId": 2232,
- "dockNumber": 21
}, - "operationLocationId": 0
}
}
]
}Returns a list of static dock group data
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "rows": [
- {
- "id": 8787,
- "name": "Station1",
- "title": "Station 1",
- "location": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}, - "elevation": 0,
- "state": "active",
- "physicalDockCount": 20,
- "virtualDockCount": 5,
- "reportedVirtualDockCount": 10,
- "maxVirtualDockCount": 15,
- "tags": [
- "broken",
- "batch#3"
], - "availabilityInfo": { },
- "controller": { }
}
]
}Returns all dock group data
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "rows": [
- {
- "id": 8787,
- "name": "Station1",
- "title": "Station 1",
- "location": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}, - "elevation": 0,
- "state": "active",
- "physicalDockCount": 20,
- "virtualDockCount": 5,
- "reportedVirtualDockCount": 10,
- "maxVirtualDockCount": 15,
- "tags": [
- "broken",
- "batch#3"
], - "availabilityInfo": { },
- "controller": { }
}
]
}Returns a list of dock group statuses
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "rows": [
- {
- "id": 8787,
- "online": true,
- "state": "active"
}
]
}Returns a single dock group status
| dockGroupId required | number |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "id": 8787,
- "online": true,
- "state": "active"
}Returns a single dock group
| dockGroupId required | number |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "id": 8787,
- "name": "Station1",
- "title": "Station 1",
- "location": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}, - "elevation": 0,
- "state": "active",
- "physicalDockCount": 20,
- "virtualDockCount": 5,
- "reportedVirtualDockCount": 10,
- "maxVirtualDockCount": 15,
- "tags": [
- "broken",
- "batch#3"
], - "availabilityInfo": { },
- "controller": { }
}Returns a single dock group
| dockGroupId required | number |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "id": 8787,
- "name": "Station1",
- "title": "Station 1",
- "location": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}, - "elevation": 0,
- "state": "active",
- "physicalDockCount": 20,
- "virtualDockCount": 5,
- "reportedVirtualDockCount": 10,
- "maxVirtualDockCount": 15,
- "tags": [
- "broken",
- "batch#3"
], - "availabilityInfo": { },
- "controller": { }
}Returns vehicle data based on its QR code.
| qrCode required | string |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "id": 4554,
- "assetModelId": 4112,
- "name": "Vehicle 1",
- "number": "42",
- "category": "ebike",
- "qrCode": "424242",
- "externalId": "2469394",
- "broken": true,
- "state": "on_trip",
- "location": {
- "timestamp": "2019-08-24T14:15:22Z",
- "coords": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}, - "dock": {
- "dockGroupId": 2232,
- "dockNumber": 21
}, - "operationLocationId": 0
}, - "charge": 95,
- "lowBattery": false,
- "tags": [
- "red",
- "big wheels"
], - "damageIds": [
- 43,
- 546
], - "lastSeen": "2020-01-01T00:00:00Z",
- "isAvailable": true,
- "blockedAt": "2020-01-01T00:00:00Z",
- "lockMechanismState": "locked",
- "iotCharge": 85
}Returns vehicle data based on the its GBFS ID.
| gbfsId required | string |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "id": 4554,
- "assetModelId": 4112,
- "name": "Vehicle 1",
- "number": "42",
- "category": "ebike",
- "qrCode": "424242",
- "externalId": "2469394",
- "broken": true,
- "state": "on_trip",
- "location": {
- "timestamp": "2019-08-24T14:15:22Z",
- "coords": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}, - "dock": {
- "dockGroupId": 2232,
- "dockNumber": 21
}, - "operationLocationId": 0
}, - "charge": 95,
- "lowBattery": false,
- "tags": [
- "red",
- "big wheels"
], - "damageIds": [
- 43,
- 546
], - "lastSeen": "2020-01-01T00:00:00Z",
- "isAvailable": true,
- "blockedAt": "2020-01-01T00:00:00Z",
- "lockMechanismState": "locked",
- "iotCharge": 85
}Returns a list of operation locations
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "rows": [
- {
- "id": 8787,
- "name": "Station1",
- "type": "storage",
- "location": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}
}
]
}Returns a single operation location
| operationLocationId required | number |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "id": 8787,
- "name": "Station1",
- "type": "storage",
- "location": {
- "latitude": 59.9138688,
- "longitude": 10.74609,
- "streetAddress": "Karl Johans gate 1"
}
}Returns the asset types
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
{- "rows": [
- {
- "id": 4554,
- "name": "Acme Bike",
- "type": "ebike",
- "vehicleCategory": "bike_with_childseat",
- "batteryMaxRangeM": 100,
- "lowBatteryThreshold": 20,
- "emptyBatteryThreshold": 1,
- "damageTypes": [
- {
- "id": 65,
- "description": "Broken chain",
- "critical": true
}
]
}
]
}Reports system alerts
| Api-Client-ID required | string The ID of the API client associated with this webhook. |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
| Urbansharing-Signature required | string Used to verify the authenticity of the webhook request. For information about how to validate the signature, see here. |
| id required | string The ID of the asset type associated with the event |
| entityType required | string Enum: "controller_id" "vehicle_id" "dock_group_id" "dock_id" "unknown" The Asset type associated with the event |
| generated required | string <date-time> The timestamp of the event |
| status required | string Enum: "started" "finished" The status of the alert |
| code | string The alert code |
| description required | string The description of the alert |
{- "id": "123",
- "entityType": "controller_id",
- "generated": "2019-08-24T14:15:22Z",
- "status": "started",
- "code": "42",
- "description": "Something wonderful has happened!"
}Reports fault events
| Api-Client-ID required | string The ID of the API client associated with this webhook. |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
| Urbansharing-Signature required | string Used to verify the authenticity of the webhook request. For information about how to validate the signature, see here. |
| id required | string The ID of the asset type associated with the event |
| entityType required | string Enum: "controller_id" "vehicle_id" "dock_group_id" "dock_id" "unknown" The Asset type associated with the event |
| generated required | string <date-time> The timestamp of the event |
| status required | string Enum: "started" "finished" The status of the fault |
| code | string The fault code |
| description required | string The description of the fault |
{- "id": "123",
- "entityType": "controller_id",
- "generated": "2019-08-24T14:15:22Z",
- "status": "started",
- "code": "123",
- "description": "Something terrible has happened!"
}Reports system lost events
| Api-Client-ID required | string The ID of the API client associated with this webhook. |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
| Urbansharing-Signature required | string Used to verify the authenticity of the webhook request. For information about how to validate the signature, see here. |
| id required | string The ID of the asset type associated with the event |
| entityType required | string Enum: "controller_id" "vehicle_id" "dock_group_id" "dock_id" "unknown" The Asset type associated with the event |
| generated required | string <date-time> The timestamp of the event |
| status required | string Enum: "started" "finished" Whether or not the lost event has started or finished |
{- "id": "123",
- "entityType": "controller_id",
- "generated": "2019-08-24T14:15:22Z",
- "status": "started"
}Reports connectivity events
| Api-Client-ID required | string The ID of the API client associated with this webhook. |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
| Urbansharing-Signature required | string Used to verify the authenticity of the webhook request. For information about how to validate the signature, see here. |
| id required | string The ID of the asset type associated with the event |
| entityType required | string Enum: "controller_id" "vehicle_id" "dock_group_id" "dock_id" "unknown" The Asset type associated with the event |
| generated required | string <date-time> The timestamp of the event |
| online required | boolean Whether or not the event caused the asset to go online or offline |
{- "id": "123",
- "entityType": "controller_id",
- "generated": "2019-08-24T14:15:22Z",
- "online": true
}Reports damage events
| Api-Client-ID required | string The ID of the API client associated with this webhook. |
| uowid | string A globally unique unit of work ID generated by the client which allows Urban Sharing to track requests through our systems. If no header is provided it will be generated automatically at the time of arrival. The header and ID will be returned in the response. |
| Urbansharing-Signature required | string Used to verify the authenticity of the webhook request. For information about how to validate the signature, see here. |
| id required | string The ID of the asset type associated with the event |
| entityType required | string Enum: "controller_id" "vehicle_id" "dock_group_id" "dock_id" "unknown" The Asset type associated with the event |
| generated required | string <date-time> The timestamp of the event |
| status required | string Enum: "ok" "damaged" "broken" The status of the damage |
| damage | Array of strings The damage details |
{- "id": "123",
- "entityType": "controller_id",
- "generated": "2019-08-24T14:15:22Z",
- "status": "broken",
- "damage": [
- "Broken wheel"
]
}