API Endpoints

Complete reference for all available FWURL API endpoints.

Create a new short link.

POST /v1/links

Request Body:

{
  "url": "https://example.com/long-url",
  "customSlug": "my-link",
  "title": "My Link",
  "tags": ["marketing", "campaign"],
  "expiresAt": "2024-12-31T23:59:59Z",
  "domain": "go.yourbrand.com"
}

Parameters:

FieldTypeRequiredDescription
urlstringYesDestination URL
customSlugstringNoCustom back-half
titlestringNoLink title
tagsarrayNoOrganization tags
expiresAtstringNoISO 8601 expiration date
domainstringNoCustom domain

Response:

{
  "success": true,
  "data": {
    "id": "abc123",
    "shortUrl": "https://fwurl.com/my-link",
    "longUrl": "https://example.com/long-url",
    "title": "My Link",
    "tags": ["marketing", "campaign"],
    "createdAt": "2024-01-01T00:00:00Z",
    "expiresAt": "2024-12-31T23:59:59Z"
  }
}

Retrieve details for a specific link.

GET /v1/links/:id

Response:

{
  "success": true,
  "data": {
    "id": "abc123",
    "shortUrl": "https://fwurl.com/my-link",
    "longUrl": "https://example.com/long-url",
    "title": "My Link",
    "tags": ["marketing", "campaign"],
    "clicks": 1234,
    "createdAt": "2024-01-01T00:00:00Z"
  }
}

Update an existing link.

PATCH /v1/links/:id

Request Body:

{
  "longUrl": "https://example.com/new-url",
  "title": "Updated Title",
  "tags": ["updated", "tags"]
}

Response:

{
  "success": true,
  "data": {
    "id": "abc123",
    "shortUrl": "https://fwurl.com/my-link",
    "longUrl": "https://example.com/new-url",
    "title": "Updated Title",
    "tags": ["updated", "tags"],
    "updatedAt": "2024-01-02T00:00:00Z"
  }
}

Delete a link permanently.

DELETE /v1/links/:id

Response:

{
  "success": true,
  "message": "Link deleted successfully"
}

Get a paginated list of your links.

GET /v1/links

Query Parameters:

ParameterTypeDescription
pagenumberPage number (default: 1)
limitnumberResults per page (max: 100)
tagstringFilter by tag
domainstringFilter by domain
searchstringSearch query

Response:

{
  "success": true,
  "data": {
    "links": [
      {
        "id": "abc123",
        "shortUrl": "https://fwurl.com/my-link",
        "longUrl": "https://example.com/long-url",
        "title": "My Link",
        "clicks": 1234,
        "createdAt": "2024-01-01T00:00:00Z"
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 20,
      "total": 100,
      "pages": 5
    }
  }
}

Analytics

Retrieve analytics for a specific link.

GET /v1/analytics/:linkId

Query Parameters:

ParameterTypeDescription
fromstringStart date (ISO 8601)
tostringEnd date (ISO 8601)
groupstringGroup by: hour, day, week, month

Response:

{
  "success": true,
  "data": {
    "totalClicks": 1234,
    "uniqueClicks": 890,
    "clicksByDate": [
      {
        "date": "2024-01-01",
        "clicks": 45
      }
    ],
    "topCountries": [
      {
        "country": "United States",
        "clicks": 567
      }
    ],
    "devices": {
      "desktop": 600,
      "mobile": 500,
      "tablet": 134
    }
  }
}

Domains

List Domains

Get all custom domains.

GET /v1/domains

Response:

{
  "success": true,
  "data": {
    "domains": [
      {
        "id": "dom123",
        "domain": "go.yourbrand.com",
        "verified": true,
        "default": false,
        "createdAt": "2024-01-01T00:00:00Z"
      }
    ]
  }
}

Add a Domain

Add a new custom domain.

POST /v1/domains

Request Body:

{
  "domain": "go.yourbrand.com"
}

Response:

{
  "success": true,
  "data": {
    "id": "dom123",
    "domain": "go.yourbrand.com",
    "verified": false,
    "verificationCode": "fwurl-verify-abc123",
    "dnsRecords": [
      {
        "type": "CNAME",
        "name": "go",
        "value": "custom.fwurl.com"
      },
      {
        "type": "TXT",
        "name": "_fwurl-verification",
        "value": "fwurl-verify-abc123"
      }
    ]
  }
}

QR Codes

Get QR Code

Generate a QR code for a link.

GET /v1/qr/:linkId

Query Parameters:

ParameterTypeDescription
sizenumberSize in pixels (default: 512)
formatstringpng, svg, pdf (default: png)
foregroundstringHex color (default: #000000)
backgroundstringHex color (default: #FFFFFF)

Response:

Returns the QR code image in the specified format.

Rate Limits

All API responses include rate limit headers:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640000000

Error Responses

Error Format

{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message"
  }
}

Common Error Codes

CodeStatusDescription
INVALID_API_KEY401API key is invalid or revoked
MISSING_API_KEY401No API key provided
INSUFFICIENT_PERMISSIONS403API key lacks required permissions
NOT_FOUND404Resource not found
RATE_LIMIT_EXCEEDED429Too many requests
INVALID_URL400URL is invalid
SLUG_TAKEN400Custom slug already in use
VALIDATION_ERROR400Request validation failed

Pagination

List endpoints support pagination:

{
  "data": {
    "items": [...],
    "pagination": {
      "page": 1,
      "limit": 20,
      "total": 100,
      "pages": 5,
      "hasNext": true,
      "hasPrev": false
    }
  }
}

Webhooks

Subscribe to link events:

  • link.created - New link created
  • link.updated - Link modified
  • link.deleted - Link removed
  • link.clicked - Link was clicked

Configure webhooks in Settings > Webhooks.