article Quick Start
Learn how to get started with GoFreight REST APIs
This article will guide you through the steps required to get started with GoFreight REST APIs. cURL is used in the examples, but you can use any HTTP client of your choice. If you’d like to know more about the available APIs, please refer to the API Reference.
Step 1: Obtain an API Key
GoFreight currently does not allow users to create API keys on their own (but it will be available soon!). You will need to contact GoFreight staff to obtain an API key to access GoFreight APIs. You can demand multiple API keys for different purposes.
Please note that we currently provide two environments with different base URLs:
- stage:
https://api-stage.core.gofreight.co/
- production:
https://api.core.gofreight.co/
The stage environment is used for testing/trial purposes, and the production environment is used for production purposes. You may want to use the stage environment to test your integration before going live.
Step 2: Format Your Requests
In order to use our APIs, you will need to authenticate your requests. This is done by including your API Key in the header named ‘X-GATEWAY-TOKEN’ of your HTTP requests.
Here is an example of using curl to access an API endpoint:
curl --request GET \
--url https://api.core.gofreight.co/api/v1/{{api-endpoint}} \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-GATEWAY-TOKEN: {{your-api-key}}'
Remember to replace your-api-key
with your own API key and api-endpoint
with the specific endpoint you are trying to access.
Step 3: Making Your First Request
To begin, let’s make a request to an example endpoint to access GET
/api/v1/trade-partners/
(API Reference) with curl:
|
|
Run this command in your terminal to send the request and you’ll receive a JSON response (formatted with Python json.tool
for readability), which might look like this:
{
"meta": {
"total": 100,
"current_page": 1,
"total_pages": 10
},
"data": [
// Array of trade partner objects...
]
}