Skip to content

Caracol Consumer API

Caracol exposes a Consumer API for integration with Cookie Monster portal.

Base URL: https://caracol.redbroomsoftware.com


Overview

The Consumer API allows Cookie Monster to:

  • Link consumers by phone/email across tenants
  • Fetch portal branding configuration
  • Display product catalogs
  • Show order history
  • Process invoice requests

Authentication

All requests must include:

http
X-API-Key: <COOKIE_MONSTER_API_KEY>
X-Source-App: cookie-monster
Content-Type: application/json

The API key is verified against the COOKIE_MONSTER_API_KEY environment variable.


Consumer Linking

Find by Phone

Find consumer accounts linked to a phone number across all portal-enabled tenants.

http
GET /api/consumer/link/by-phone?phone={phone}

Query Parameters:

ParameterTypeRequiredDescription
phonestringYesPhone number (any format)

Phone Normalization:

  • 55123456785512345678 (10 digits)
  • +52 55 1234 56785512345678 (strips country code)
  • 521 55 1234 56785512345678 (strips mobile prefix)

Response:

json
{
  "matches": [
    {
      "tenantId": "tenant-abc123",
      "tenantName": "Tacos El Rey",
      "thirdPartyId": "tp-xyz789"
    }
  ]
}

Find by Email

http
GET /api/consumer/link/by-email?email={email}

Same response format as phone lookup.


Portal Branding

Get Branding

Fetch portal configuration for a tenant.

http
GET /api/consumer/tenants/{tenantId}/branding

Response:

json
{
  "tenantId": "tenant-abc123",
  "name": "Tacos El Rey",
  "slug": "tacos-el-rey",
  "branding": {
    "logoUrl": "https://storage.../logo.png",
    "brandColor": "#7C3AED",
    "welcomeMessage": "Bienvenido a nuestro portal",
    "tagline": "Los mejores tacos de la ciudad"
  },
  "contact": {
    "phone": "+52 55 1234 5678",
    "email": "contacto@tacoselrey.com",
    "whatsapp": "+52 55 1234 5678"
  },
  "features": {
    "showCatalog": true,
    "allowInvoiceRequests": true,
    "showOrderHistory": true
  }
}

Product Catalog

List Products

Get active products for a tenant.

http
GET /api/consumer/tenants/{tenantId}/catalog

Query Parameters:

ParameterTypeDefaultDescription
categorystring-Filter by category ID
limitnumber50Max products to return

Response:

json
{
  "products": [
    {
      "id": "prod-123",
      "name": "Taco al Pastor",
      "description": "Delicioso taco con piña",
      "price": 25.00,
      "imageUrl": "https://storage.../taco.jpg",
      "category": "Tacos",
      "isActive": true
    }
  ],
  "total": 42
}

Get Single Product

http
GET /api/consumer/tenants/{tenantId}/catalog/{productId}

Order History

List Orders

Get order history for a consumer.

http
GET /api/consumer/tenants/{tenantId}/consumers/{consumerId}/orders

Query Parameters:

ParameterTypeDefaultDescription
limitnumber50Max orders to return

Response:

json
{
  "orders": [
    {
      "id": "sale-abc123",
      "dailySaleNumber": 42,
      "date": "2026-01-28T14:30:00Z",
      "total": 350.00,
      "items": [
        {
          "name": "Taco al Pastor",
          "quantity": 5,
          "unitPrice": 25.00,
          "total": 125.00
        }
      ],
      "paymentMethod": "card",
      "hasInvoice": false,
      "invoiceRequested": false
    }
  ]
}

Invoice History

List Invoices

Get invoices for a consumer.

http
GET /api/consumer/tenants/{tenantId}/consumers/{consumerId}/invoices

Response:

json
{
  "invoices": [
    {
      "id": "cfdi-xyz789",
      "uuid": "ABC12345-ABCD-1234-ABCD-123456789ABC",
      "folio": "A-1234",
      "date": "2026-01-28T15:00:00Z",
      "total": 350.00,
      "pdfUrl": "https://constanza.../invoice.pdf",
      "xmlUrl": "https://constanza.../invoice.xml"
    }
  ]
}

Invoice Requests

Create Invoice Request

Request an invoice for a past order.

http
POST /api/consumer/tenants/{tenantId}/invoice-requests

Request Body:

json
{
  "orderId": "sale-abc123",
  "billingData": {
    "rfc": "XAXX010101000",
    "razonSocial": "PUBLICO EN GENERAL",
    "email": "cliente@example.com",
    "usoCfdi": "G03",
    "regimenFiscal": "616",
    "codigoPostal": "06600"
  }
}

Required Fields:

FieldDescription
rfcTax ID (RFC)
razonSocialLegal name
emailEmail for invoice delivery
usoCfdiCFDI usage code
regimenFiscalTax regime code
codigoPostalPostal code

Response:

json
{
  "success": true,
  "requestId": "req-abc123"
}

Error Cases:

  • 400 - Order already has invoice
  • 400 - Missing required billing fields
  • 404 - Order not found or doesn't belong to tenant

Error Handling

All errors follow the standard format:

json
{
  "error": "Error message",
  "success": false
}

Error Codes

HTTP StatusErrorDescription
401UnauthorizedInvalid API key or X-Source-App
400Phone number requiredMissing phone parameter
400Datos incompletosMissing orderId or billingData
400Esta orden ya tiene facturaOrder already invoiced
404Orden no encontradaOrder doesn't exist or wrong tenant
500Internal server errorDatabase or server error

Red Broom Software Ecosystem