Embed Shipment Tracking
This guide explains how to generate a public share link for a shipment and embed it as an interactive tracking map in your application.
Overview
The Share Link API lets you create a time-limited, public URL for a shipment's tracking page. This URL can be:
- Shared directly with external parties (e.g., customers, partners)
- Embedded in your application using an iframe
Step 1: Generate a Share Link
Call the Create Share Link endpoint:
POST /v1/accounts/{accountId}/shipments/{shipmentId}/shareLink
Required permissionThe role of your API application in the shipment's account must allow writing shipment share links. Otherwise the request is rejected with
403 Forbidden.
Request Body
A request body is required, but every field is optional, so {} is valid. Set the TTL (time to live) and choose what information to include on the tracking page:
{
"ttl": 31536000,
"includeAlerts": true,
"includeMilestones": true,
"includeCarrierEvents": true,
"includeRoute": true,
"includeDocuments": false
}| Parameter | Type | Description |
|---|---|---|
ttl | integer | Link validity in seconds, from 1 to 32000000 (~1 year). Default: 7776000 (90 days). Example: 31536000 (1 year). See Link Expiry. |
includeAlerts | boolean | Show alerts on the tracking page. Default: false. |
includeMilestones | boolean | Show milestones on the tracking page. Default: false. |
includeCarrierEvents | boolean | Show carrier events on the tracking page. Default: false. |
includeRoute | boolean | Show the shipment route on the tracking page. Default: false. |
includeDocuments | boolean | Show documents on the tracking page. Default: false. |
Response
A successful request returns 200 OK:
{
"url": "https://sync.sensos.io/shipment-tracking?key={generatedKey}"
}Important: Cache this URL throughout its validity period. Avoid generating a new link on every request.
Each call creates a new link with a new key. Links you created earlier stay valid until they expire.
The endpoint returns 400 Bad Request for an invalid body (for example, a ttl outside the allowed range) and 404 Not Found if the shipment does not exist.
Link Expiry
- If
ttlis less than 4 hours, the link expires exactlyttlseconds after it is created. - If
ttlis 4 hours or more, the expiry is rounded up to the next midnight (UTC) after now +ttl. - Once the link has expired, the tracking page returns
403 Forbidden. Create a new link to restore access.
For full API details, see the Create Share Link API Reference.
Step 2: Embed the Tracking Page in an iframe
Use the returned URL directly in an iframe:
<iframe
src="https://sync.sensos.io/shipment-tracking?key={generatedKey}"
width="100%"
height="600"
frameborder="0"
allowfullscreen>
</iframe>Step 3: Show Map Only (Optional)
If you want to display only the map without the full tracking page UI, append the view=mapOnly query parameter:
https://sync.sensos.io/shipment-tracking?key={generatedKey}&view=mapOnly
iframe example:
<iframe
src="https://sync.sensos.io/shipment-tracking?key={generatedKey}&view=mapOnly"
width="100%"
height="600"
frameborder="0"
allowfullscreen>
</iframe>Notes
- The maximum TTL is
32000000seconds (approximately 1 year); the default is 90 days. - The share link is publicly accessible — anyone with the URL can view the tracking page.
- Cache the generated URL and reuse it until it expires, rather than creating a new link on each page load.
Updated about 1 month ago
