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

# Quickstart

> Get up and running with Buena.ai API v2 in under 5 minutes

Get started with the Buena.ai API v2 in just a few steps. This guide will walk you through making your first API call and setting up LinkedIn automation.

## Step 1: Get Your API Key

First, you'll need to create an API key. You can either:

1. **Dashboard Method**: Create one through your [Buena.ai dashboard](https://app.buena.ai)
2. **API Method**: Use an existing key to create a new one via API

<Tip>
  If you don't have an existing API key, contact
  [support@buena.ai](mailto:support@buena.ai) to enable API access for your
  account.
</Tip>

### Create API Key via API

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.buena.ai/api/v2/keys" \
    -H "x-api-key: YOUR_EXISTING_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "My First Integration",
      "permissions": ["linkedin:schedule", "linkedin:upload", "leads:read", "leads:write"],
      "expiresInDays": 365
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.buena.ai/api/v2/keys", {
    method: "POST",
    headers: {
      "x-api-key": "YOUR_EXISTING_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      name: "My First Integration",
      permissions: [
        "linkedin:schedule",
        "linkedin:upload",
        "leads:read",
        "leads:write",
      ],
      expiresInDays: 365,
    }),
  });

  const data = await response.json();
  console.log(data.data.key); // Your new API key
  ```

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

  response = requests.post(
      'https://api.buena.ai/api/v2/keys',
      headers={
          'x-api-key': 'YOUR_EXISTING_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'name': 'My First Integration',
          'permissions': ['linkedin:schedule', 'linkedin:upload', 'leads:read', 'leads:write'],
          'expiresInDays': 365
      }
  )

  data = response.json()
  print(data['data']['key'])  # Your new API key
  ```
</CodeGroup>

<Warning>
  Store your API key securely! It won't be shown again after creation.
</Warning>

## Step 2: Test Your Connection

Let's verify your API key works with a health check:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.buena.ai/api/v2/health" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.buena.ai/api/v2/health", {
    headers: {
      "x-api-key": "YOUR_API_KEY",
    },
  });

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

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

  response = requests.get(
      'https://api.buena.ai/api/v2/health',
      headers={'x-api-key': 'YOUR_API_KEY'}
  )

  print(response.json())
  ```
</CodeGroup>

### Expected Response

```json theme={null}
{
  "version": "2.0",
  "status": "healthy",
  "authentication": "user",
  "user": {
    "id": "user_abc123",
    "email": "john@company.com",
    "role": "Premium"
  },
  "apiKey": {
    "name": "My First Integration",
    "permissions": [
      "linkedin:schedule",
      "linkedin:upload",
      "leads:read",
      "leads:write"
    ],
    "usageCount": 1
  },
  "timestamp": "2024-01-20T15:30:00Z"
}
```

## Step 3: Schedule Your First LinkedIn Action

Now let's schedule a LinkedIn connection request using the simplified API:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction" \
    -H "x-api-key: bna_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
    -H "Content-Type: application/json" \
    -d '{
      "actionType": "sendConnectionRequest",
      "profileUrl": "https://linkedin.com/in/johndoe",
      "message": "Hi John, I'd love to connect and discuss opportunities!"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction",
    {
      method: "POST",
      headers: {
        "x-api-key":
          "bna_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        actionType: "sendConnectionRequest",
        profileUrl: "https://linkedin.com/in/johndoe",
        message: "Hi John, I'd love to connect and discuss opportunities!",
      }),
    }
  );

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

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

  response = requests.post(
      'https://api.buena.ai/api/v2/linkedin/scheduleLinkedInAction',
      headers={
          'x-api-key': 'bna_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
          'Content-Type': 'application/json'
      },
      json={
          'actionType': 'sendConnectionRequest',
          'profileUrl': 'https://linkedin.com/in/johndoe',
          'message': "Hi John, I'd love to connect and discuss opportunities!"
      }
  )

  print(response.json())
  ```
</CodeGroup>

<Note>
  **Notice the simplification!** With user-specific API keys (format:
  `bna_hexstring`), you no longer need to specify `linkedInIntegration`
  settings. The API automatically detects your LinkedIn account details and
  timezone from the API key.
</Note>

### Expected Response

```json theme={null}
{
  "success": true,
  "message": "sendConnectionRequest action scheduled successfully with delay of 75000 ms."
}
```

## Step 4: Create Your First Lead

Let's add a lead to your database:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.buena.ai/api/v2/leads" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "firstName": "John",
      "lastName": "Doe",
      "email": "john@example.com",
      "linkedinUrl": "https://linkedin.com/in/johndoe",
      "company": "Tech Corp",
      "title": "Software Engineer",
      "source": "linkedin",
      "notes": "Interested in automation solutions"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.buena.ai/api/v2/leads", {
    method: "POST",
    headers: {
      "x-api-key": "YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      firstName: "John",
      lastName: "Doe",
      email: "john@example.com",
      linkedinUrl: "https://linkedin.com/in/johndoe",
      company: "Tech Corp",
      title: "Software Engineer",
      source: "linkedin",
      notes: "Interested in automation solutions",
    }),
  });

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

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

  response = requests.post(
      'https://api.buena.ai/api/v2/leads',
      headers={
          'x-api-key': 'YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'firstName': 'John',
          'lastName': 'Doe',
          'email': 'john@example.com',
          'linkedinUrl': 'https://linkedin.com/in/johndoe',
          'company': 'Tech Corp',
          'title': 'Software Engineer',
          'source': 'linkedin',
          'notes': 'Interested in automation solutions'
      }
  )

  print(response.json())
  ```
</CodeGroup>

## Step 5: Retrieve Your Leads

Now let's fetch your leads:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.buena.ai/api/v2/leads?limit=10" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.buena.ai/api/v2/leads?limit=10", {
    headers: {
      "x-api-key": "YOUR_API_KEY",
    },
  });

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

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

  response = requests.get(
      'https://api.buena.ai/api/v2/leads?limit=10',
      headers={'x-api-key': 'YOUR_API_KEY'}
  )

  print(response.json())
  ```
</CodeGroup>

## Next Steps

Congratulations! You've successfully:

* ✅ Created an API key
* ✅ Made your first API call
* ✅ Scheduled a LinkedIn action
* ✅ Created and retrieved leads

### What's Next?

<CardGroup cols={2}>
  <Card title="LinkedIn Automation Guide" icon="linkedin" href="/guides/linkedin-automation">
    Learn advanced LinkedIn automation techniques
  </Card>

  <Card title="Lead Management" icon="users" href="/guides/lead-management">
    Master lead organization and enrichment
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    Explore all available endpoints
  </Card>

  <Card title="Best Practices" icon="lightbulb" href="/guides/best-practices">
    Learn optimization tips and tricks
  </Card>
</CardGroup>

### Rate Limits

Keep these limits in mind as you scale:

* **60** requests per minute
* **1,000** requests per hour
* **10,000** requests per day

Rate limit headers are included in all responses to help you monitor usage.

### Need Help?

* Join our [Discord community](https://discord.gg/Hb4Y9Rgh6E)
* Email [support@buena.ai](mailto:support@buena.ai)
* Check our [status page](https://status.buena.ai)
