You can think of XAPI as: an out-of-the-box backend toolbox for developers.

It provides a suite of common backend API services designed to let you quickly integrate dynamic content, data analytics, QR code generation, and file storage into your applications without writing a single line of backend code. You just need to focus on your core business and front-end development, while XAPI provides stable, high-performance underlying support.

  • Unified API Endpoint: All services are provided through api.xabcstack.com, with management interfaces using a unified XAPI KEY. The API design follows RESTful principles, making it simple and easy to use.
  • High-Performance Architecture: Built-in multi-level caching (in-memory, Redis) ensures millisecond-level responses under high concurrency, providing a smooth experience for your applications.
  • Event-Driven Design: Services are decoupled via an event bus, ensuring high system cohesion and data consistency.

Core Services

XAPI currently offers four core services: Dynamic Card Service, Website Analytics Service, QR Code Generation Service, and File Storage Service.

1. X-CARD Dynamic Card Service

X-CARD is a lightweight, dynamic content delivery system, perfect for scenarios like in-app announcements, notifications, promotional cards, and dashboard information modules. The cards on the right side of this website are powered by X-CARD.

  • Core Features:
    • Dynamic Creation: Create cards with titles, content, images, and links at any time via the API.
    • Priority Sorting: Set card priorities to intelligently control their display order on the front end.
    • Auto-Expiration: Set an expiration date for cards, after which they are automatically taken offline without manual intervention.
    • Display Control: Limit the maximum number of times a card is displayed for precise content delivery.

2. X-STATS Website Analytics Service

X-STATS is a simple, cookie-less website analytics service for lightweight tracking of page or link visits. It is privacy-friendly for your visitors. The data statistics at the bottom of this page are powered by X-STATS.

  • Core Features:
    • Visit Tracking: Track the number of visits (PV) for any URL with a single line of code.
    • Referer Analysis: Automatically parse and count visit source domains (Referers).
    • Data Dashboard: Provides leaderboards for popular URLs and top referers to quickly understand traffic distribution.
    • Data Overview: Offers aggregated user-level data, including total visits and total unique referers.

3. X-QRCODE QR Code Generation Service

X-QRCODE is a fast and reliable QR code generation service that allows you to dynamically create various QR codes, ideal for product link sharing, promotional campaigns, and quick mobile access.

  • Core Features:
    • Instant Generation: Generate QR codes for any URL in real-time via the API, with support for custom sizes (128-1024px).
    • Automatic Management: QR codes can have an expiration date (up to 10 years) and are automatically cleaned up to save storage.
    • Batch Management: Supports querying and managing all QR codes under your account for easy maintenance.
    • Base64 Output: The generated QR code is returned in Base64 format, ready to be embedded directly into web pages or mobile apps.
    • High-Performance Caching: Based on Redis storage to ensure millisecond-level generation and retrieval speeds.

4. X-FILE File Storage Service

X-FILE is a secure, multi-tenant file storage service designed for developers to handle scenarios like temporary file sharing, user-generated content uploads (e.g., avatars, attachments), and data report distribution.

  • Core Features:
    • Secure Multi-Tenant Isolation: Each user's files are stored in a separate directory, ensuring complete data isolation.
    • Flexible Quota Management: Provides multi-tiered storage quotas from GBs to TBs with real-time usage tracking.
    • Temporary Links & Security Controls: Set custom expiration times (e.g., "1h", "7d") and maximum download counts for your files.
    • Large File Support: Supports single file uploads up to 256MB (configurable) to meet most business needs.
    • Complete API Management: Offers a full suite of management APIs for uploading, downloading, listing, deleting, and checking quotas.

API Quick Start

After registering, you will receive two types of keys:

  • Private Key (sk-...): Used for secure, authenticated operations like creating, modifying, and deleting resources.
  • Public Key (pk-...): Used for operations that can be exposed on the front end, such as data tracking and querying public data.

Example 1: Create an announcement card (using a private key)

Use your sk- key to create an announcement card that is valid for 7 days.

export XAPI_KEY="your-xapi-key" # Your sk- prefixed key

curl -X POST https://api.xabcstack.com/x-card \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAPI_KEY" \
  -d '{
      "title": "🎉 New Feature Launch!",
      "content": "Our new Website Analytics Service is now live. Come check it out!",
      "link": "https://xabcstack.com",
      "priority": 10,
      "days": 7
    }'

Example 2: Fetch and display cards on the front end (using a public key)

In your website or app, use your pk- key to fetch all active cards for display.

export XAPI_PUBLIC_KEY="your-public-key" # Your pk- prefixed key

curl -X GET "https://api.xabcstack.com/x-card/${XAPI_PUBLIC_KEY}"

Example 3: Track a page view on the front end (using a public key)

Embed this request in your website's front-end code to track page views.

export XAPI_PUBLIC_KEY="your-public-key" # Your pk- prefixed key

curl -X POST "https://api.xabcstack.com/x-urls/${XAPI_PUBLIC_KEY}/track" \
  -H "Content-Type: application/json" \
  -H "Referer: https://www.google.com/" \
  -d '{
      "url": "https://yoursite.com/pricing"
    }'

Example 4: Get an overview of your analytics data (using a public key)

Fetch a statistical overview for all URLs under your account, including total visits and Top 10 popular URLs.

export XAPI_PUBLIC_KEY="your-public-key" # Your pk- prefixed key

curl -X GET "https://api.xabcstack.com/x-urls/${XAPI_PUBLIC_KEY}/overview?limit=10"

Example 5: Generate a QR code (using a private key)

Generate a 512px QR code for your website that expires in 30 days.

export XAPI_KEY="your-xapi-key" # Your sk- prefixed key

curl -X POST https://api.xabcstack.com/x-qrcode \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAPI_KEY" \
  -d '{
      "url": "https://yoursite.com/promotion",
      "title": "Summer Sale Event",
      "size": 512,
      "days": 30
    }'

Example 6: Get a specific QR code (using a private key)

Retrieve details for a QR code using its ID.

export XAPI_KEY="your-xapi-key" # Your sk- prefixed key
export QR_CODE_ID="qr_123_1234567890" # The ID returned from the creation API

curl -X GET "https://api.xabcstack.com/x-qrcode/${QR_CODE_ID}" \
  -H "Authorization: Bearer $XAPI_KEY"

Example 7: List all QR codes (using a private key)

Get a list of all active QR codes under your account.

export XAPI_KEY="your-xapi-key" # Your sk- prefixed key

curl -X GET https://api.xabcstack.com/x-qrcode \
  -H "Authorization: Bearer $XAPI_KEY"

Example 8: Delete a QR code (using a private key)

Delete a specific QR code.

export XAPI_KEY="your-xapi-key" # Your sk- prefixed key
export QR_CODE_ID="qr_123_1234567890" # The ID of the QR code to delete

curl -X DELETE "https://api.xabcstack.com/x-qrcode/${QR_CODE_ID}" \
  -H "Authorization: Bearer $XAPI_KEY"

Example 9: Upload a temporary file (using a private key)

Upload a report.pdf file, set it to expire in 7 days, with a maximum of 10 downloads.

export XAPI_KEY="your-xapi-key" # Your sk- prefixed key

curl -X POST https://api.xabcstack.com/x-file/upload \
  -H "Authorization: Bearer $XAPI_KEY" \
  -F "[email protected]" \
  -F "expiration=7d" \
  -F "download_limit=10"

Example 10: Check your file storage quota (using a private key)

Get the current storage usage status for your account.

export XAPI_KEY="your-xapi-key" # Your sk- prefixed key

curl -X GET https://api.xabcstack.com/x-file/quota \
  -H "Authorization: Bearer $XAPI_KEY"

Example 11: List your uploaded files (using a private key)

Get a paginated list of all files under your account.

export XAPI_KEY="your-xapi-key" # Your sk- prefixed key

curl -X GET "https://api.xabcstack.com/x-file/list?page=1&page_size=10" \
  -H "Authorization: Bearer $XAPI_KEY"

Example 12: Delete a file (using a private key)

Delete a file using the token returned after uploading.

export XAPI_KEY="your-xapi-key" # Your sk- prefixed key
export FILE_TOKEN="abc123..." # The token returned from the upload API

curl -X DELETE "https://api.xabcstack.com/x-file/delete?token=${FILE_TOKEN}" \
  -H "Authorization: Bearer $XAPI_KEY"

Use Case Scenarios

Scenario 1: QR Code for a Marketing Campaign

Create a QR code with an expiration date for an offline event, which will automatically become invalid after the campaign ends.

// Create a campaign QR code that expires in 7 days
const response = await fetch('https://api.xabcstack.com/x-qrcode', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${XAPI_KEY}`
  },
  body: JSON.stringify({
    url: 'https://yoursite.com/black-friday-2025',
    title: 'Black Friday Limited-Time Offer',
    size: 512,
    days: 7
  })
});

const data = await response.json();
// Use the Base64 image directly on the page
document.getElementById('qr-code').src = data.qrcode.image_data;

Scenario 2: QR Code for a Product Manual

Create a long-term QR code for a product to be printed on its packaging.

import requests
import json

# Create a QR code for a product manual with a 10-year validity
response = requests.post(
    'https://api.xabcstack.com/x-qrcode',
    headers={
        'Content-Type': 'application/json',
        'Authorization': f'Bearer {XAPI_KEY}'
    },
    data=json.dumps({
        'url': 'https://docs.yoursite.com/product/model-x',
        'title': 'Model X User Manual',
        'size': 256,
        'days': 3650  # 10 years
    })
)

qr_data = response.json()
print(f"QR Code ID: {qr_data['qrcode']['id']}")
# Save the Base64 image data for printing

Scenario 3: Dynamic Content Distribution

Combine the X-CARD and X-QRCODE services to create scannable dynamic content.

// First, create a promotional card
const cardResponse = await fetch('https://api.xabcstack.com/x-card', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${XAPI_KEY}`
  },
  body: JSON.stringify({
    title: '🎁 New Year Special Offer',
    content: '20% off all items, this week only!',
    link: 'https://yoursite.com/new-year-sale',
    priority: 100,
    days: 7
  })
});

// Then, generate a QR code for the card's link
const qrResponse = await fetch('https://api.xabcstack.com/x-qrcode', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${XAPI_KEY}`
  },
  body: JSON.stringify({
    url: 'https://yoursite.com/new-year-sale',
    title: 'New Year Special Offer QR Code',
    size: 512,
    days: 7
  })
});

// Now users can scan the QR code to go directly to the promotion page

Scenario 4: Generate and Share a Temporary Data Report

Generate a data report in your backend service, upload it to X-FILE, and get a time-sensitive sharing link.

import requests

# 1. Generate a report file locally
with open("monthly_report.csv", "w") as f:
    f.write("Date,Users,Revenue\n")
    f.write("2024-01-01,1500,3000\n")

# 2. Upload the file to X-FILE, set to expire in 24 hours with a 5-download limit
XAPI_KEY = "your-xapi-key" # Your sk- prefixed key
file_path = "monthly_report.csv"

with open(file_path, 'rb') as f:
    response = requests.post(
        'https://api.xabcstack.com/x-file/upload',
        headers={'Authorization': f'Bearer {XAPI_KEY}'},
        files={'file': (file_path, f, 'text/csv')},
        data={
            'expiration': '24h',
            'download_limit': '5'
        }
    )

# 3. Get the sharing link
if response.status_code == 200:
    result = response.json()
    print(f"Report uploaded successfully!")
    print(f"Shareable Link: {result['direct_link']}")
    print(f"Link will expire in {result['expires_in']}")
else:
    print(f"Upload failed: {response.text}")

# You can now send this link via email or messaging to relevant parties