Skip to content
Skillv1.0.0

flexport-hello-world

Create a minimal working Flexport example — list shipments and track containers. Use when starting a new Flexport integration, testing your setup, or learning the Flexport REST API v2 patterns. Trigge

by jeremylongshore(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from jeremylongshore/tons-of-skills-marketplace (skills/.curated/flexport-hello-world/SKILL.md). Install upstream with npx skills add jeremylongshore/tons-of-skills-marketplace --skill flexport-hello-world. Copyright stays with the author (MIT).

Flexport Hello World

Overview

List shipments and retrieve tracking milestones using the Flexport REST API v2. Flexport has no npm SDK -- you call https://api.flexport.com directly with bearer token auth and a Flexport-Version: 2 header.

Prerequisites

  • FLEXPORT_API_KEY environment variable set
  • Completed flexport-install-auth setup
  • Node.js 18+ (uses native fetch)

Instructions

Step 1: List Your Shipments

// src/flexport/hello.ts
const BASE = 'https://api.flexport.com';
const headers = {
  'Authorization': `Bearer ${process.env.FLEXPORT_API_KEY}`,
  'Flexport-Version': '2',
  'Content-Type': 'application/json',
};

// List shipments with pagination
const res = await fetch(`${BASE}/shipments?per=5&page=1`, { headers });
const { data } = await res.json();

data.records.forEach((shipment: any) => {
  console.log(`${shipment.id} | ${shipment.status} | ${shipment.freight_type}`);
  console.log(`  Origin: ${shipment.origin_port?.name ?? 'N/A'}`);
  console.log(`  Dest:   ${shipment.destination_port?.name ?? 'N/A'}`);
});

Step 2: Get Shipment Details with Milestones

// Retrieve a single shipment with tracking milestones
const shipmentId = data.records[0].id;
const detail = await fetch(`${BASE}/shipments/${shipmentId}`, { headers }).then(r => r.json());

console.log(`\nShipment ${detail.data.id}:`);
console.log(`  Status: ${detail.data.status}`);
console.log(`  Cargo ready: ${detail.data.cargo_ready_date}`);
console.log(`  Containers: ${detail.data.containers?.length ?? 0}`);

Step 3: List Containers on a Shipment

// Get container details for ocean freight shipments
const containers = await fetch(
  `${BASE}/shipments/${shipmentId}/containers`, { headers }
).then(r => r.json());

containers.data.records.forEach((c: any) => {
  console.log(`Container ${c.container_number} | ${c.container_type} | ${c.status}`);
});

Output

shp_abc123 | in_transit | ocean
  Origin: Shanghai Port
  Dest:   Los Angeles Port

Shipment shp_abc123:
  Status: in_transit
  Cargo ready: 2025-03-01
  Containers: 2

Container MSKU1234567 | 40ft_hc | in_transit

Error Handling

Error Cause Solution
401 Unauthorized Invalid API key Check FLEXPORT_API_KEY env var
404 Not Found Wrong shipment ID Verify ID from /shipments list
422 Unprocessable Bad query params Check per/page are integers
Empty records array No shipments yet Create a booking first or use sandbox

Examples

Python Quick Start

import os, requests

BASE = 'https://api.flexport.com'
headers = {
    'Authorization': f'Bearer {os.environ["FLEXPORT_API_KEY"]}',
    'Flexport-Version': '2',
}

shipments = requests.get(f'{BASE}/shipments', headers=headers, params={'per': 5}).json()
for s in shipments['data']['records']:
    print(f"{s['id']} | {s['status']} | {s['freight_type']}")

cURL One-Liner

curl -s -H "Authorization: Bearer $FLEXPORT_API_KEY" \
     -H "Flexport-Version: 2" \
     https://api.flexport.com/shipments?per=3 | jq '.data.records[] | {id, status, freight_type}'

Resources

Next Steps

Proceed to flexport-local-dev-loop for development workflow setup.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/jeremylongshore-tons-of-skills-marketplace-flexport-hello-world/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

jeremylongshore-tons-of-skills-marketplace-flexport-hello-world.ocm.jsonjson
{
  "ocm": "1",
  "id": "jeremylongshore-tons-of-skills-marketplace-flexport-hello-world",
  "kind": "skill",
  "name": "flexport-hello-world",
  "description": "Create a minimal working Flexport example — list shipments and track containers. Use when starting a new Flexport integration, testing your setup, or learning the Flexport REST API v2 patterns. Trigger: \"flexport hello world\", \"flexport example\", \"flexport quick start\".",
  "publisher": "jeremylongshore",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general_chat",
      "coding"
    ],
    "tags": [
      "skill-md",
      "saas",
      "logistics",
      "flexport",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Create a minimal working Flexport example — list shipments and track containers. Use when starting a new Flexport integration, testing your setup, or learning the Flexport REST API v2 patterns. Trigger: \"flexport hello world\", \"flexport example\", \"flexport quick start\"."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/jeremylongshore/tons-of-skills-marketplace",
      "path": "skills/.curated/flexport-hello-world/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/jeremylongshore/tons-of-skills-marketplace/blob/HEAD/skills/.curated/flexport-hello-world/SKILL.md",
      "key": "jeremylongshore/tons-of-skills-marketplace/skills/.curated/flexport-hello-world/SKILL.md"
    },
    "compatibility": "Designed for Claude Code",
    "allowed_tools": [
      "Read,",
      "Write,",
      "Edit,",
      "Bash(npm:*),",
      "Bash(curl:*)"
    ],
    "license": "MIT"
  },
  "instructions": "# Flexport Hello World\n\n## Overview\n\nList shipments and retrieve tracking milestones using the Flexport REST API v2. Flexport has no npm SDK -- you call `https://api.flexport.com` directly with bearer token auth and a `Flexport-Version: 2` header.\n\n## Prerequisites\n\n- `FLEXPORT_API_KEY` environment variable set\n- Completed `flexport-install-auth` setup\n- Node.js 18+ (uses native `fetch`)\n\n## Instructions\n\n### Step 1: List Your Shipments\n\n```typescript\n// src/flexport/hello.ts\nconst BASE = 'https://api.flexport.com';\nconst headers = {\n  'Authorization': `Bearer ${process.env.FLEXPORT_API_KEY}`,",
  "cost": {
    "context_tokens": 870
  }
}

Fetch it by URL: GET /api/v1/registry/jeremylongshore-tons-of-skills-marketplace-flexport-hello-world/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.