Kanton Zürich Online Data API
Ongoing and calculated vehicle data and aggregations.
Operations 2
GET
/public-service/readOnlineAggregationData/{aggregationtype}/{collectorid}
Read online aggregation data
#
Ongoing and calculated vehicle data and aggregations.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/zh-ch:zh-ch-online-data-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Zh Ch Online Data API
version: 1.1.4
contact:
name: Baudirektion Kanton Zürich, Tiefbauamt
email: kurt.amstad@bd.zh.ch
license:
name: No public licensed
description: 'Operations tagged Online Data across 2 of this provider''s published API definitions: vdp-zh-ch-openapi.json, zh-ch-traffic-counts-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://vdp.zh.ch/pws
tags:
- name: Online Data
description: Ongoing and calculated vehicle data and aggregations.
paths:
/public-service/readOnlineVbvData/{collectorid}:
get:
tags:
- Online Data
description: Reads the ongoing online vbv data.
operationId: readOnlineVbvData
parameters:
- name: collectorid
in: path
description: "Collector ID.\n\n A list of all collectors can be found <a href=\"https://maps.zh.ch/?topic=TBAVMSZH&offlayers=bezirkslabels\" target=\"_blank\">here</a> (prefix with M compared to the IDs from the link, e.g. use M0197 instead of 0197)."
required: true
schema:
type: string
example: M0197
- name: sampleOnly
in: query
description: "Return only one sample. \n\n The maximum waiting time until the first sample currently is 15 seconds."
required: true
schema:
type: boolean
example: true
responses:
'403':
description: Collector not allowed
content:
application/json: {}
'404':
description: Collector not found
content:
application/json: {}
'200':
description: Successful operation
content:
application/stream+json:
schema:
oneOf:
- $ref: '#/components/schemas/VbvData'
- $ref: '#/components/schemas/Heartbeat'
application/x-ndjson:
schema:
oneOf:
- $ref: '#/components/schemas/VbvData'
- $ref: '#/components/schemas/Heartbeat'
text/event-stream:
schema:
oneOf:
- $ref: '#/components/schemas/VbvData'
- $ref: '#/components/schemas/Heartbeat'
'504':
description: Token for authentication could not be received
content:
application/json: {}
summary: Read online vbv data
x-summary-source: derived
servers:
- url: https://vdp.zh.ch/pws
/public-service/readOnlineAggregationData/{aggregationtype}/{collectorid}:
get:
tags:
- Online Data
description: Reads the ongoing calculated aggregation data.
operationId: readOnlineAggregationData
parameters:
- name: aggregationtype
in: path
description: Aggregation type, relevant for received aggregation format. VDP stands for "Verkehrsdatenplattform".
required: true
schema:
type: string
description: Specifies the different aggregation format types.
enum:
- VDP
example: VDP
- name: collectorid
in: path
description: "Collector ID.\n\n A list of all collectors can be found <a href=\"https://maps.zh.ch/?topic=TBAVMSZH&offlayers=bezirkslabels\" target=\"_blank\">here</a> (prefix with M compared to the IDs from the link, e.g. use M0197 instead of 0197)."
required: true
schema:
type: string
example: M0197
- name: sampleOnly
in: query
description: "Return only one sample. \n\n The maximum waiting time until the first sample currently is 360 seconds."
required: true
schema:
type: boolean
example: true
responses:
'403':
description: Collector not allowed
content:
application/json: {}
'422':
description: Invalid aggregation type
content:
application/json: {}
'404':
description: Collector not found
content:
application/json: {}
'200':
description: Successful operation
content:
application/stream+json:
schema:
oneOf:
- $ref: '#/components/schemas/AggVdp'
- $ref: '#/components/schemas/Heartbeat'
application/x-ndjson:
schema:
oneOf:
- $ref: '#/components/schemas/AggVdp'
- $ref: '#/components/schemas/Heartbeat'
text/event-stream:
schema:
oneOf:
- $ref: '#/components/schemas/AggVdp'
- $ref: '#/components/schemas/Heartbeat'
'504':
description: Token for authentication could not be received
content:
application/json: {}
summary: Read online aggregation data
x-summary-source: derived
servers:
- url: https://vdp.zh.ch/pws
components:
schemas:
AggVdp:
type: object
properties:
uniqueId:
$ref: '#/components/schemas/UniqueId'
intBegin:
type: integer
description: Begin of calculation. Time in [ms] since unix epoche.
format: int64
example: 1602579300000
intDuration:
type: integer
description: Duration of calculation in [ms]
format: int32
example: 300
statistics:
type: array
description: Calculated statistic details
items:
$ref: '#/components/schemas/AggVdpDetail'
description: Aggregations calculated from vehicle data in vdp format.
Heartbeat:
type: object
properties:
alive:
type: integer
format: int32
example: 1
description: Heartbeat message.
example:
alive: 1
AggVdpDetail:
type: object
properties:
aggClass:
type: string
description: 'Aggregation class. Can be one of the following values
<ul><li>AGG2CLASS_BUS: Bus</li>
<li>AGG2CLASS_MR: Motorcycle</li>
<li>AGG2CLASS_PW: Passenger car</li>
<li>AGG2CLASS_PWA: Passenger car with trailer</li>
<li>AGG2CLASS_LFW: Delivery van</li>
<li>AGG2CLASS_LFWA: Delivery van with trailer</li>
<li>AGG2CLASS_LFWAL: Delivery van with semitrailer</li>
<li>AGG2CLASS_LKW: Truck</li>
<li>AGG2CLASS_LZ: Lorry train</li>
<li>AGG2CLASS_SZ: Semitrailer</li>
<li>AGG2CLASS_ALL: All classes</li>
<li>AGG2CLASS_UNDEFINED: Undefined classes</li>
<li>AGG2CLASS_HEAVY: Heavy vehicles</li>
<li>AGG2CLASS_NOISY: Noisy vehicles</li></ul>
'
flow:
type: integer
description: Number of vehicles per hour.
format: int32
example: 60
count:
type: integer
description: Number of vehicles having speed information.
format: int32
example: 5
countAll:
type: integer
description: Number of vehicles. Vehicles are counted regardless of whether speed information is available or not.
format: int32
avg:
type: number
description: Average speed in km/h. Calculated only based on vehicles having speed information.
format: float
example: 40.1
sDeviation:
type: number
description: Standard deviation of average speed.
format: float
example: 1.1
q15:
type: number
description: 15 percent quantile of speed.
format: float
example: 50.3
q50:
type: number
description: 50 percent quantile of speed.
format: float
example: 55.0
q85:
type: number
description: 85 percent quantile of speed.
format: float
example: 57.1
description: Calculated details in Vdp format.
UniqueId:
required:
- id
type: object
properties:
id:
type: string
description: Root id, e.g. collectors id
example: L184
sub:
$ref: '#/components/schemas/UniqueId'
description: Recursive id of object.
example:
id: L184
sub:
id: 11.11G
VbvData:
type: object
properties:
effectiveTime:
type: string
description: Timestamp when data was persisted .Time in [ms] since unix epoche.
example: '1602743932161'
protType:
type: string
description: Protocol type used to transfer this vehicle detection data.
example: GRPS
seqnum:
type: integer
description: Sequence number of vehicle detection.
format: int32
example: 38846
classType:
type: string
description: "Vehicle class type of vehicle detected. Can be one of the following values \n <ul><li>VAL: Value</li>\n <li>NAV: Not a value</li>\n <li>LT: Exclusive upper bound</li>\n <li>LTE: Inclusive upper bound</li>\n <li>GT: Exclusive lower bound</li>\n <li>GTE: Inclusive lower bound</li>\n <li>NVA: No value available</li></ul>"
example: VAL
occupancy:
type: integer
description: Occupancy of detection unit during the vehicle detection in [ms]. (obsolete)
format: int32
example: 238
headway:
type: integer
description: Headway with respect to previous vehicle detection in [ms].
format: int32
example: 16
gap:
type: integer
description: Gap with respect to previous vehicle detection in [ms].
format: int32
example: 13
length:
type: integer
description: Length of the vehicle detected in [10^-2 m].
format: int32
example: 621
swiss10Class:
type: string
description: "Swiss10 class of vehicle detected. Can be one of the following values \n <ul><li>SWISS10_BUS: Bus</li>\n <li>SWISS10_MR: Motorcycle</li>\n <li>SWISS10_PW: Passenger car</li>\n <li>SWISS10_PWA: Passenger car with trailer</li>\n <li>SWISS10_LFW: Delivery van</li>\n <li>SWISS10_LFWA: Delivery van with trailer</li>\n <li>SWISS10_LFWAL: Delivery van with semitrailer</li>\n <li>SWISS10_LKW: Truck</li>\n <li>SWISS10_LZ: Lorry train </li>\n <li>SWISS10_SZ: Semitrailer</li></ul>"
example: SWISS10_PW
seqnumType:
type: string
description: "Sequence number type of vehicle detection. Can be one of the following values \n <ul><li>VAL: Value</li>\n <li>NAV: Not a value</li>\n <li>LT: Exclusive upper bound</li>\n <li>LTE: Inclusive upper bound</li>\n <li>GT: Exclusive lower bound</li>\n <li>GTE: Inclusive lower bound</li>\n <li>NVA: No value available</li></ul>"
example: VAL
status:
type: integer
description: "Status of vehicle detection. Bit field that can have the following values \n <ul><li>0: Ok</li>\n <li>1: Invalid vehicle</li>\n <li>8: Vehicle length less than the minimum</li>\n <li>10: Lane has only one working loop</li>\n <li>12: Straddling vehicle</li></ul>"
format: int32
example: 0
direction:
type: string
description: "Driving direction of vehicle detected. \nCan be \"POSITIVE\" or \"NEGATIVE\" in relation to the expected driving direction (e.g. If the vehicle overtakes at the collecting point, it is on the opposite lane. Therefore a \"NEGATIVE\" direction is recorded)."
example: POSITIVE
occupancyType:
type: string
description: "Occupancy type of detection unit during the vehicle detection. Can be one of the following values \n <ul><li>VAL: Value</li>\n <li>NAV: Not a value</li>\n <li>LT: Exclusive upper bound</li>\n <li>LTE: Inclusive upper bound</li>\n <li>GT: Exclusive lower bound</li>\n <li>GTE: Inclusive lower bound</li>\n <li>NVA: No value available</li></ul>"
example: NVA
headwayType:
type: string
description: Headway type with respect to previous vehicle detection.
example: '0'
gapType:
type: string
description: "Gap type with respect to previous vehicle detection. Can be one of the following values \n <ul><li>VAL: Value</li>\n <li>NAV: Not a value</li>\n <li>LT: Exclusive upper bound</li>\n <li>LTE: Inclusive upper bound</li>\n <li>GT: Exclusive lower bound</li>\n <li>GTE: Inclusive lower bound</li>\n <li>NVA: No value available</li></ul>"
example: VAL
lengthType:
type: string
description: "Length type of the vehicle detected. Can be one of the following values \n <ul><li>VAL: Value</li>\n <li>NAV: Not a value</li>\n <li>LT: Exclusive upper bound</li>\n <li>LTE: Inclusive upper bound</li>\n <li>GT: Exclusive lower bound</li>\n <li>GTE: Inclusive lower bound</li>\n <li>NVA: No value available</li></ul>"
example: VAL
statusType:
type: string
description: "Status type of vehicle detection. Can be one of the following values \n <ul><li>VAL: Value</li>\n <li>NAV: Not a value</li>\n <li>LT: Exclusive upper bound</li>\n <li>LTE: Inclusive upper bound</li>\n <li>GT: Exclusive lower bound</li>\n <li>GTE: Inclusive lower bound</li>\n <li>NVA: No value available</li></ul>"
example: VAL
directionType:
type: string
description: "Driving direction type of vehicle detected. Can be one of the following values \n <ul><li>VAL: Value</li>\n <li>NAV: Not a value</li>\n <li>LT: Exclusive upper bound</li>\n <li>LTE: Inclusive upper bound</li>\n <li>GT: Exclusive lower bound</li>\n <li>GTE: Inclusive lower bound</li>\n <li>NVA: No value available</li></ul>"
example: VAL
subMsDiscriminator:
type: string
description: Value allowing a sub-ms destinction maintaining the order in time.
example: '0'
clockID:
type: integer
description: Identifier of the clock used to determine effectiveTime.
format: int32
example: 1
rcvTime:
type: string
description: The time when the external vehicle data message was received by protocol adapter. Time in [ms] since unix epoche.
example: '1602743932160'
srcTime:
type: string
description: The time that has been reported together with this vehicle data by tdCollector. Time in [ms] since unix epoche.
example: '1602743932159'
srcTimeUtcOffset:
type: integer
description: The timeOffset (including potential dst-offset) assumed to have been used by tdCollector when reporting srcTime. TimeOffset in [ms] with respect to UTC.
format: int32
example: 0
uID:
$ref: '#/components/schemas/UniqueId'
description: Vehicle data received from protocol adapters.
x-refined-from:
- vdp-zh-ch-openapi.json
- zh-ch-traffic-counts-openapi.yml