Quick start

  1. Get a key for the Distance Matrix API.

    Note

    The async matrix generation is currently available only upon request.

    If you need it, send us an email at paid-api-maps@yandex-team.ru.

  2. Send request to initiate the matrix generation operation.

    curl -X POST 'https://api.routing.yandex.net/v2/distancematrix_async/driving/matrices/generate?apikey=YOUR_API_KEY' \
        -H 'Content-Type: application/json' \
        --data '{"origins":[[37.540775,55.886412],[37.509132,55.825264],[37.484335,55.826820],[37.722153,55.721870],[37.468273,55.676837]],"destinations":[[37.619979,55.676799],[37.646084,55.826680],[37.661889,55.671596],[37.640079,55.780732],[37.494420,55.762688],[37.656392,55.874199]]}'
    
  3. Send request to get the status of the async operation. Use the ID obtained from the response of the previous request.

    curl 'https://api.routing.yandex.net/v2/distancematrix_async/driving/operations/get?apikey=YOUR_API_KEY&id=OPERATION_ID'
    
  4. When the async operation has finished. Send the request to get the resulting matrix. Use the matrix ID obtained from the response of the previous request. Note that the response is gzip-encoded.

    curl 'https://api.routing.yandex.net/v2/distancematrix_async/driving/matrices/get?apikey=YOUR_API_KEY&id=MATRIX_ID' | gunzip