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

# API Quickstart

> Get started with the VChata API in minutes

# VChata API Quickstart

This guide will help you make your first API call to VChata and create your first AI-powered social media campaign.

## Prerequisites

Before you begin, you'll need:

* A VChata account ([Sign up here](https://app.vchata.com/login))
* Your API credentials
* Basic knowledge of HTTP requests and JSON

## Step 1: Get Your API Credentials

1. **Sign up for VChata** at [app.vchata.com](https://app.vchata.com/login)
2. **Create an organization** and complete the onboarding process
3. **Navigate to Settings > API Keys** in your dashboard
4. **Generate a new API key** and copy it securely

<Warning>
  Keep your API key secure and never expose it in client-side code or public repositories.
</Warning>

## Step 2: Make Your First API Call

Let's start by getting information about your organization:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.vchata.com/organizations" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.vchata.com/organizations', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    }
  });

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

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

  headers = {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
  }

  response = requests.get('https://api.vchata.com/organizations', headers=headers)
  organizations = response.json()
  print(organizations)
  ```
</CodeGroup>

## Step 3: Connect a Social Media Account

Connect a Facebook or Instagram account to start automating:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.vchata.com/social/connect" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "platform": "FACEBOOK",
      "accessToken": "YOUR_FACEBOOK_ACCESS_TOKEN",
      "platformUserId": "YOUR_FACEBOOK_USER_ID",
      "platformUserName": "Your Page Name"
    }'
  ```

  ```javascript JavaScript theme={null}
  const socialAccount = await fetch('https://api.vchata.com/social/connect', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      platform: 'FACEBOOK',
      accessToken: 'YOUR_FACEBOOK_ACCESS_TOKEN',
      platformUserId: 'YOUR_FACEBOOK_USER_ID',
      platformUserName: 'Your Page Name'
    })
  });

  const result = await socialAccount.json();
  console.log('Connected account:', result);
  ```
</CodeGroup>

## Step 4: Create Your First AI Agent

Now let's create an AI agent that can automatically respond to comments and messages:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.vchata.com/ai/agents/org_abc123" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Customer Support Bot",
      "description": "AI agent for handling customer inquiries",
      "channels": ["DIRECT_MESSAGE", "COMMENT"],
      "autoResponse": true,
      "responseDelay": 30,
      "promptTemplateId": "template_123"
    }'
  ```

  ```javascript JavaScript theme={null}
  const aiAgent = await fetch('https://api.vchata.com/ai/agents/org_abc123', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Customer Support Bot',
      description: 'AI agent for handling customer inquiries',
      channels: ['DIRECT_MESSAGE', 'COMMENT'],
      autoResponse: true,
      responseDelay: 30,
      promptTemplateId: 'template_123'
    })
  });

  const agent = await aiAgent.json();
  console.log('Created AI agent:', agent);
  ```
</CodeGroup>

## Step 5: Create a Campaign

Set up your first automated campaign:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.vchata.com/campaigns/org_abc123" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Summer Sale Campaign",
      "description": "Automated responses for summer sale inquiries",
      "pipelineId": "pipeline_123",
      "platform": "FACEBOOK",
      "socialAccountIds": ["social_123"],
      "keywords": [
        {
          "keyword": "summer sale",
          "matchType": "CONTAINS",
          "priority": 1
        }
      ]
    }'
  ```

  ```javascript JavaScript theme={null}
  const campaign = await fetch('https://api.vchata.com/campaigns/org_abc123', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Summer Sale Campaign',
      description: 'Automated responses for summer sale inquiries',
      pipelineId: 'pipeline_123',
      platform: 'FACEBOOK',
      socialAccountIds: ['social_123'],
      keywords: [
        {
          keyword: 'summer sale',
          matchType: 'CONTAINS',
          priority: 1
        }
      ]
    })
  });

  const result = await campaign.json();
  console.log('Created campaign:', result);
  ```
</CodeGroup>

## Next Steps

Congratulations! You've successfully:

✅ Made your first API call\
✅ Connected a social media account\
✅ Created an AI agent\
✅ Set up an automated campaign

<CardGroup cols={2}>
  <Card title="Explore the API Reference" icon="terminal" href="/api-reference/introduction">
    Dive deeper into all available endpoints and features.
  </Card>

  <Card title="Set up Webhooks" icon="webhook" href="/webhooks-setup">
    Learn how to receive real-time notifications about social media events.
  </Card>

  <Card title="JavaScript SDK" icon="code" href="/javascript-sdk">
    Use our official SDK for easier integration.
  </Card>

  <Card title="Authentication Guide" icon="shield" href="/authentication">
    Learn about JWT tokens, rate limits, and security best practices.
  </Card>
</CardGroup>

## Need Help?

* **Documentation**: Browse our [complete API reference](/api-reference/introduction)
* **Support**: Email us at [support@vchata.com](mailto:support@vchata.com)
* **Community**: Join our [Discord server](https://discord.gg/vchata)
* **Status**: Check our [status page](https://status.vchata.com)
