API Documentation
Integrate NextLinks into your applications with our powerful REST API.
Authentication
All API requests must include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Getting Your API Key
- Navigate to Account Settings
- Select API Keys
- Click "Generate New Key"
- Copy and securely store your key
Link Management API
Create Link
POST /v1/links
Create a new NextLink with custom parameters.
curl -X POST https://api.nextlinks.com/v1/links \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "destination": "https://example.com", "custom_path": "my-link", "tags": ["campaign-2024"], "utm_source": "api", "expiration": "2024-12-31T23:59:59Z" }'
Get Link
GET /v1/links/{id}
Retrieve details about a specific link.
curl https://api.nextlinks.com/v1/links/abc123 \ -H "Authorization: Bearer YOUR_API_KEY"
Update Link
PATCH /v1/links/{id}
Update an existing link's properties.
curl -X PATCH https://api.nextlinks.com/v1/links/abc123 \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "tags": ["updated-campaign"], "expiration": "2025-12-31T23:59:59Z" }'
Analytics API
Get Click Data
GET /v1/analytics/clicks
Retrieve click analytics for your links.
curl "https://api.nextlinks.com/v1/analytics/clicks?\ start_date=2024-01-01&end_date=2024-01-31&\ dimensions=country,device" \ -H "Authorization: Bearer YOUR_API_KEY"
Get Conversion Data
GET /v1/analytics/conversions
Retrieve conversion data for your links.
curl "https://api.nextlinks.com/v1/analytics/conversions?\ link_id=abc123&start_date=2024-01-01" \ -H "Authorization: Bearer YOUR_API_KEY"
Webhook Management
Create Webhook
POST /v1/webhooks
Create a new webhook endpoint.
curl -X POST https://api.nextlinks.com/v1/webhooks \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://your-server.com/webhook", "events": ["link.clicked", "conversion.recorded"], "secret": "your-webhook-secret" }'
Rate Limits
API requests are subject to rate limiting based on your plan:
Free Plan
- 60 requests per minute
- 1,000 requests per day
Pro Plan
- 300 requests per minute
- 10,000 requests per day
Enterprise Plan
- Custom limits available
- Contact sales for details
Error Handling
The API uses standard HTTP response codes and returns errors in JSON format:
{ "error": { "code": "invalid_request", "message": "The request was invalid", "details": { "field": "destination", "reason": "URL is required" } } }
Common Error Codes
- 400 - Bad Request
- 401 - Unauthorized
- 403 - Forbidden
- 404 - Not Found
- 429 - Too Many Requests
- 500 - Internal Server Error