Cargo Vessels Tracking with API
Cargo Vessels tracking with API with Datalastic provides a comprehensive database of cargo vessels and their properties, including information on ship subtype, IMO number, MMSI number, name, flag, length, breadth, and more. With the API, developers can easily access and retrieve this information for use in their own applications. In this guide, we will provide a step-by-step guide on how to find and filter cargo vessels using the Cargo Vessel API endpoint.
Step 1: Obtain an API key:
You will need to obtain an API key to use the Datalastic Cargo Vessels API. You can do this by signing up for an account. It’s important to keep your API key private and secure. Do not share it with anyone or include it in publicly accessible code.
That’s it! You now have an API key that you can use to make requests to the Datalastic Cargo Vessels API. In the next step, we will show you how to use the Cargo Vessel endpoint to find and filter cargo vessels.
Step 2: Make a rquest to Cargo Vessels API:
The Cargo Vessel endpoint is used to search for and retrieve information on vessels in the database. It is accessed via the following URL:
https://api.datalastic.com/api/v0/vessel_find?api-key={YOUR_API_KEY}&{PARAMETER}={PARAMETER_VALUE}
To make a request to the endpoint, you will need to replace “{YOUR_API_KEY}” with your actual API key, and specify any desired parameters and their values.
Here’s an example of how you might make a request to the Cargo Vessel API using a programming language such as Python:
import requests
# Replace {YOUR_API_KEY} with your actual API key
api_key = "{YOUR_API_KEY}"
# Set up the URL with the desired parameters
url = "https://api.datalastic.com/api/v0/vessel_find?api-key={}&type=cargo".format(api_key)
# Send the request and retrieve the response
response = requests.get(url)
# Check the status code to make sure the request was successful
if response.status_code == 200:
# The request was successful, so we can parse the response data
data = response.json()
else:
# The request was not successful, so we need to handle the error
print("An error occurred: {}".format(response.status_code)) Parameters for Cargo Vessels API:
This code sends a GET request to Cargo Vessel API with the “type” parameter set to “cargo”, indicating that we want to find only cargo vessels. The response from the API is stored in the “response” object, which we can then use to check the status code and parse the response data.
Keep in mind that the Cargo Vessel endpoint supports many other parameters in addition to “type”, including “country”, “subtype”, “year_built”, and “gross_tonnage_max”.
Here is a complete list of the parameters and values that you can use with the Datalastic Cargo Vessels API’s Vessel Finder endpoint:
Api-key: Your API key, which you can obtain by signing up for a free account.
Type: The type of vessel you want to find.
Valid values include:
| Type_specific | Description |
|---|---|
| cargo | Cargo vessels |
| fishing | Fishing vessels |
| military | Military vessels |
| passenger | Passenger vessels |
| pleasure | Pleasure vessels |
| sailing | Sailing vessels |
| tug | Tugboats |
| other | Other types of vessels |
Type_specific: A subtype of vessel you want to find. This parameter can be used on its own or in combination with the type parameter.
Valid values include:
| Type_specific | Description |
|---|---|
| bulk_carrier | Bulk carriers |
| cargo_general | General cargo vessels |
| cargo_reefer | Reefer cargo vessels |
| cargo_ro-ro | Roll-on/roll-off cargo vessels |
| chemical_tanker | Chemical tankers |
| container_ship | Container ships |
| dredger | Dredgers |
| dry_cargo_barge | Dry cargo barges |
| gas_tanker | Gas tankers |
| livestock_carrier | Livestock carriers |
| oil_tanker | Oil tankers |
| ore_carrier | Ore carriers |
| passenger_ship | Passenger ships |
| passenger_ferry | Passenger ferries |
| reefer | Reefers |
| ro-ro | Roll-on/roll-off ships |
| sailing_vessel | Sailing vessels |
| tug | Tugboat |
You can find a list of all possible types and subtypes combinations here https://datalastic.com/api-reference/#ships-type-list
You can further add more filters to narrow down your search in Cargo Vessel API:
| Parameter | Description |
|---|---|
| vehicle_carrier | Vehicle carriers |
| country_iso | The two-letter ISO code of the country of the vessels |
| gross_tonnage_min | The minimum gross tonnage of the vessels |
| gross_tonnage_max | The maximum gross tonnage of the vessels |
| deadweight_min | The minimum deadweight of the vessels |
| deadweight_max | The maximum deadweight of the vessels |
| length_min | The minimum length of the vessels |
| length_max | The maximum length of the vessels |
| breadth_min | The minimum breadth of the vessels |
| breadth_max | The maximum breadth of the vessels |
| year_built_min | The minimum year that the vessels were built |
| year_built_max | The maximum year that the vessels were built |
You can find a full list of available parameters in the API documentation.
In the next step, we will show you how to filter the results by vessel type.
Step 3: Filter the results by Type:
To filter the results by vessel type, you will need to use the “type” parameter. The “type” parameter specifies the type of vessel you want to find.
For example, to find only cargo vessels, you can use the following URL:
https://api.datalastic.com/api/v0/vessel_find?api-key={YOUR_API_KEY}&type=cargo
This will return a list of all cargo vessels in the database.
You can use the “type” parameter in combination with other parameters to further filter the results.
For example, to find only cargo vessels with a gross tonnage between 50,000 and 100,000 tons, you can use the following URL:
https://api.datalastic.com/api/v0/vessel_find?api-key={YOUR_API_KEY}&type=cargo&gross_tonnage_min=50000&gross_tonnage_max=100000
Step4: Optional: Add optional parameters to further filter the results:
In addition to the “type” parameter, the Datalastic Cargo Vessels API supports several other parameters that you can use to filter the results. These parameters allow you to search for vessels with specific characteristics, such as a particular IMO number, a specific gross tonnage, or a specific length.
Here are a few examples of how you might use additional parameters to further filter the results:
To find only cargo vessels with a gross tonnage between 50,000 and 100,000 tons, you can use the following URL:
https://api.datalastic.com/api/v0/vessel_find?api-key={YOUR_API_KEY}&type=cargo&gross_tonnage_min=50000&gross_tonnage_max=100000
If you want to find only cargo vessels with a specific Country, you can use the following URL:
https://api.datalastic.com/api/v0/vessel_find?api-key={YOUR_API_KEY}&type=cargo&country_iso={COUNTRY_ISO}
For only cargo vessels with a minimum Gross Tonnage Weight, you can use the following URL:
https://api.datalastic.com/api/v0/vessel_find?api-key={YOUR_API_KEY}&type=cargo&gross_tonnage_min={GROSS_TONNAGE _MIN}
You can find a full list of available parameters and their values in the API documentation.
Step 5: Parse and use the results:
Once you have made your request to the Cargo Vessel API endpoint and received a response from the API, you will need to parse the results and use the data as needed in your application.
The Cargo Vessel API endpoint will return the results in JSON format. You can parse the results using your preferred method for handling JSON data in your programming language of choice.
Here’s an example of how you might parse the results and filter for only vessels in the “cargo” type that are registered in China:
Step 6: Optional: Use other options and parameters:
import json
# Parse the JSON data
data = json.loads(response.text)
# Access the results
vessels = data["results"]
# Iterate through the results and print the IMO number and flag of each vessel
for vessel in vessels:
if vessel["type"] == "cargo" and vessel["flag"] == "CN":
print("IMO: {}\tFlag: {}".format(vessel["imo"], vessel["country_iso"])) This code parses the JSON data returned by the API and stores it in a Python dictionary. It then accesses the “results” field of the dictionary, which contains a list of vessels. It then iterates through the list and checks the “type” and “flag” fields of each vessel.
Read Other Maritime Articles
How To Use ChatGPT To Track Ships in Real Time?
Tracking ships using ChatGPT is possible and an easy process when it is connected to a live maritime data source such as Datalastic. On its own, ChatGPT does not maintain a live database of ship positions. It may know general information about vessels, shipping...
How to Connect Datalastic to Claude and ChatGPT?
Connecting Datalastic to Claude and ChatGPT is an easy and fast process that you'll be surprised by it, following this tutorial. By connecting Datalastic through its Model Context Protocol (MCP) server, you can give AI assistants direct access to real-time maritime...
Find Vessels In The Gulf Of Oman
Tracking vessels in the Gulf of Oman is essential for understanding maritime traffic in one of the world’s most strategically important shipping corridors. This region connects the Arabian Sea with the Strait of Hormuz, acting as a gateway for global oil shipments,...
Enterprise Vessel Tracking API
An enterprise vessel tracking API is not defined by features alone. It is defined by scale, reliability, and the ability to perform under real-world pressure. In maritime operations, where systems rely on continuous data flows, even small inefficiencies can quickly...
Yacht tracking API: filter by Type, Size and Flag
A Yacht Tracking API is not just about seeing where yachts are located on a map. The real value comes from filtering, structuring, and working with yacht AIS data in a way that’s actually usable for maritime platforms, fleet monitoring, marina operations, and vessel...
Oil Tanker Tracker API
The Oil Tanker Tracker API is essential for monitoring global energy flows, crude oil logistics, and maritime traffic in real time. Oil tankers are among the most critical vessel types in global trade, transporting millions of barrels of crude oil and refined products...
Recent Comments