Export Endpoint
Download redirect configuration in various server formats.
Export Endpoint
Download redirect configuration files in various server formats.
Endpoint
GET /v1/exportDescription
The export endpoint generates and downloads redirect configurations in formats compatible with popular web servers and load balancers. Each format is pre-computed during deployment and served directly from the edge with sub-50ms latency.
Use exports to integrate redirect rules into your existing infrastructure without changing your architecture.
Parameters
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| project | string | Yes | Project ID from your dashboard |
| format | string | Yes | Export format (see supported formats below) |
| version | number | No | Specific deployment version number to export |
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| X-API-Key | string | Yes | API key for authentication (format: redir_live_...) |
Supported Formats
The API supports 7 export formats optimized for different server configurations:
| Format | Description | File Extension | Use Case |
|---|---|---|---|
| csv | Comma-separated values | .csv | Data import/analysis |
| nginx | Nginx rewrite configuration | .conf | Full Nginx config |
| nginx-map-exact | Nginx map block (exact matches only) | .map | Nginx map directive |
| nginx-map-prefix | Nginx map block (prefix matches only) | .map | Nginx map directive |
| haproxy | HAProxy redirect configuration | .cfg | Full HAProxy config |
| haproxy-map-exact | HAProxy map file (exact matches only) | .map | HAProxy map directive |
| haproxy-map-prefix | HAProxy map file (prefix matches only) | .map | HAProxy map directive |
Separate exact and prefix format options allow you to use server-optimized data structures for O(1) exact lookups.
Request Examples
Download CSV Export
curl -X GET "https://api.3xx.app/v1/export?project=<project_id>&format=csv" \
-H "X-API-Key: redir_live_your_key_here" \
-o redirects.csvDownload Nginx Configuration
curl -X GET "https://api.3xx.app/v1/export?project=<project_id>&format=nginx" \
-H "X-API-Key: redir_live_your_key_here" \
-o redirects.confDownload HAProxy Configuration
curl -X GET "https://api.3xx.app/v1/export?project=<project_id>&format=haproxy" \
-H "X-API-Key: redir_live_your_key_here" \
-o redirects.cfgExport Specific Version
curl -X GET "https://api.3xx.app/v1/export?project=<project_id>&format=nginx&version=42" \
-H "X-API-Key: redir_live_your_key_here" \
-o redirects-v42.confResponse Codes
200 OK - Export Ready
Export file is available for download.
Response Headers:
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="redirects.conf"
Cache-Control: public, max-age=60
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1706745600Response Body: File contents in the requested format
400 Bad Request - Invalid Parameters
Missing project parameter:
{
"error": "Missing project parameter",
"code": "MISSING_PROJECT"
}Missing format parameter:
{
"error": "Missing format parameter",
"code": "MISSING_FORMAT"
}Invalid format value:
{
"error": "Invalid format. Use one of: csv, nginx, nginx-map-exact, nginx-map-prefix, haproxy, haproxy-map-exact, haproxy-map-prefix",
"code": "INVALID_FORMAT"
}401 Unauthorized - Authentication Error
Missing API key:
{
"error": "Unauthorized",
"code": "MISSING_API_KEY"
}Invalid or revoked API key:
{
"error": "Unauthorized",
"code": "INVALID_API_KEY"
}404 Not Found - Export Not Available
No export data exists for the project or specified version.
No deployment yet:
{
"error": "No exports available. Deploy first.",
"code": "NOT_FOUND"
}Version not found:
{
"error": "Export not found for version 42",
"code": "NOT_FOUND"
}Export files are generated during deployment. You must deploy your configuration before exports become available.
429 Too Many Requests - Rate Limit Exceeded
Rate limit exceeded:
{
"error": "Too Many Requests",
"code": "RATE_LIMIT_EXCEEDED"
}Includes Retry-After header with seconds to wait.
Format Examples
CSV Format
source,destination,statusCode,matchType
/blog/old-post,/articles/new-post,301,exact
/old-section,/new-section,302,starts_with
/legacy/page,/current/page,301,exactFields:
source- Original URL pathdestination- Redirect target pathstatusCode- HTTP status (301 or 302)matchType- Match type (exact or starts_with)
Nginx Configuration Format
# Exact match redirects
location = /blog/old-post { return 301 /articles/new-post; }
location = /legacy/page { return 301 /current/page; }
# Prefix match redirects
location ^~ /old-section { return 302 /new-section; }Integration:
Include this file in your main nginx.conf or site configuration:
server {
listen 80;
server_name example.com;
include /etc/nginx/redirects.conf;
# ... rest of config
}Nginx Map Format (Exact Matches)
map $uri $redirect_exact {
/blog/old-post /articles/new-post;
/legacy/page /current/page;
}Integration:
http {
include /etc/nginx/redirects-exact.map;
server {
if ($redirect_exact) {
return 301 $redirect_exact;
}
}
}HAProxy Configuration Format
# Exact match redirects
acl redirect_1 path -i /blog/old-post
http-request redirect code 301 location /articles/new-post if redirect_1
acl redirect_2 path -i /legacy/page
http-request redirect code 301 location /current/page if redirect_2
# Prefix match redirects
acl redirect_3 path_beg -i /old-section
http-request redirect code 302 location /new-section if redirect_3Integration: Include in your HAProxy configuration file:
frontend http-in
bind *:80
# Include redirect rules
# ... paste generated rules here
default_backend serversHAProxy Map Format (Exact Matches)
/blog/old-post /articles/new-post
/legacy/page /current/pageIntegration:
frontend http-in
bind *:80
http-request redirect code 301 location %[path,map(/etc/haproxy/redirects-exact.map)]
default_backend serversFull Response Example
$ curl -i -X GET "https://api.3xx.app/v1/export?project=<project_id>&format=csv" \
-H "X-API-Key: redir_live_your_key_here"
HTTP/2 200 OK
content-type: text/csv; charset=utf-8
content-disposition: attachment; filename="redirects.csv"
cache-control: public, max-age=60
x-ratelimit-limit: 100
x-ratelimit-remaining: 95
x-ratelimit-reset: 1706745600
source,destination,statusCode,matchType
/blog/old-post,/articles/new-post,301,exact
/old-section,/new-section,302,starts_with
/legacy/page,/current/page,301,exactCache Behavior
Export responses are cached for 1 minute (60 seconds):
Cache-Control: public, max-age=60When you deploy a new version, the cache is automatically invalidated and new exports propagate to all edge locations within 60-90 seconds.
Error Handling
For complete error documentation, see the Error Reference.
See Also
- API Reference Overview - Authentication, rate limits, caching
- Lookup Endpoint - Query redirect rules
- Error Reference - All error codes and resolutions