Skip to content

Utility & Edge AI Tools API

Reference specifications for QR code generation, web page markdown conversion, bulk import/export, and Cloudflare Workers AI inference.

Utility & Edge AI Tools API

The Tools API exposes specialized edge utilities: high-performance QR code rendering, automated markdown extraction, asynchronous bulk link imports/exports, and zero-latency AI metadata optimization.


1. QR Code Generation

Generate scannable vector SVG or PNG QR codes with customizable error correction and payload formats.

POST /api/v1/tools/qr

Request Body Parameters

Field Type Required Description
type string Yes Payload format: 'url', 'text', 'wifi', 'vcard', or 'email'.
content string | object Yes Payload content. For 'url' or 'text', pass a string. For specialized types, pass an options object.
size integer No Dimension in pixels (min: 64, max: 1024, default: 246).
ecc string No Error correction level: 'L' (~7%), 'M' (~15%, default), 'Q' (~25%), 'H' (~30%).
format string No Render format: 'svg' (default) or 'png'.

Specialized Payload Formats

{
  "type": "wifi",
  "content": {
    "ssid": "Office-Guest",
    "password": "SecretPassword123",
    "encryption": "WPA",
    "hidden": false
  }
}
{
  "type": "vcard",
  "content": {
    "firstName": "Sarah",
    "lastName": "Connor",
    "organization": "Cyberdyne Systems",
    "title": "Head of Security",
    "phone": "+1-555-0199",
    "email": "sarah@cyberdyne.com",
    "url": "https://shaf.is/sarah"
  }
}
{
  "type": "url",
  "content": "https://shaf.is/summer-promo",
  "size": 320,
  "ecc": "H",
  "format": "svg"
}

Response (HTTP 200 OK)

{
  "code": 0,
  "data": {
    "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 320\">...</svg>",
    "size": 320,
    "ecc": "H"
  }
}

2. Web Page Markdown Extractor

Scrapes a destination web page, eliminates navigation chrome, and produces clean markdown with estimated reading and token metrics for LLM ingestion.

POST /api/v1/tools/markdown (or GET /api/v1/tools/markdown?url=...)

Request Body Parameters

Validated against MarkdownToolRequestSchema in shared/schemas/tools.ts.

Field Type Default Description
url string Required Target HTTP/HTTPS URL to scrape and parse.
includeFrontmatter boolean true Include YAML frontmatter containing title, description, and source URL.
stripImages boolean false Remove image tags from rendered markdown.
stripLinks boolean false Remove hyperlink wrappers from rendered markdown.
mainContentOnly boolean true Exclude navigation headers, footers, and advertisement sidebars.

Response Example (HTTP 200 OK)

{
  "code": 0,
  "data": {
    "url": "https://stripe.com/docs/billing",
    "title": "Stripe Billing Overview",
    "description": "Learn how recurring billing and subscriptions work.",
    "markdown": "# Stripe Billing Overview\n\nStripe Billing lets you bill and manage customers...",
    "renderedHtml": "<h1>Stripe Billing Overview</h1><p>...</p>",
    "stats": {
      "words": 842,
      "characters": 5420,
      "readingTimeMinutes": 4.2,
      "estimatedTokens": 1150
    },
    "scrapedAt": "2026-11-21T18:00:00.000Z"
  }
}

Import up to 1,000 links in a single atomic transaction.

POST /api/v1/tools/bulk-import (or POST /api/link/import)

Request Body Parameters

Validated against ImportDataSchema in shared/schemas/import.ts.

{
  "version": "1.0",
  "links": [
    {
      "url": "https://example.com/page-1",
      "slug": "promo-01",
      "tags": ["batch-import"]
    },
    {
      "url": "https://example.com/page-2",
      "slug": "promo-02",
      "tags": ["batch-import"]
    }
  ]
}

Response Example (HTTP 200 OK)

Returns structured ImportResult tracking successful and rejected entries:

{
  "code": 0,
  "data": {
    "success": 2,
    "skipped": 0,
    "failed": 0,
    "successItems": [
      {
        "index": 0,
        "slug": "promo-01",
        "url": "https://example.com/page-1"
      },
      {
        "index": 1,
        "slug": "promo-02",
        "url": "https://example.com/page-2"
      }
    ],
    "skippedItems": [],
    "failedItems": []
  }
}

Export all links registered to the active organization with pagination cursor support. Requires the csvExport feature capability.

GET /api/v1/tools/export (or GET /api/link/export)

Query Parameters

Parameter Type Description
cursor string Opaque cursor token from previous response for sequential batch traversal.
organizationId string Optional workspace ID override when using an administrative service token.

Response Example (HTTP 200 OK)

Returns schema adhering to ExportData in shared/schemas/link.ts:

{
  "version": "1.0",
  "exportedAt": "2026-11-21T18:00:00.000Z",
  "count": 50,
  "links": [
    {
      "id": "lnk_98fa01",
      "slug": "launch-event",
      "url": "https://brand.com/event",
      "createdAt": 1774180000,
      "updatedAt": 1774180000
    }
  ],
  "cursor": "eyJzbHVnIjoibGF1bmNoLWV2ZW50In0=",
  "list_complete": true
}

5. Cloudflare Workers AI Slug Recommendation

Analyzes destination page semantic content using Cloudflare Workers AI to recommend human-readable, brand-appropriate slugs.

POST /api/v1/tools/ai-slug

Request Body

{
  "url": "https://stripe.com/docs/billing/subscriptions/overview"
}

Response Example (HTTP 200 OK)

{
  "code": 0,
  "data": {
    "slug": "stripe-billing-subscriptions"
  }
}

6. Cloudflare Workers AI OpenGraph Card Extraction

Scrapes destination page markup and automatically crafts optimized title and description meta attributes for social media card previews.

POST /api/v1/tools/ai-og

Request Body

{
  "url": "https://acme.com/engineering/edge-routing"
}

Response Example (HTTP 200 OK)

{
  "code": 0,
  "data": {
    "title": "Edge-Native Link Infrastructure on Cloudflare Workers",
    "description": "Discover how sub-10ms Anycast routing and distributed D1/KV caching eliminate redirect latency globally."
  }
}

Type to search…

↑↓ navigate↵ selectEsc close