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

# Quickstart

> Get started with the Human Intelligence API in under 5 minutes

## Get Your API Key

Contact our team to get your API key and start building with myweave.

<Card title="Request API Access" icon="envelope" href="mailto:support@myweave.ai?subject=API%20Key%20Request">
  Email [support@myweave.ai](mailto:support@myweave.ai) to request your API key
</Card>

## Make Your First API Call

Here's a simple example starting a conversation with a persona:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.myweave.ai/functions/v1/chat \
    -H "Content-Type: application/json" \
    -H "X-API-Key: your_api_key_here" \
    -d '{
      "message": "Hello, I need help with leadership development",
      "context": {
        "coachId": "coach_xyz789"
      }
    }' \
    --no-buffer
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.myweave.ai/functions/v1/chat', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': 'your_api_key_here'
    },
    body: JSON.stringify({
      message: "Hello, I need help with leadership development",
      context: {
        coachId: "coach_xyz789"
      }
    })
  });

  // Get thread ID for future messages
  const threadId = response.headers.get('X-Thread-Id');

  // Stream the response
  const reader = response.body?.getReader();
  const decoder = new TextDecoder();

  while (true) {
    const { done, value } = await reader.read();
    if (done) break;
    
    const chunk = decoder.decode(value);
    console.log(chunk);
  }
  ```

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

  url = "https://api.myweave.ai/functions/v1/chat"
  headers = {
      "Content-Type": "application/json",
      "X-API-Key": "your_api_key_here"
  }
  payload = {
      "message": "Hello, I need help with leadership development",
      "context": {
          "coachId": "coach_xyz789"
      }
  }

  response = requests.post(url, headers=headers, json=payload, stream=True)

  # Get thread ID for future messages
  thread_id = response.headers.get('X-Thread-Id')

  # Stream the response
  for line in response.iter_lines():
      if line:
          print(line.decode('utf-8'))
  ```
</CodeGroup>

## Response

The API returns a streaming response with the expert's message:

```text theme={null}
data: Hello! I'd be happy to help you with leadership development.
data:  Let's start by understanding your current goals and challenges...
```

The thread ID is returned in the `X-Thread-Id` header for continuing the conversation.

## Complete Workflow Example

Here's a typical flow for managing conversations:

### 1. Start a Chat

Use the `/chat` endpoint to begin a conversation (shown above). Save the `X-Thread-Id` from the response header.

### 2. Get All User Threads

```bash theme={null}
curl -X GET https://api.myweave.ai/functions/v1/users/user_abc123/threads \
  -H "X-API-Key: your_api_key_here"
```

### 3. Get Messages from a Thread

```bash theme={null}
curl -X GET https://api.myweave.ai/functions/v1/threads/550e8400-e29b-41d4-a716-446655440000/messages \
  -H "X-API-Key: your_api_key_here"
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/authentication">
    Learn about API authentication and security
  </Card>

  <Card title="Chat API" icon="message-circle" href="/api-reference/chat">
    Real-time expert consultations
  </Card>

  <Card title="User Threads" icon="list" href="/api-reference/users">
    Get all conversations for a user
  </Card>

  <Card title="Thread Messages" icon="history" href="/api-reference/threads">
    Retrieve message history
  </Card>
</CardGroup>
