Getting Started
Integration guide
API Help & Guides
Everything you need to integrate with Gateway's shipping API. From getting started to advanced usage patterns.
Getting Started
Create an API Account
Sign up for a free API account at api.gatewaylines.com/signup. Once registered, you can generate API keys and start making requests immediately.
Already a Gateway shipping customer? You can log in with your existing account — no need to sign up again.
Generate an API Key
Navigate to API Keys in your API portal. Click "Create New Key" and give it a descriptive name. Choose between two tiers:
Free Tier
Prefix: gw_...
5 API calls per day. Perfect for testing and small projects.
Tariff Pro ($199/mo)
Prefix: gw_...
10,000 API calls per month. Built-in calculator and branded reports.
Important: Save your API key immediately
Your API key is only shown once. Copy it to a secure location. If lost, you'll need to generate a new one.
Make Your First Request
Test your API key by making a simple tariff calculation request:
curl -X POST "https://api.gatewaylines.com/api/tariff/public/calculate" \
-H "Content-Type: application/json" \
-H "X-API-Key: gw_your_key_here" \
-d '{"hts_code": "8471.30.01", "country_code": "CN", "declared_value": 10000}'You'll receive a tariff calculation with duty rates and amounts:
{
"hts_code": "8471.30.01",
"description": "Portable digital automatic data processing machines...",
"total_tariff_rate": 145,
"total_duty": 14500,
"remaining": 4
}Free tier includes 5 API calls per day. Upgrade to Tariff Pro for 10,000 calls/month.
Explore the API Reference
Now that you're connected, explore the full API reference to discover all available endpoints including tariff calculation, AI HTS search, container tracking, and parcel quotes.
Rate Limits
To ensure fair usage and system stability, all API requests are subject to rate limiting.
50 requests
Rolling 60-second window
1,000 requests
Resets at midnight UTC
Rate Limit Headers
Every API response includes headers to help you track your usage:
X-RateLimit-Limit: 50
X-RateLimit-Remaining: 47
X-RateLimit-Reset: 1704067200
Need higher limits? Contact [email protected] to discuss enterprise rate limits for high-volume integrations.
Best Practices
API Key Security
- Store API keys in environment variables, never in code
- Use different keys for development and production
- Rotate keys periodically (every 90 days recommended)
- Revoke compromised keys immediately
Error Handling
- Always check HTTP status codes before parsing responses
- Implement exponential backoff for 429 (rate limit) errors
- Log API errors with request IDs for troubleshooting
- Handle network timeouts gracefully (30s recommended)
Performance
- Cache responses where appropriate (tracking data: 5 min)
- Use pagination for list endpoints (default: 50 items)
- Use webhooks instead of polling for real-time updates
- Batch requests when possible to reduce API calls
Data Handling
- Always use HTTPS for all API requests
- Validate webhook signatures before processing
- Store timestamps in UTC format
- Use ISO 8601 date format for all date parameters
Frequently Asked Questions
Support
Enterprise Support
Need dedicated support, custom integrations, or higher rate limits? Our enterprise team can help with custom solutions for high-volume shippers.
Contact Enterprise Sales