In Settings → API and integrations click "New key" and choose "Publish trips only". Start with a key Test: what you publish does not appear on the exchange.
Put the key in an environment variable, not in code:
export GOCARGO_API_KEY="gc_test_..."curl https://gocargo.ro/api/v1/me \
-H "Authorization: Bearer $GOCARGO_API_KEY"The response shows the company, the key's permissions and the request limit.
Send the load with external_id = the ID from your TMS. If you resend it, we update the record instead of creating another (upsert), so synchronization is trivial.
The list of your loads:
curl "https://gocargo.ro/api/v1/loads?limit=20" \
-H "Authorization: Bearer $GOCARGO_API_KEY"curl -X POST https://gocargo.ro/api/v1/loads \
-H "Authorization: Bearer $GOCARGO_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"external_id": "TMS-10045",
"origin_country": "RO",
"origin_city": "Cluj-Napoca",
"dest_country": "DE",
"dest_city": "Stuttgart",
"cargo": "Piese auto, 12 paleti",
"loading_date": "2026-12-03",
"vehicle_kind": "prelata",
"weight_kg": 8000,
"price": 1450,
"currency": "EUR"
}'Every request carries the header Authorization: Bearer gc_live_… (or gc_test_…). The base address is https://gocargo.ro/api/v1. HTTPS only.
X-Request-Id; send it when you ask us for help.A request without the required permission receives 403 scope_missing.
| Permission | What it allows |
|---|---|
loads:read | Read the company's loads |
loads:write | Publish, edit and withdraw loads |
trucks:read | Read the company's available trucks |
trucks:write | Publish, edit and withdraw available trucks |
orders:read | Read orders |
orders:write | Change order status and send the GPS position |
marketplace:read | Search the public exchange (loads and trucks) |
webhooks:manage | Manage webhooks via the API |
export:read | Export data (Business and Enterprise plans) |
HTTP/1.1 400 Bad Request
X-Request-Id: 5f0c2e7a9b1d4c3e
Content-Type: application/json
{
"error": {
"code": "invalid_request",
"message": "Datele trimise nu sunt valide.",
"fields": { "loading_date": "Data de încărcare nu poate fi în trecut." }
}
}| HTTP | Code | When |
|---|---|---|
| 400 | invalid_request | Invalid data; field-level details are in "fields" |
| 401 | unauthorized | Missing, wrong or revoked key |
| 401 | key_expired | The key has expired |
| 402 | plan_required | The feature is not included in the company's plan |
| 403 | forbidden | Action not permitted for your company |
| 403 | scope_missing | The key lacks the required permission (named in the message) |
| 403 | ip_not_allowed | The request comes from an IP that is not on the key's list |
| 404 | not_found | The resource does not exist or does not belong to the company |
| 409 | conflict | Incompatible state or Idempotency-Key reused with a different body |
| 429 | rate_limited | Too many requests; wait as long as Retry-After says |
| 429 | quota_exceeded | The company’s monthly request quota has been used up |
| 500 | server_error | Error on our side; retry and send us X-Request-Id |
| Plan / license | Requests per minute, per key | Requests per month, per company | Domains |
|---|---|---|---|
| Pro | 60 | 50.000 | 1 |
| Business | 300 | 300.000 | 1 |
| Enterprise | 1200 | 2.000.000 | 3 |
| Software integrator | 600 | 1.000.000 | 10 |
| Exchange / aggregator partner | 1200 | 5.000.000 | 25 |
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset. Over the limit: 429 with Retry-After (secunde).X-Quota-Limit and X-Quota-Remaining; it consumes all keys, including test keys. Additional packages and commercial licences: API pricing.?limit=100&cursor=…, reply {data, next_cursor}. For synchronization use updated_since.curl -X POST https://gocargo.ro/api/v1/loads/bulk \
-H "Authorization: Bearer $GOCARGO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"items": [ {...}, {...} ]}'
# Răspuns: fiecare element are rezultatul lui
{"results": [
{"index": 0, "ok": true, "ref": "GC1A2B3C4D"},
{"index": 1, "ok": false, "error": {"code": "invalid_request", "message": "..."}}
]}On anything POST send the header Idempotency-Key with a unique value (e.g. a UUID). If the network drops and you retry with the same value, you get exactly the same response, without a second load. The response is kept for 24 hours. The same value with a different body → 409 conflict.
Add an HTTPS URL in Settings → API and integrations → Webhooks (or via POST /webhooks) and choose the events. The secret whsec_… is shown only once.
| Event | When |
|---|---|
load.created | A load was published |
load.updated | A load was modified |
load.booked | A load was booked |
load.withdrawn | A load was withdrawn |
quote.received | You received a price offer |
order.created | An order was created |
order.status_changed | The order has changed status |
order.document_added | A document was added to the order (CMR, invoice) |
order.position_updated | The truck's position was updated |
message.received | You received a message |
POST /gocargo/webhook HTTP/1.1
Content-Type: application/json
GoCargo-Signature: t=1760180000,v1=8f3c...e91a
{
"id": "evt_2b7f0c9e1a4d",
"type": "order.status_changed",
"created_at": "2026-10-11T09:30:00Z",
"data": { ... }
}id to ignore duplicates.The header GoCargo-Signature: t=<unix>,v1=<hex>, where v1 = HMAC-SHA256 with the webhook secret (the whole thing, including whsec_) over {t}.{corpul brut}. Reject signatures older than 5 minutes.
# pip install flask
import hashlib
import hmac
import os
import time
from flask import Flask, abort, request
SECRET = os.environ["GOCARGO_WEBHOOK_SECRET"] # whsec_..., întreg
app = Flask(__name__)
def verify(header: str, body: bytes, tolerance: int = 300) -> bool:
parts = dict(p.strip().split("=", 1) for p in header.split(",") if "=" in p)
t, sig = parts.get("t", ""), parts.get("v1", "")
if not t.isdigit() or abs(time.time() - int(t)) > tolerance:
return False
expected = hmac.new(SECRET.encode(), t.encode() + b"." + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, sig)
@app.post("/gocargo/webhook")
def webhook():
# Semnătura se calculează pe corpul BRUT, exact cum a sosit.
if not verify(request.headers.get("GoCargo-Signature", ""), request.get_data()):
abort(400)
event = request.get_json()
print(event["type"], event["data"])
return "", 204If you tick "HMAC signature required" when creating it, you also receive a signing secret. Each request must additionally carry the headers X-GoCargo-Timestamp (unix seconds) and X-GoCargo-Signature = HMAC-SHA256 in hex over {timestamp}.{METODĂ}.{cale}.{corp}.
cale is the full path on the server plus the exact query as you send it (if any), e.g. /api/v1/loads sau /api/v1/loads?status=active. For GET, the body is empty (the message ends with ".").import hashlib
import hmac
import json
import os
import time
import requests
ORIGIN = "https://gocargo.ro"
PATH = "/api/v1/loads"
KEY = os.environ["GOCARGO_API_KEY"]
SIGNING_SECRET = os.environ["GOCARGO_SIGNING_SECRET"]
body = json.dumps({"origin_city": "Cluj-Napoca", "dest_country": "DE", "dest_city": "Stuttgart",
"cargo": "Piese auto", "loading_date": "2026-12-03"}).encode()
ts = str(int(time.time()))
message = ts.encode() + b".POST." + PATH.encode() + b"." + body
signature = hmac.new(SIGNING_SECRET.encode(), message, hashlib.sha256).hexdigest()
r = requests.post(ORIGIN + PATH, data=body, timeout=30, headers={
"Authorization": "Bearer " + KEY,
"Content-Type": "application/json",
"X-GoCargo-Timestamp": ts,
"X-GoCargo-Signature": signature,
})
print(r.status_code, r.text)GET /export/{set}?format=csv|xlsx|json&from=AAAA-LL-ZZ&to=AAAA-LL-ZZ, with set ∈ loads, trucks, orders, quotes, reviews. The key needs export:read. Maximum 50,000 rows and 366 days per request. The CSV has a UTF-8 BOM and a ";" separator so it opens correctly in Excel.
curl -o comenzi.xlsx \
"https://gocargo.ro/api/v1/export/orders?format=xlsx&from=2026-01-01&to=2026-06-30" \
-H "Authorization: Bearer $GOCARGO_API_KEY"No code: Settings → Data export.
Never put the API key in HTML or in JavaScript in the browser. Anyone who opens the page sees it (View Source, DevTools) and can publish on behalf of your company. The key stays only on the server: the form submits to a script of yours, and the script calls GoCargo.
<!-- formularul din site: trimite la scriptul PHP de pe serverul vostru, NU la GoCargo -->
<form method="post" action="/publica.php">
<input name="origin_city" placeholder="De la" required>
<input name="dest_city" placeholder="Până la" required>
<input name="dest_country" value="RO" maxlength="2">
<input name="cargo" placeholder="Marfă" required>
<input name="loading_date" type="date" required>
<button>Publică pe GoCargo</button>
</form><?php // publica.php — cheia stă doar aici, pe server
$key = getenv('GOCARGO_API_KEY');
$load = [
'origin_country' => 'RO', 'origin_city' => $_POST['origin_city'] ?? '',
'dest_country' => strtoupper($_POST['dest_country'] ?? 'RO'), 'dest_city' => $_POST['dest_city'] ?? '',
'cargo' => $_POST['cargo'] ?? '', 'loading_date' => $_POST['loading_date'] ?? '',
];
$ch = curl_init('https://gocargo.ro/api/v1/loads');
curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $key, 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($load, JSON_UNESCAPED_UNICODE)]);
$res = curl_exec($ch);
http_response_code(curl_getinfo($ch, CURLINFO_HTTP_CODE) ?: 502);
header('Content-Type: application/json');
echo $res;Protect the script (only authenticated users on your site, CSRF token) and set GOCARGO_API_KEY in the server configuration, not in the file. Ideally, a key only with loads:write and a restriction to the server's IP.
The API is included in the Pro, Business and Enterprise plans. Start with a test key, risk-free.