v1.0.0 · REST API

BletzAI API Documentation

Integrate BletzAI's intelligence into your applications. Powered by Cloudflare Workers.

Introduccion

BletzAI API provides programmatic access to our AI models: BletzAssist (conversational AI), BletzMind (predictive analytics), and BletzFlow (process automation).

All API requests should be made to https://bletzai.pages.dev/api/v1/*. Responses are returned in JSON format.

Base URL: https://bletzai.pages.dev/api/v1

Quick Start

# 1. Get your API key
curl -X POST https://bletzai.pages.dev/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"name": "Tu Nombre", "email": "tu@email.com"}'

# 2. Use the API
curl -X POST https://bletzai.pages.dev/api/v1/chat \
  -H "Authorization: Bearer tu_api_key" \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello, how can you help my business?"}'

Autenticacion

All API endpoints (except /api/v1/status) require authentication via a Bearer token in the Authorization header.

POST /api/auth/register Generate a free API key

Register to receive a 48-character API key. Each email can generate one key.

Request Body

{
  "name": "string (required)",
  "email": "string (required, valid email)"
}

Response

{
  "success": true,
  "data": {
    "apiKey": "bltz_a1b2c3d4e5f6...",
    "name": "Tu Nombre",
    "email": "tu@email.com",
    "tier": "starter",
    "tierLimits": {
      "requestsPerDay": 1000,
      "endpoints": ["/api/v1/*"]
    },
    "created": "2026-06-06T10:00:00.000Z",
    "docs": "/docs"
  }
}

Include your API key in all requests:

Authorization: Bearer bltz_a1b2c3d4e5f6g7h8i9j0...

Error Responses

All errors follow a consistent format:

{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable description"
  },
  "timestamp": "2026-06-06T10:00:00.000Z"
}
StatusCodeDescription
400VALIDATION_ERRORInvalid or missing parameters
401UNAUTHORIZEDMissing or malformed Authorization header
401INVALID_API_KEYAPI key not found or invalid format
403KEY_REVOKEDAPI key has been deactivated
409EMAIL_EXISTSEmail already registered (register)
415UNSUPPORTED_MEDIA_TYPEContent-Type must be application/json
429RATE_LIMITDaily request limit exceeded

Chat — BletzAssist

Conversational AI assistant for customer service, sales, and support automation. Understands context and generates natural responses.

POST /api/v1/chat Send a message to the AI assistant

Request Body

FieldTypeDescription
messagestringrequiredThe user message
contextobjectoptionalConversation history or context
modelstringoptionalModel ID (default: bletzassist-v1)

Example Request

curl -X POST https://bletzai.pages.dev/api/v1/chat \
  -H "Authorization: Bearer bltz_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"message": "How can I improve my customer support?"}'

Example Response

{
  "success": true,
  "data": {
    "reply": "I can help you qualify leads...",
    "model": "bletzassist-v1",
    "confidence": 0.972,
    "tokens": 42,
    "processingTime": "0.23s"
  }
}

Analizar — BletzMind

Predictive analytics engine for market analysis, sentiment analysis, forecasting, and risk assessment.

POST /api/v1/analyze Run predictive analysis on your data

Request Body

FieldTypeDescription
dataobjectrequiredYour input data
typestringrequiredAnalysis type: market, sentiment, forecast, risk, custom

Example Request

curl -X POST https://bletzai.pages.dev/api/v1/analyze \
  -H "Authorization: Bearer bltz_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"data": {"revenue": [1200, 1450, 1600]}, "type": "forecast"}'

Example Response

{
  "success": true,
  "data": {
    "type": "forecast",
    "analysis": {
      "summary": "Revenue trajectory shows consistent upward trend...",
      "metrics": {
        "nextQuarter": "22.3%",
        "nextYear": "55.7%",
        "confidenceInterval": "±4.2%",
        "recommendation": "Expand capacity to meet projected demand"
      }
    },
    "confidence": 0.943,
    "model": "bletzmind-v2",
    "processingTime": "1.23s"
  }
}

Automatizar — BletzFlow

Process automation engine that executes multi-step workflows including lead capture, invoice processing, customer onboarding, and more.

POST /api/v1/automate Execute an automation workflow

Request Body

FieldTypeDescription
workflowstringrequiredWorkflow ID: lead_capture, invoice_processing, customer_onboarding, inventory_sync, report_generation
paramsobjectoptionalWorkflow-specific parameters

Example Request

curl -X POST https://bletzai.pages.dev/api/v1/automate \
  -H "Authorization: Bearer bltz_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"workflow": "lead_capture"}'

Example Response

{
  "success": true,
  "data": {
    "workflow": "Lead Capture & Qualification",
    "status": "completed",
    "executionId": "flw_1752000000_a1b2c3",
    "steps": [...],
    "totalDuration": "1.2s",
    "recordsProcessed": 247,
    "errors": 0,
    "model": "bletzflow-v1"
  }
}

Estado

Public endpoint to check API health and available models. No authentication required.

GET /api/v1/status Check API status and available models

Example Request

curl https://bletzai.pages.dev/api/v1/status

Example Response

{
  "success": true,
  "data": {
    "api": "BletzAI API",
    "version": "v1.0.0",
    "status": "operational",
    "uptime": "99.97%",
    "models": [
      { "id": "bletzassist-v1", "type": "conversational", "status": "online" },
      { "id": "bletzmind-v2", "type": "analytics", "status": "online" },
      { "id": "bletzflow-v1", "type": "automation", "status": "online" }
    ],
    "registeredClients": 42,
    "docs": "/docs"
  }
}

Limites

TierRequests/DayEndpoints
Starter1,000All /api/v1/*
Premium10,000All endpoints + priority

Rate limits reset daily at 00:00 UTC. Contact hola@bletzai.com to upgrade.

SDKs & Ejemplos

JavaScript

const API_KEY = 'bltz_your_key_here';

async function chatBletz(message) {
  const res = await fetch('https://bletzai.pages.dev/api/v1/chat', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ message })
  });
  return res.json();
}

Python

import requests

API_KEY = "bltz_your_key_here"

def chat(message):
    res = requests.post(
        "https://bletzai.pages.dev/api/v1/chat",
        headers={"Authorization": f"Bearer {API_KEY}"},
        json={"message": message}
    )
    return res.json()

cURL

curl -X POST https://bletzai.pages.dev/api/v1/chat \
  -H "Authorization: Bearer bltz_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello"}'