API Reference
Backoffice APIs
Yuno

Yuno API Reference

The Yuno API provides endpoints for handling ticket scanning and loyalty points processing in the TKM AI Agency Platform. It manages the process of scanning tickets, identifying products, and awarding loyalty points based on purchases.

Base URL

/api/yuno

Endpoints

Process Ticket Scan

POST /loyalty/ticket-scan

Process a ticket scan request for loyalty points.

Request Body

{
  "user_id": "string",
  "brand_id": "string",
  "venue_id": "string",
  "image": "string"  // Base64 encoded image
}

Response

{
  "id": "string",           // Ticket scan ID
  "user_id": "string",
  "brand_id": "string",
  "venue_id": "string",
  "original_image_url": "string",
  "thumbnail_url": "string",
  "cloudinary_public_id": "string",
  "venue_match": {
    "venue_id": "string",
    "confidence": "number",
    "explanation": "string"
  },
  "products": [
    {
      "id": "string",
      "name": "string",
      "confidence": "number",
      "points": "number",
      "needs_validation": "boolean",
      "validation_status": "string",
      "validated_by": "string",
      "validated_at": "string"
    }
  ],
  "status": "string",
  "total_points": "number",
  "points_processed": "boolean",
  "points_processed_at": "string",
  "validation_required": "boolean",
  "validation_status": "string"
}

Get Ticket Scan Status

GET /loyalty/ticket-scan/{ticket_id}

Get the status of a processed ticket scan.

Parameters

NameTypeDescription
ticket_idstringThe unique identifier of the ticket scan

Response

{
  "id": "string",
  "user_id": "string",
  "brand_id": "string",
  "venue_id": "string",
  "status": "string",
  "confidence_score": "number",
  "products": [
    {
      "id": "string",
      "name": "string",
      "confidence": "number",
      "points": "number",
      "needs_validation": "boolean",
      "validation_status": "string",
      "validated_by": "string",
      "validated_at": "string"
    }
  ],
  "validation_required": "boolean",
  "validation_status": "string"
}

Validate Ticket Products

POST /loyalty/ticket-scan/{ticket_id}/validate

Validate products from a ticket scan that need manual validation.

Parameters

NameTypeDescription
ticket_idstringThe unique identifier of the ticket scan

Request Body

{
  "validations": [
    {
      "product_id": "string",
      "is_valid": "boolean",
      "notes": "string"
    }
  ]
}

Response

{
  "id": "string",
  "user_id": "string",
  "brand_id": "string",
  "venue_id": "string",
  "status": "string",
  "confidence_score": "number",
  "products": [
    {
      "id": "string",
      "name": "string",
      "confidence": "number",
      "points": "number",
      "needs_validation": "boolean",
      "validation_status": "string",
      "validated_by": "string",
      "validated_at": "string"
    }
  ],
  "validation_required": "boolean",
  "validation_status": "string"
}

Status Codes

The API uses the following status codes:

Status CodeDescription
200Success
400Bad Request - Invalid input parameters
404Not Found - Ticket not found
500Internal Server Error

Error Responses

All endpoints can return the following error response:

{
  "detail": "Error message description"
}

Common error scenarios:

  • Invalid ticket ID
  • Invalid validation request
  • Image processing error
  • Database connection error
  • Product identification error