public-transport / transport-apis

machine-readable list of transport API endpoints
Creative Commons Zero v1.0 Universal
61 stars 6 forks source link
api public-transport transit

list of transport APIs

This is a machine-readable list of (public) transport API endpoints, with details about who operates them, the protocol used & authentication details.

Format

Overall Structure

There is a single JSON file per API endpoint. It must contain the following properties:

Endpoint Protocol

{
    "type": {
        "hafasMgate": true
    }
}

Known protocols:

Supported Languages

{
    "supportedLanguages": [
        "en",
        "de",
        "fr",
        "es"
    ]
}

A list of ISO-639-1 language codes describing the languages supported by the endpoint.

Timezone Information

{
    "timezone": "Europe/Berlin"
}

For endpoints that assume times in requests to be in a specific local timezone, the timezone field should contain the IANA timezone identifier of the expected timezone. This timezone can also be applied by clients to times in results returned by the endpoint, particularly when the results are lacking explicit timezone (offset) information.

Coverage Information

Describes the geographic area this endpoint provides results for.

{
    "coverage": {
        "realtimeCoverage": { /* ... */ },
        "regularCoverage": { /* ... */ },
        "anyCoverage": { /* ... */ }
    }
}

There's three coverage categories:

At least one coverage category must be provided.

{
    "area": { /* GeoJSON polygon or MultiPolygon */ },
    "region": [ /* ISO-3166-1/2 codes */ ]
}

The following properties are defined for each coverage category:

Both fields should be provided.

Attribution Information

The attribution property specifies licensing information for an endpoint.

Open Data

If an endpoint provides results under an Open Data license, attribution generally follows the Data Packages format:

{
    "attribution": {
        "name": "© Helsinki Region Transport",
        "license": "CC-BY-4.0",
        "homepage": "https://www.hsl.fi/"
    }
}

Properties:

name and license are mandatory, homepage is optional.

For endpoints aggregating data under various Open Data licenses, the situation can be more complex than this though, making it impossible to specify a single license. This can be expressed using the mixedLicenses property:

{
    "attribution": {
        "name": "© navitia.io",
        "homepage": "https://www.navitia.io/",
        "mixedLicenses": true
    }
}

If mixedLicenses is set to true, the license details are provided in some other form. This can be for example via the homepage property, or as part of the endpoint responses themselves.

Proprietary

If an endpoint is known to be proprietary, attribution can be used to specify this as well:

{
    "attribution": {
        "isProprietary": true
    }
}

Protocol Specific Options

Hafas mgate.exe

"options": {
    "auth": {
        "aid": "...",
        ...
    },
    "checksumSalt": "<hex value>",
    "client": {
        "id": "...",
        "type": "...",
        ...
    },
    "ext": "...",
    "micMacSalt": "<hex value>",
    "version": "1.27",
    "products": [
        {
            id: 'subway',
            name: 'U-Bahn'
            bitmasks: [1]
        },
        {
            id: 'suburban',
            bitmasks: [2],
            name: 'S-Bahn'
        },
        ...
    ]
}

The following properties are defined:

Product metadata consists of the following information:

Hafas query.exe

"options": {
    "endpoint": "https://.../",
    "products": [
        {
            id: 'subway',
            name: 'U-Bahn'
            bitmasks: [1]
        },
        {
            id: 'suburban',
            bitmasks: [2],
            name: 'S-Bahn'
        },
        ...
    ]
}

The following properties are defined:

EFA

"options": {
    "endpoint": "https://...",
    "supportedOutputFormats": [ "XML", "JSON" ],
    "xmlOutputFormat": "full",
    "mId": "...",
    "stopfinderRequestCommand": "XSLT_STOPFINDER_REQUEST",
    "dmRequestCommand": "XSLT_DM_REQUEST",
    "tripRequestCommand": "XSLT_TRIP_REQUEST2"
}

The following properties are defined:

Open Trip Planner with GraphQL

"options": {
    "endpoint": "https://...",
    "apiVersion": "otp2"
}

The following properties are defined:

TRIAS

The following properties are defined:

MOTIS

The following properties are defined:

Contributing

Note that, by participating in this project, you commit to the code of conduct. If you want to contribute to this list, feel free to open an Issue at the Issues page.