Source: https://developers.woosmap.com/api-reference/transit-api/get-transit-route/

> For clean Markdown of any page, append `.md` to the page URL.

> For a complete documentation index, see https://developers.woosmap.com/llms.txt

# Transit Route



# Transit Route

 GET 
https://api.woosmap.com/transit/route

**Rate limit** : `10/1s`

**Ratelimit:** 10/1s

### Authorization

[`key`](#authorization-external-api-wrapper-publicapikey)
apiKeyquery

Public key of the project usually starts with `woos-`

[`private_key`](#authorization-external-api-wrapper-privateapikey)
apiKeyquery

Private key with or without write permission.

[`X-Api-Key`](#authorization-external-api-wrapper-privateapikeyheader)
apiKeyheader

Private key with or without write permission.

### Query Parameters

[`departure_time`](#query-departure-time)
object

DateTime with or without timezone, if not set the default datetime is the current one

Example:`2024-01-01T12:00:00%2B01:00`

[`arrival_time`](#query-arrival-time)
object

DateTime with or without timezone, if departure\_time is defined this parameter is ignored

Example:`2024-01-01T14:00:00%2B01:00`

[`origin`](#query-origin)
stringrequired

WGS84 coordinates as format lat,lng

Example:`lat,lng`

[`destination`](#query-destination)
stringrequired

WGS84 coordinates as format lat,lng

Example:`lat,lng`

[`modes`](#query-modes)
string

Transit mode filter used to determine which modes of transit to include in the response. By default, all supported transit modes are permitted. Supported modes: `highSpeedTrain` `intercityTrain` `interRegionalTrain` `regionalTrain` `cityTrain` `bus` `ferry` `subway` `lightRail` `privateBus` `inclined` `aerial` `busRapid` `monorail` `flight` `spaceship` This parameter also support an exclusion list: It's sufficient to specify each mode to exclude by prefixing it with `-`.  
 Mixing of inclusive and exclusive transit modes is not allowed.

Example:`subway,bus`

### Response

200application/json

Successful Response

[`status`](#resp-200-status)
stringrequired

[`routes`](#resp-200-routes)
object[]

#Show 3 propertiesHide 3 properties

routes.[`notice`](#resp-200-routes-notice)
stringDefaults to `""`

routes.[`duration`](#resp-200-routes-duration)
integerrequired

routes.[`legs`](#resp-200-routes-legs)
object[]

Show 8 propertiesHide 8 properties

routes.legs.[`travel_mode`](#resp-200-routes-legs-travel-mode)
stringrequired

routes.legs.[`duration`](#resp-200-routes-legs-duration)
integerrequired

routes.legs.[`distance`](#resp-200-routes-legs-distance)
numberrequired

routes.legs.[`polyline`](#resp-200-routes-legs-polyline)
stringrequired

routes.legs.[`start_location`](#resp-200-routes-legs-start-location)
objectrequired

Show 3 propertiesHide 3 properties

routes.legs.start\_location.[`name`](#resp-200-routes-legs-start-location-name)
string

routes.legs.start\_location.[`type`](#resp-200-routes-legs-start-location-type)
stringrequired

routes.legs.start\_location.[`location`](#resp-200-routes-legs-start-location-location)
objectrequired

Show 2 propertiesHide 2 properties

routes.legs.start\_location.location.[`lat`](#resp-200-routes-legs-start-location-location-lat)
number | stringrequired

routes.legs.start\_location.location.[`lng`](#resp-200-routes-legs-start-location-location-lng)
number | stringrequired

routes.legs.[`end_location`](#resp-200-routes-legs-end-location)
objectrequired

Show 3 propertiesHide 3 properties

routes.legs.end\_location.[`name`](#resp-200-routes-legs-end-location-name)
string

routes.legs.end\_location.[`type`](#resp-200-routes-legs-end-location-type)
stringrequired

routes.legs.end\_location.[`location`](#resp-200-routes-legs-end-location-location)
objectrequired

Show 2 propertiesHide 2 properties

routes.legs.end\_location.location.[`lat`](#resp-200-routes-legs-end-location-location-lat)
number | stringrequired

routes.legs.end\_location.location.[`lng`](#resp-200-routes-legs-end-location-location-lng)
number | stringrequired

routes.legs.[`transport`](#resp-200-routes-legs-transport)
TransitTransport

routes.legs.[`attributions`](#resp-200-routes-legs-attributions)
array

### Errors

#401

Unable to locate credentials.

 

`application/json`

[`detail`](#err-401-detail)
stringrequired

#402

Out of free quota.

 

`application/json`

[`detail`](#err-402-detail)
stringrequired

#403

Credentials found, but not matching.

 

`application/json`

[`detail`](#err-403-detail)
stringrequired

#422

Validation Error

 

`application/json`

[`detail`](#err-422-detail)
object[]

Show 3 propertiesHide 3 properties

detail.[`loc`](#err-422-detail-loc)
any[]required

detail.[`msg`](#err-422-detail-msg)
stringrequired

detail.[`type`](#err-422-detail-type)
stringrequired

#429

Rate limit reached

 

`application/json`

[`details`](#err-429-details)
stringrequired

```shell
curl -L -X GET 'https://api.woosmap.com/transit/route?origin=48.73534,2.368308&destination=48.83534,2.368308&key=YOUR_PUBLIC_API_KEY' \
-H 'Referer: http://localhost'
```

```python
import requests

url = "https://api.woosmap.com/transit/route?origin=48.73534,2.368308&destination=48.83534,2.368308&key=YOUR_PUBLIC_API_KEY"

payload={}
headers = {
    'Referer': 'http://localhost'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

```javascript
var requestOptions = {
  method: 'GET',
  redirect: 'follow'
};

fetch("https://api.woosmap.com/transit/route?origin=48.73534,2.368308&destination=48.83534,2.368308&key=YOUR_PUBLIC_API_KEY", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```
