From flexport-pack
Installs and configures Flexport API authentication using API keys or OAuth credentials for logistics and supply chain REST API integrations.
npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin flexport-packThis skill is limited to using the following tools:
Configure Flexport API authentication for logistics and supply chain integration. Flexport offers two auth methods: **API Keys** (simple bearer tokens that never expire) and **API Credentials** (client ID/secret pairs that issue JWTs valid for 24 hours). The v2 REST API base URL is `https://api.flexport.com` and speaks JSON.
Generates TypeScript example for Flexport REST API v2: lists shipments, fetches details/milestones, tracks containers via fetch. For new integrations, setup testing, API learning.
Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Share bugs, ideas, or general feedback.
Configure Flexport API authentication for logistics and supply chain integration. Flexport offers two auth methods: API Keys (simple bearer tokens that never expire) and API Credentials (client ID/secret pairs that issue JWTs valid for 24 hours). The v2 REST API base URL is https://api.flexport.com and speaks JSON.
Navigate to Flexport Portal > Settings > Developer. Two options:
| Auth Method | Format | Lifetime | Use Case |
|---|---|---|---|
| API Key | Bearer token string | Permanent | Simple integrations, scripts |
| API Credentials | Client ID + Secret | JWT, 24h | Production apps, rotating tokens |
# .env (NEVER commit — add to .gitignore)
FLEXPORT_API_KEY=your_api_key_here
# OR for OAuth credentials flow:
FLEXPORT_CLIENT_ID=your_client_id
FLEXPORT_CLIENT_SECRET=your_client_secret
FLEXPORT_API_URL=https://api.flexport.com
// src/flexport/client.ts
const FLEXPORT_BASE = 'https://api.flexport.com';
async function flexportRequest(path: string, options: RequestInit = {}) {
const res = await fetch(`${FLEXPORT_BASE}${path}`, {
...options,
headers: {
'Authorization': `Bearer ${process.env.FLEXPORT_API_KEY}`,
'Content-Type': 'application/json',
'Flexport-Version': '2',
...options.headers,
},
});
if (!res.ok) throw new Error(`Flexport ${res.status}: ${await res.text()}`);
return res.json();
}
let tokenCache: { token: string; expiresAt: number } | null = null;
async function getAccessToken(): Promise<string> {
if (tokenCache && Date.now() < tokenCache.expiresAt) return tokenCache.token;
const res = await fetch('https://api.flexport.com/oauth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
client_id: process.env.FLEXPORT_CLIENT_ID,
client_secret: process.env.FLEXPORT_CLIENT_SECRET,
grant_type: 'client_credentials',
}),
});
const { access_token, expires_in } = await res.json();
tokenCache = { token: access_token, expiresAt: Date.now() + (expires_in - 60) * 1000 };
return access_token;
}
async function verifyFlexport() {
const data = await flexportRequest('/shipments?per=1&page=1');
console.log(`Connected. Shipments found: ${data.data?.records?.length ?? 0}`);
}
await verifyFlexport();
| Error | Code | Cause | Solution |
|---|---|---|---|
Unauthorized | 401 | Invalid or expired key | Regenerate in Portal > Developer |
Forbidden | 403 | Insufficient scope | Check key permissions |
Token expired | 401 | JWT past 24h | Re-fetch via client credentials |
Rate limit exceeded | 429 | Too many requests | Exponential backoff |
import os, requests
class FlexportClient:
BASE = 'https://api.flexport.com'
def __init__(self):
self.session = requests.Session()
self.session.headers.update({
'Authorization': f'Bearer {os.environ["FLEXPORT_API_KEY"]}',
'Content-Type': 'application/json',
'Flexport-Version': '2',
})
def get(self, path, params=None):
r = self.session.get(f'{self.BASE}{path}', params=params)
r.raise_for_status()
return r.json()
curl -s -H "Authorization: Bearer $FLEXPORT_API_KEY" \
-H "Flexport-Version: 2" \
https://api.flexport.com/shipments?per=1 | jq '.data.records | length'
After successful auth, proceed to flexport-hello-world for your first shipment query.