API Documentation

Documentazione
Completa API

Tutto quello che devi sapere per integrare AI-Local Sync nel tuo business.

🚀 Quick Start

1️⃣

Registrati

Crea un account e ottieni la tua API Key dalla dashboard.

2️⃣

Configura

Inserisci i dati della tua attività tramite dashboard o API.

3️⃣

Integra

Aggiungi lo script al tuo sito e sei pronto!

Integrazione base (1 riga di codice):

<!-- Aggiungi questo nel <head> del tuo sito -->
<script src="https://ai-local-sync.gianlucasolution.com/v1/YOUR-SLUG/inject.js" defer></script>

📡 Endpoint Pubblici

Questi endpoint non richiedono autenticazione e sono ottimizzati per i crawler AI.

GET /v1/:slug/llms.txt

PUBLIC

Restituisce il file markdown ottimizzato per AI agents (ChatGPT, Claude, Gemini).

Request:

curl https://ai-local-sync.gianlucasolution.com/v1/demo-business/llms.txt

Response (text/plain):

# Triple Vision Lab

## About
AI & Web Development Agency specializing in cutting-edge solutions.

## Contact
- Phone: +39 123 456 7890
- Email: info@triplevision.com
- Address: Via Roma 1, Milano, 20100, IT

## Services
1. Web Development - €1000-5000
2. AI Integration - €2000-10000

## Opening Hours
Monday-Friday: 09:00-18:00
Closed: Saturday, Sunday

GET /v1/:slug/schema.json

PUBLIC

Restituisce il markup JSON-LD Schema.org LocalBusiness per SEO e Google Rich Snippets.

Request:

curl https://ai-local-sync.gianlucasolution.com/v1/demo-business/schema.json

Response (application/ld+json):

{
  "@context": "https://schema.org",
  "@type": "LocalBusiness",
  "name": "Triple Vision Lab",
  "description": "AI & Web Development Agency",
  "telephone": "+39 123 456 7890",
  "email": "info@triplevision.com",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "Via Roma 1",
    "addressLocality": "Milano",
    "postalCode": "20100",
    "addressCountry": "IT"
  },
  "openingHoursSpecification": [
    {
      "@type": "OpeningHoursSpecification",
      "dayOfWeek": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
      "opens": "09:00",
      "closes": "18:00"
    }
  ]
}

GET /v1/:slug/inject.js

PUBLIC

Script JavaScript che inietta automaticamente il JSON-LD schema nel tuo sito.

Utilizzo:

<script src="https://ai-local-sync.gianlucasolution.com/v1/YOUR-SLUG/inject.js" defer></script>

🔐 Endpoint Privati (Autenticazione Richiesta)

Tutti gli endpoint privati richiedono l'header X-API-Key con la tua API Key.

🔑 Autenticazione

Includi la tua API Key in ogni richiesta agli endpoint privati:

curl -X GET "https://ai-local-sync.gianlucasolution.com/api/v1/business" \
  -H "X-API-Key: your-api-key-here"

Business Management

GET /api/v1/business

Recupera i dati del tuo business.

// Response
{
  "id": 1,
  "client_id": 1,
  "name": "Triple Vision Lab",
  "slug": "triple-vision",
  "description": "AI & Web Development Agency",
  "phone": "+39 123 456 7890",
  "email": "info@triplevision.com",
  "website": "https://triplevision.com",
  "address": {
    "street": "Via Roma 1",
    "city": "Milano",
    "postal_code": "20100",
    "country": "IT"
  }
}
POST /api/v1/business

Aggiorna i dati del tuo business.

// Request Body
{
  "name": "Triple Vision Lab",
  "description": "AI & Web Development Agency",
  "phone": "+39 123 456 7890",
  "email": "info@triplevision.com",
  "website": "https://triplevision.com",
  "street": "Via Roma 1",
  "city": "Milano",
  "postal_code": "20100",
  "country": "IT"
}

Services Management

POST /api/v1/services

Sincronizza bulk dei servizi (sostituisce tutti).

// Request Body
{
  "services": [
    {
      "name": "Web Development",
      "description": "Custom web applications",
      "price_min": 1000,
      "price_max": 5000,
      "currency": "EUR",
      "sort_order": 1
    },
    {
      "name": "AI Integration",
      "description": "AI-powered solutions",
      "price_min": 2000,
      "price_max": 10000,
      "currency": "EUR",
      "sort_order": 2
    }
  ]
}

Analytics

GET /api/v1/analytics?days=30

Statistiche sui bot che hanno accesso ai tuoi dati.

// Response
{
  "total_hits": 1234,
  "by_bot_type": {
    "ChatGPT": 456,
    "Claude": 321,
    "Googlebot": 234,
    "Other": 223
  },
  "daily_breakdown": [
    {
      "date": "2024-12-10",
      "hits": 42,
      "unique_ips": 15
    }
  ]
}

⚠️ Codici di Errore

Errori Client (4xx)

  • 400 Bad Request - Dati di input non validi
  • 401 Unauthorized - API Key mancante o non valida
  • 404 Not Found - Risorsa non trovata
  • 429 Too Many Requests - Rate limit superato

Errori Server (5xx)

  • 500 Internal Server Error - Errore del server
  • 503 Service Unavailable - Servizio temporaneamente non disponibile

Esempio risposta errore:

{
  "error": "Unauthorized",
  "message": "Invalid API Key"
}

Hai bisogno di aiuto?

Il nostro team è qui per supportarti.