> ## 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.

# Quickstart

> Get started with PriveTag B2A API in 5 minutes

# Quickstart Guide

This guide will help you make your first API call to PriveTag B2A Platform.

## Step 1: Get Your API Key

<Steps>
  <Step title="Create an Account">
    Sign up at [privetag.com/developers](https://privetag.com/developers)
  </Step>

  <Step title="Generate API Key">
    Navigate to API Keys section and click "Create New Key"
  </Step>

  <Step title="Configure Permissions">
    Select the endpoints you need access to:

    * `recommend` - Activity recommendations
    * `execute_booking` - Booking execution
    * `inventory` - Availability check
  </Step>
</Steps>

## Step 2: Make Your First Request

### Get Recommendations

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.privetag.com/api/b2a/recommend \
    -H "x-api-key: your-api-key-here" \
    -H "Content-Type: application/json" \
    -d '{
      "user_profile": {
        "travel_type": "couple",
        "interests": ["spa", "dinner"]
      },
      "location": {
        "city": "Phuket"
      },
      "limit": 5
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.privetag.com/api/b2a/recommend",
      headers={
          "x-api-key": "your-api-key-here",
          "Content-Type": "application/json"
      },
      json={
          "user_profile": {
              "travel_type": "couple",
              "interests": ["spa", "dinner"]
          },
          "location": {
              "city": "Phuket"
          },
          "limit": 5
      }
  )

  recommendations = response.json()
  print(recommendations)
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.privetag.com/api/b2a/recommend', {
    method: 'POST',
    headers: {
      'x-api-key': 'your-api-key-here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      user_profile: {
        travel_type: 'couple',
        interests: ['spa', 'dinner']
      },
      location: {
        city: 'Phuket'
      },
      limit: 5
    })
  });

  const recommendations = await response.json();
  console.log(recommendations);
  ```

  ```typescript TypeScript (LangChain) theme={null}
  import { StructuredTool } from "@langchain/core/tools";
  import { z } from "zod";

  class PriveTagRecommendTool extends StructuredTool {
    name = "privetag_recommend";
    description = "Get activity recommendations for travelers in Southeast Asia";

    schema = z.object({
      travel_type: z.enum(["family", "couple", "solo", "business", "friends"]),
      city: z.string(),
      interests: z.array(z.string()).optional()
    });

    async _call({ travel_type, city, interests }) {
      const response = await fetch('https://api.privetag.com/api/b2a/recommend', {
        method: 'POST',
        headers: {
          'x-api-key': process.env.PRIVETAG_API_KEY,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          user_profile: { travel_type, interests },
          location: { city }
        })
      });
      return await response.json();
    }
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "success": true,
  "data": {
    "recommendations": [
      {
        "id": "act_abc123",
        "title": "Sunset Spa Experience",
        "description": "Luxurious couples spa with ocean view",
        "category": "spa",
        "price": 3500,
        "currency": "THB",
        "relevance_score": 95,
        "recommendation_reason": "Perfect for couples - romantic spa experience"
      }
    ],
    "context": {
      "log_id": "ctx_xyz789",
      "user_profile_summary": "couple, spa & dinner interests",
      "environment_summary": "Phuket, sunny, 30°C"
    }
  }
}
```

## Step 3: Execute a Booking

Once the user selects an activity, execute the booking:

```bash theme={null}
curl -X POST https://api.privetag.com/api/b2a/execute_booking \
  -H "x-api-key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "activity_id": "act_abc123",
    "user_email": "guest@example.com",
    "user_name": "John Doe",
    "booking_date": "2025-12-15",
    "num_adults": 2,
    "context_log_id": "ctx_xyz789"
  }'
```

The user will receive a voucher email within 30 seconds!

## Rate Limits

| Plan       | Requests/Minute | Daily Quota |
| ---------- | --------------- | ----------- |
| Free       | 10              | 100         |
| Basic      | 60              | 1,000       |
| Premium    | 300             | 10,000      |
| Enterprise | Unlimited       | Unlimited   |

## Common Use Cases

<AccordionGroup>
  <Accordion title="Rainy Day Activities">
    When it's raining, recommend indoor activities:

    ```json theme={null}
    {
      "location": { "lat": 13.7563, "lon": 100.5018 },
      "filters": { "is_indoor": true }
    }
    ```

    The API automatically fetches weather data when lat/lon is provided.
  </Accordion>

  <Accordion title="Family with Children">
    Family-friendly recommendations:

    ```json theme={null}
    {
      "user_profile": {
        "travel_type": "family",
        "interests": ["theme-park", "zoo", "aquarium"]
      },
      "filters": { "difficulty": "easy" }
    }
    ```
  </Accordion>

  <Accordion title="Last-Minute Flash Deals">
    Find discounted activities:

    ```bash theme={null}
    GET /api/b2a/inventory?flash_deals_only=true&city=Bangkok
    ```
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/api-reference/b2a/overview">
    Complete endpoint documentation
  </Card>

  <Card title="MCP Integration" icon="plug" href="/b2a-platform/mcp-integration">
    Set up native Claude integration
  </Card>
</CardGroup>
