Redirections
API Reference

Export Endpoint

Download redirect configuration in various server formats.

Export Endpoint

Download redirect configuration files in various server formats.

Endpoint

GET /v1/export

Description

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

NameTypeRequiredDescription
projectstringYesProject ID from your dashboard
formatstringYesExport format (see supported formats below)
versionnumberNoSpecific deployment version number to export

Headers

NameTypeRequiredDescription
X-API-KeystringYesAPI key for authentication (format: redir_live_...)

Supported Formats

The API supports 7 export formats optimized for different server configurations:

FormatDescriptionFile ExtensionUse Case
csvComma-separated values.csvData import/analysis
nginxNginx rewrite configuration.confFull Nginx config
nginx-map-exactNginx map block (exact matches only).mapNginx map directive
nginx-map-prefixNginx map block (prefix matches only).mapNginx map directive
haproxyHAProxy redirect configuration.cfgFull HAProxy config
haproxy-map-exactHAProxy map file (exact matches only).mapHAProxy map directive
haproxy-map-prefixHAProxy map file (prefix matches only).mapHAProxy 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.csv

Download 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.conf

Download 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.cfg

Export 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.conf

Response 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: 1706745600

Response 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,exact

Fields:

  • source - Original URL path
  • destination - Redirect target path
  • statusCode - 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_3

Integration: Include in your HAProxy configuration file:

frontend http-in
  bind *:80

  # Include redirect rules
  # ... paste generated rules here

  default_backend servers

HAProxy Map Format (Exact Matches)

/blog/old-post /articles/new-post
/legacy/page /current/page

Integration:

frontend http-in
  bind *:80

  http-request redirect code 301 location %[path,map(/etc/haproxy/redirects-exact.map)]

  default_backend servers

Full 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,exact

Cache Behavior

Export responses are cached for 1 minute (60 seconds):

Cache-Control: public, max-age=60

When 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