UrbanReflex Documentation
Everything you need to build with UrbanReflex platform
Introduction
Welcome to UrbanReflex documentation. This guide will help you integrate our platform into your applications and make the most of our road network and community reporting features.
Note: Our API is currently in beta. Features and endpoints may change.
Quick Start
Get started with UrbanReflex in just a few minutes.
npm install @urbanreflex/sdkimport { UrbanReflex } from '@urbanreflex/sdk';
const client = new UrbanReflex({
apiKey: 'your-api-key'
});
// Fetch road segments
const roads = await client.roads.list();Installation
Multiple ways to integrate UrbanReflex into your project.
NPM
npm install @urbanreflex/sdkYarn
yarn add @urbanreflex/sdkDirect API Access
You can also access our API directly without SDK:
curl https://api.urbanreflex.com/api/ngsi-ld?type=RoadSegment&limit=10Authentication
All API requests require authentication using an API key.
Getting your API Key
- Sign in to your UrbanReflex account
- Navigate to Settings → API Keys
- Click "Generate New Key"
- Copy and securely store your key
API Endpoints
API v1 - Public API
LatestMain API for accessing NGSI-LD data with powerful features: timeframe filtering, entity selection, and date range queries.
/api/v1/{apiKey}Authentication
API key is placed directly in the URL path. Format: ur_xxxxxxxxxxxxx
GET /api/v1/ur_YOUR_API_KEY_HERE
Note: API key must start with ur_. You can create a new API key on the Profile → API Keys page.
Query Parameters
Timeframe
timeframeChoose how to retrieve data by time:
latest- Get latest dataWeatherObserved: 1 latest record | AirQualityObserved: 1 latest record for each station (10 stations)
alltime- Get all data (default)custom- Filter by time rangeRequires: startDate and/or endDate (ISO 8601 format)
Entity Selection
entitiesSelect specific entity types to retrieve (comma-separated):
Static Data
Static DataRoadSegment(~5,000)Streetlight(~17,500)PointOfInterest
Dynamic Data
Dynamic DataWeatherObserved(1 OWM)AirQualityObserved(10 OpenAQ)CitizenReportRoadReport
Other Parameters
typeSingle entity type (legacy, use entities instead)
limitNumber of items per page (max: 1000, default: 1000)
offsetOffset for pagination
optionsFormat options (keyValues, etc.)
startDateStart date (ISO 8601, for custom timeframe)
endDateEnd date (ISO 8601, for custom timeframe)
unwrappedReturn array directly (backward compatibility)
Examples
Get latest data for all types
GET /api/v1/ur_YOUR_API_KEY?timeframe=latest
Get only latest WeatherObserved
GET /api/v1/ur_YOUR_API_KEY?entities=WeatherObserved&timeframe=latest
Get only CitizenReport (all)
GET /api/v1/ur_YOUR_API_KEY?entities=CitizenReport&timeframe=alltime
Get latest OpenAQ and OWM
GET /api/v1/ur_YOUR_API_KEY?entities=WeatherObserved,AirQualityObserved&timeframe=latest
Get CitizenReport in November 2025
GET /api/v1/ur_YOUR_API_KEY?entities=CitizenReport&timeframe=custom&startDate=2025-11-01T00:00:00Z&endDate=2025-11-30T23:59:59Z
Get all RoadSegment and Streetlight
GET /api/v1/ur_YOUR_API_KEY?entities=RoadSegment,Streetlight&timeframe=alltime
Response Format
Wrapped Format
DefaultUsed when timeframe or entities parameter is present
{
"success": true,
"data": [
// Array of entities
],
"meta": {
"total": 100,
"types": ["WeatherObserved", "AirQualityObserved"],
"timeframe": "latest",
"startDate": null,
"endDate": null,
"timestamp": "2025-12-03T10:00:00.000Z"
}
}Unwrapped Format
Backward CompatibleReturns array directly, compatible with old code
[ // Array of entities directly ]
Add ?unwrapped=true to use this format
/api/reportsSubmit community reports
Request Body
{
"location": {
"type": "Point",
"coordinates": [106.629664, 10.823099]
},
"description": "Pothole on main road",
"category": "road_damage",
"images": ["url1", "url2"]
}Rate Limits
API rate limits to ensure fair usage for all users.
Current Limits
Rate Limit Headers
Every API response includes rate limit information:
X-RateLimit-Limit- Maximum requests allowedX-RateLimit-Remaining- Requests remainingX-RateLimit-Reset- Time when limit resets
Error Codes
Understanding API error responses.
400 Bad RequestInvalid request parameters or malformed JSON
401 UnauthorizedMissing or invalid API key
429 Too Many RequestsRate limit exceeded. Wait before making more requests
500 Internal Server ErrorServer error. Please try again later or contact support
Example Error Response:
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Rate limit exceeded. Try again in 3600 seconds.",
"statusCode": 429
}
}Road Data
Access detailed road network information including segments, properties, and metadata.
Road Segment Properties
- name: Road name or identifier
- roadType: Classification (primary, secondary, tertiary, residential)
- length: Segment length in meters
- laneCount: Number of lanes
- surface: Road surface type (asphalt, concrete, etc.)
- location: GeoJSON LineString coordinates
Example: Fetch roads by type
// Fetch primary roads
const response = await fetch(
'https://api.urbanreflex.com/api/ngsi-ld?type=RoadSegment&roadType=primary&limit=20'
);
const roads = await response.json();
// Filter by location (within bounds)
roads.filter(road => {
const coords = road.location.coordinates;
return isWithinBounds(coords, myBounds);
});Community Reports
Enable users to submit and view road issue reports.
Report Categories
Example: Submit a report
const report = {
location: {
type: "Point",
coordinates: [106.629664, 10.823099]
},
description: "Large pothole causing vehicle damage",
category: "road_damage",
severity: "high",
images: [imageFile1, imageFile2]
};
const response = await fetch('https://api.urbanreflex.com/api/reports', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify(report)
});Real-time Updates
Subscribe to real-time data updates using WebSocket connections.
⚡ WebSocket API
Connect to: wss://api.urbanreflex.com/ws
Receive instant notifications when new reports are submitted or road data is updated.
Example: WebSocket connection
const ws = new WebSocket('wss://api.urbanreflex.com/ws');
ws.onopen = () => {
// Subscribe to updates in a specific area
ws.send(JSON.stringify({
action: 'subscribe',
channel: 'reports',
filter: {
bounds: {
north: 10.9,
south: 10.7,
east: 106.8,
west: 106.6
}
}
}));
};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log('New report:', data);
// Update your UI with new report
};Platform Overview
UrbanReflex is a comprehensive platform for urban road network data and community reporting.
Key Features
- ✓Road Network Visualization: Interactive map with detailed road segments
- ✓Community Reporting: Real-time issue reporting and tracking
- ✓Open Data: Free access to road infrastructure data
- ✓RESTful API: Easy integration with your applications
Examples
Common use cases and code examples.
SDKs & Libraries
Official and community-maintained SDKs for different programming languages.
Python
Coming Q1 2025
pip install urbanreflexWant to contribute?
We welcome community contributions! If you'd like to create an SDK for another language, check out our SDK guidelines on GitHub.