Example: Calculate the rate Odessa - Shanghai.

1. Start from API FCL:

https://sirius.searates.com/api/fcl?key=API_KEY&lat_from=46.484583&lng_from=30.732600000000048&lat_to=31.2303904&lng_to=121.47370209999997&company_id=1

{
 {
  "fcl": [
    {
      "id": 442915,
      "20st": 850,
      "40st": 1500,
      "40hq": 1500,
      "currency": "USD",
      "line": "MSC",
      "line_id": 1,
      "company_id": 92836,
      "profile_name": "Anna Moto",
      "profile_email": "sales@chinese-brothers.com",
      "company_address": "CN, Shanghai",
      "profile_phone": "38-095-7790488",
      "thc_exp": true,
      "thc_imp": false,
      "valid_date_from": "2016-07-08",
      "valid_date_to": "2019-12-31",
      "transit_time": "11 days 2 hours",
      "company_name": "Chinese Brothers Ltd",
      "profile": 171430,
      "lpi12": "9.3616666666666667",
      "chat_activity": 1,
      "port_name_from": "Odessa",
      "port_name_to": "Valencia",
      "port_id_from": 304,
      "port_id_to": 3916,
      "port_code_from": "UAODS",
      "port_code_to": "ESVLC",
      "port_country_from": "UA",
      "port_country_to": "ES",
      "port_lat_from": "46.4999995864331",
      "port_lon_from": "30.7307730194095",
      "port_lat_to": "39.4510701931561",
      "port_lon_to": "-0.330276492039038",
      "comment": null,
      "company_logo": "https://www.searates.com/design/images/import/users/92836/company/company-logo-l.jpg",
      "path": [
        [
          46.337529550901,
          30.677840169237
        ],
        [
          46.325475946741,
          30.725116906737
        ],
          ...
      ],
      "distance": "3524.65",
      "20ref": 1950,
      "40ref": 3300,
      "liner_terms": "LIFO"
    },
    {
      "id": 442897,
      "20st": 850,
      "40st": 1500,
      "40hq": 1500,
      "currency": "USD",
      "line": "MSC",
      "line_id": 1,
      "company_id": 92836,
      "profile_name": "Anna Moto",
      "profile_email": "sales@chinese-brothers.com",
      "company_address": "CN, Shanghai",
      "profile_phone": "38-095-7790488",
      "thc_exp": true,
      "thc_imp": false,
      "valid_date_from": "2016-07-08",
      "valid_date_to": "2019-12-31",
      "transit_time": "11 days 1 hours",
      "company_name": "Chinese Brothers Ltd",
      "profile": 171430,
      "lpi12": "9.3616666666666667",
      "chat_activity": 1,
      "port_name_from": "Chornomorsk",
      "port_name_to": "Valencia",
      "port_id_from": 409,
      "port_id_to": 3916,
      "port_code_from": "UAILK",
      "port_code_to": "ESVLC",
      "port_country_from": "UA",
      "port_country_to": "ES",
      "port_lat_from": "46.337529876646",
      "port_lon_from": "30.6778390533419",
      "port_lat_to": "39.4510701931561",
      "port_lon_to": "-0.330276492039038",
      "comment": null,
      "company_logo": "https://www.searates.com/design/images/import/users/92836/company/company-logo-l.jpg",
      "path": [
        [
          46.337529550901,
          30.677840169237
        ],
        [
          46.325475946741,
          30.725116906737
        ],
          ...
      ],
      "distance": "3500.32",
      "20ref": 1950,
      "40ref": 3300,
      "liner_terms": "LIFO"
    },
    {
      "id": 475698,
      "20st": 836,
      "40st": 1295,
      "40hq": 1295,
      "currency": "USD",
      "line": null,
      "line_id": null,
      "company_id": 42632,
      "profile_name": "Oleg Pronkin",
      "profile_email": "acosta@alphacosta.com",
      "company_address": "UA, Odessa",
      "profile_phone": "380-67-4822740",
      "thc_exp": true,
      "thc_imp": false,
      "valid_date_from": "2018-03-01",
      "valid_date_to": "2019-12-31",
      "transit_time": "11 days 2 hours",
      "company_name": "AlphaCosta Group of Companies",
      "profile": 240933,
      "lpi12": "6.8750000000000000",
      "chat_activity": 0,
      "port_name_from": "Odessa",
      "port_name_to": "Valencia",
      "port_id_from": 304,
      "port_id_to": 3916,
      "port_code_from": "UAODS",
      "port_code_to": "ESVLC",
      "port_country_from": "UA",
      "port_country_to": "ES",
      "port_lat_from": "46.4999995864331",
      "port_lon_from": "30.7307730194095",
      "port_lat_to": "39.4510701931561",
      "port_lon_to": "-0.330276492039038",
      "comment": null,
      "company_logo": "https://www.searates.com/design/images/import/users/42632/company/company-logo-l.jpg",
      "path": [
        [
          46.337529550901,
          30.677840169237
        ],
        [
          46.325475946741,
          30.725116906737
        ],
          ...
      ],
      "distance": "3524.65",
      "20ref": 1936,
      "40ref": 3095,
      "liner_terms": "LIFO"
    },
    {
      "id": 448111,
      "20st": 750,
      "40st": 850,
      "40hq": 850,
      "currency": "USD",
      "line": "MAERSK",
      "line_id": 10,
      "company_id": 207620,
      "profile_name": "Steven Hong",
      "profile_email": "supremo@i.ua",
      "company_address": "UA, Odessa",
      "profile_phone": "+38 063 583 60 18",
      "thc_exp": true,
      "thc_imp": false,
      "valid_date_from": "2017-03-01",
      "valid_date_to": "2019-12-31",
      "transit_time": "11 days 1 hours",
      "company_name": "Chinese Brothers LTD",
      "profile": 335291,
      "lpi12": "7.0000000000000000",
      "chat_activity": 0,
      "port_name_from": "Chornomorsk",
      "port_name_to": "Valencia",
      "port_id_from": 409,
      "port_id_to": 3916,
      "port_code_from": "UAILK",
      "port_code_to": "ESVLC",
      "port_country_from": "UA",
      "port_country_to": "ES",
      "port_lat_from": "46.337529876646",
      "port_lon_from": "30.6778390533419",
      "port_lat_to": "39.4510701931561",
      "port_lon_to": "-0.330276492039038",
      "comment": null,
      "company_logo": "https://www.searates.com/design/images/import/users/207620/company/company-logo-l.jpg",
      "path": [
        [
          46.337529550901,
          30.677840169237
        ],
        [
          46.325475946741,
          30.725116906737
        ],
          ...
      ],
      "distance": "3500.32",
      "20ref": 1850,
      "40ref": 2650,
      "liner_terms": "LIFO"
    },
    {
      "id": 448131,
      "20st": 750,
      "40st": 850,
      "40hq": 850,
      "currency": "USD",
      "line": "MAERSK",
      "line_id": 10,
      "company_id": 207620,
      "profile_name": "Steven Hong",
      "profile_email": "supremo@i.ua",
      "company_address": "UA, Odessa",
      "profile_phone": "+38 063 583 60 18",
      "thc_exp": true,
      "thc_imp": false,
      "valid_date_from": "2017-03-01",
      "valid_date_to": "2019-12-31",
      "transit_time": "11 days 2 hours",
      "company_name": "Chinese Brothers LTD",
      "profile": 335291,
      "lpi12": "7.0000000000000000",
      "chat_activity": 0,
      "port_name_from": "Odessa",
      "port_name_to": "Valencia",
      "port_id_from": 304,
      "port_id_to": 3916,
      "port_code_from": "UAODS",
      "port_code_to": "ESVLC",
      "port_country_from": "UA",
      "port_country_to": "ES",
      "port_lat_from": "46.4999995864331",
      "port_lon_from": "30.7307730194095",
      "port_lat_to": "39.4510701931561",
      "port_lon_to": "-0.330276492039038",
      "comment": null,
      "company_logo": "https://www.searates.com/design/images/import/users/207620/company/company-logo-l.jpg",
      "path": [
        [
          46.5,
          30.730773925781
        ],
        [
          46.511625395438,
          30.758972167969
        ],
         ...
      ],
      "distance": "3524.65",
      "20ref": 1850,
      "40ref": 2650,
      "liner_terms": "LIFO"
    }
  ],
  "default": {
    "delivery_from": "door",
    "delivery_to": "door"
  },
  "dry_terminals": {
    "terminal_from": false,
    "terminal_to": false
  }
}

                              
body {
  > section,
  > footer {
    position: relative;
    margin: 0 auto;
    padding: $section-padding 0;
    overflow: hidden;
  }
}

2. Calculate ROAD API - FROM Inside the loop start to calculate road rate from Odessa to port_lat_from, port_lon_from This will be the road rate from Odessa to port (can be also Odessa or any other)

https://sirius.searates.com/api/road?key=API_KEY&lat_from=46.484583&lng_from=30.732600000000048&lat_to=46.4999995864331&lng_to=30.7307730194095&company_id=1&type=CONTAINER

{
{
  "road": {
    "20st": 10595.22178313169,
    "40st": 10595.22178313169,
    "40hq": 10595.22178313169,
    "id": 4802,
    "currency": "USD",
    "type": "CONTAINER",
    "profile": 553943,
    "company_id": 421897,
    "company_name": "Indicative",
    "company_address": "UA",
    "profile_name": "Indicative Rates",
    "profile_email": "interpolation@searates.com",
    "profile_phone": "+380999999999",
    "company_logo": "https://www.searates.com/design/images/import/users/421897/company/company-logo-l.jpg",
    "distance": 9541.11,
    "transit_time": "16 days 15 hours",
    "min_total_rate": 100,
    "path": [
        [
          46.426767,
          30.676464
        ],
        [
          46.453283875148,
          30.76591043704
        ],
        ...
  }
}
                              

3. Calculate PORT FEES - FROM still in the loop calculating fee export for each port where port_id = port_from_id

https://sirius.searates.com/api/port-fees?key=API_KEY&type=FCL&port_id=304&mode=export&company_id=1


{
  "port_fees": {
    "air": [
      [
        "EXP",
        "Export Service",
        [
          0.5,
          0.4,
          0.3,
          0.2,
          0.1
        ],
        false
      ],
      [
        "ODF",
        "Documentation Fee - Origin",
        80,
        true
      ]
    ],
    "rate_id": 3434,
    "company_name": "Indicative",
    "company_id": 421897,
    "company_address": "UA",
    "company_logo": "https://www.searates.com/design/images/import/users/421897/company/company-logo-l.jpg",
    "profile": 553943,
    "profile_name": "Indicative Rates",
    "profile_email": "interpolation@searates.com",
    "profile_phone": "+380999999999"
  }
}
                              
body {
  > section,
  > footer {
    position: relative;
    margin: 0 auto;
    padding: $section-padding 0;
    overflow: hidden;
  }
}

4. Also calculate inland in the loop for ROAD API - TO from port_lat_to, port_lon_to to Shanghai

https://sirius.searates.com/api/road?key=API_KEY&lat_from=31.4000905769357&lng_from=121.497112503479&lat_to=31.2303904&lng_to=121.47370209999997&company_id=1&type=CONTAINER

{
{
  "road": {
    "20st": 10595.22178313169,
    "40st": 10595.22178313169,
    "40hq": 10595.22178313169,
    "id": 4802,
    "currency": "USD",
    "type": "CONTAINER",
    "profile": 553943,
    "company_id": 421897,
    "company_name": "Indicative",
    "company_address": "UA",
    "profile_name": "Indicative Rates",
    "profile_email": "interpolation@searates.com",
    "profile_phone": "+380999999999",
    "company_logo": "https://www.searates.com/design/images/import/users/421897/company/company-logo-l.jpg",
    "distance": 9541.11,
    "transit_time": "16 days 15 hours",
    "min_total_rate": 100,
    "path": [
        [
          46.426767,
          30.676464
        ],
        [
          46.453283875148,
          30.76591043704
        ],
        ...
  }
}
                              

5. Here together in the loop calculate PORT FEES - TO (import)

https://sirius.searates.com/api/port-fees?key=API_KEY&type=FCL&port_id=706&mode=import&company_id=1

{
  "port_fees": {
    "20st": [
      [
        "B/L",
        "Bill of lading fee",
        0,
        true
      ],
      [
        "IMP",
        "Import Service",
        130,
        false
      ],
      [
        "DTHC",
        "Destination Terminal Handling Charge",
        450,
        false
      ]
    ],
    "40st": [
      [
        "B/L",
        "Bill of lading fee",
        0,
        true
      ],
      [
        "IMP",
        "Import Service",
        150,
        false
      ],
      [
        "DTHC",
        "Destination Terminal Handling Charge",
        500,
        false
      ]
    ],
    "40hq": [
      [
        "B/L",
        "Bill of lading fee",
        0,
        true
      ],
      [
        "IMP",
        "Import Service",
        150,
        false
      ],
      [
        "DTHC",
        "Destination Terminal Handling Charge",
        500,
        false
      ]
    ],
    "20ref": [
      [
        "B/L",
        "Bill of lading fee",
        0,
        true
      ],
      [
        "IMP",
        "Import Service",
        130,
        false
      ],
      [
        "DTHC",
        "Destination Terminal Handling Charge",
        450,
        false
      ]
    ],
    "40ref": [
      [
        "B/L",
        "Bill of lading fee",
        0,
        true
      ],
      [
        "IMP",
        "Import Service",
        150,
        false
      ],
      [
        "DTHC",
        "Destination Terminal Handling Charge",
        500,
        false
      ]
    ],
    "rate_id": 8644,
    "company_name": "Chinese Brothers Ltd",
    "company_id": 92836,
    "company_address": "CN, Shanghai",
    "company_logo": "https://www.searates.com/design/images/import/users/92836/company/company-logo-l.jpg",
    "profile": 171430,
    "profile_name": "Anna Moto",
    "profile_email": "sales@chinese-brothers.com",
    "profile_phone": "38-095-7790488"
  }
}