Source: https://developers.woosmap.com/api-reference/distance-async-api/post-distance-matrix-async/

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

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

# Start Matrix Calculation



# Start Matrix Calculation

 POST 
https://api.woosmap.com/distance/matrix/async

Start an asynchronous matrix calculation.

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

**Ratelimit:** 20/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.

### Request Body

application/json

[`origins`](#req-origins)
stringrequired

The starting points. You can supply one or more locations, in the form of `latitude,longitude` coordinates, separated by the pipe character `|`. Ensure that no space exists between the latitude and longitude values.

[`destinations`](#req-destinations)
stringrequired

The ending points. You can supply one or more locations, in the form of `latitude,longitude` coordinates, separated by the pipe character `|`. Ensure that no space exists between the latitude and longitude values.

[`mode`](#req-mode)
stringDefaults to `driving`

Specifies the mode of transport to use when calculating distance

Available options:`driving`, `truck`

##### Example

```json
{
  "origins": "48.73534,2.368308|48.73534,2.368308",
  "destinations": "48.83534,2.368308",
  "mode": "driving"
}
```

### Response

200application/json

Successful Response

[`matrix_id`](#resp-200-matrix-id)
stringrequired

Unique identifier for the matrix requested, this will be used to check the status and retrieve the completed calculation.

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

Status of the matrix calculation

# Show 5 enum values Hide 5 enum values 

`accepted`

`inProgress`

`completed`

`timeout`

`error`

### 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 'https://api.woosmap.com/distance/matrix/async?private_key=YOUR_PRIVATE_API_KEY' \
-H 'content-type: application/json' \
-d '{
  "origins": "48.73534,2.368308|48.73534,2.368308",
  "destinations": "48.83534,2.368308",
  "mode": "driving"
}'
```

```javascript
const myHeaders = new Headers();
myHeaders.append("content-type", "application/json");

const raw = JSON.stringify({
  "origins": "48.73534,2.368308|48.73534,2.368308",
  "destinations": "48.83534,2.368308",
  "mode": "driving"
});

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};

fetch("https://api.woosmap.com/distance/matrix/async?private_key=YOUR_PRIVATE_API_KEY", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

```python
import requests
import json

url = "https://api.woosmap.com/distance/matrix/async?private_key=YOUR_PRIVATE_API_KEY"

payload = json.dumps({
    "origins": "48.73534,2.368308|48.73534,2.368308",
    "destinations": "48.83534,2.368308",
    "mode": "driving"
})
headers = {
    'content-type': 'application/json'
}

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

print(response.text)
```

```json
{
  "matrix_id": "39585bfc-59cc-478c-9b87-12685c9b880c",
  "status": "accepted"
}
```
