> ## Documentation Index
> Fetch the complete documentation index at: https://docs.privetag.com/llms.txt
> Use this file to discover all available pages before exploring further.

# B2A API Overview

> Business-to-AI Agent API for travel recommendations and bookings

# B2A API Overview

The B2A (Business-to-AI Agent) API enables AI assistants to provide reliable travel recommendations and execute real-time bookings.

## Base URL

```
https://api.privetag.com
```

## Authentication

All endpoints require an API key in the `x-api-key` header:

```bash theme={null}
x-api-key: your-api-key-here
```

## Endpoints

| Endpoint                   | Method | Description                                |
| -------------------------- | ------ | ------------------------------------------ |
| `/api/b2a/recommend`       | POST   | Get context-aware activity recommendations |
| `/api/b2a/execute_booking` | POST   | Create a booking with automatic voucher    |
| `/api/b2a/inventory`       | GET    | Check real-time availability               |

## When to Use Each Endpoint

<CardGroup cols={3}>
  <Card title="Recommend" icon="wand-magic-sparkles">
    User asks:

    * "What should we do today?"
    * "Any family activities nearby?"
    * "It's raining, what's good?"
  </Card>

  <Card title="Execute Booking" icon="ticket">
    User says:

    * "Book this one"
    * "Reserve for tomorrow"
    * "I want to go there"
  </Card>

  <Card title="Inventory" icon="warehouse">
    User asks:

    * "Is this available?"
    * "Any deals today?"
    * "What's the price?"
  </Card>
</CardGroup>

## Request Flow

```mermaid theme={null}
sequenceDiagram
    participant User
    participant AI Agent
    participant PriveTag API
    participant Venue

    User->>AI Agent: "What can we do today?"
    AI Agent->>PriveTag API: POST /recommend
    PriveTag API-->>AI Agent: Recommendations + context_log_id
    AI Agent-->>User: "Here are some options..."

    User->>AI Agent: "Book the first one"
    AI Agent->>PriveTag API: POST /execute_booking
    PriveTag API->>User: Voucher Email
    PriveTag API-->>AI Agent: Confirmation

    User->>Venue: Shows voucher / QR scan
    Venue->>PriveTag API: Verify QR (Ground Truth)
```

## Response Format

All successful responses follow this structure:

```json theme={null}
{
  "success": true,
  "data": {
    // Response data
  }
}
```

Error responses:

```json theme={null}
{
  "success": false,
  "error": "Error message",
  "code": "ERROR_CODE",
  "details": "Additional information"
}
```

## Ground Truth Data

PriveTag's unique advantage is **Ground Truth** data:

<Info>
  When hotel guests actually visit activities and scan their NFC cards, we capture verified user behavior. This means our recommendations are based on real actions, not assumptions.
</Info>

The `context_log_id` returned from `/recommend` connects:

1. User profile + environment context
2. Which activities were recommended
3. Which activity was selected
4. Whether the user actually visited (QR verification)

This creates a feedback loop that improves recommendations over time.

## Key Features

### Context-Aware Recommendations

* **Weather Integration**: Automatically recommends indoor activities on rainy days
* **Time Awareness**: Dinner spots in the evening, morning activities early
* **User Profile Matching**: Family vs couple vs solo traveler optimization

### Real-Time Booking

* **99% Success Rate**: Live inventory sync
* **Instant Vouchers**: Email delivered within 30 seconds
* **Webhook Callbacks**: Get notified when booking completes

### Flash Deals

* **Same-Day Discounts**: 30-50% off for last-minute availability
* **AI-Exclusive Rates**: Special pricing for AI agent bookings

## SDK & Tools

<CardGroup cols={2}>
  <Card title="MCP Server" icon="plug" href="/b2a-platform/mcp-integration">
    Native integration for Claude Desktop

    ```bash theme={null}
    npx privetag-mcp start
    ```
  </Card>

  <Card title="LangChain Tool" icon="link" href="/b2a-platform/langchain">
    Ready-to-use LangChain tool

    ```bash theme={null}
    npm install @privetag/langchain
    ```
  </Card>
</CardGroup>

## Next Steps

<Card title="Try the API" icon="play" href="/api-reference/b2a/recommend">
  Make your first recommendation request
</Card>
