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

# Connecting

> Connect to Threadify Engine and start tracking workflows

### Basic Connection

<CodeGroup>
  ```javascript JavaScript theme={null}
  import { Threadify } from '@threadify/sdk';

  const threadify = await Threadify.connect('your-api-key', 'my-service');
  await threadify.close()
  ```

  ```go Go theme={null}
  ctx := context.Background()
  conn, err := threadify.Connect(ctx, "your-api-key", 
      threadify.WithServiceName("my-service"),
  )
  if err != nil {
      log.Fatal(err)
  }
  defer conn.Close()
  ```

  ```python Python theme={null}
  from threadify import Threadify

  # Connect with your API key and service name
  connection = await Threadify.connect(
      "your-api-key",
      service_name="my-service",
  )
  ```
</CodeGroup>

### Parameters

| Parameter     | Type   | Required | Description                                  |
| ------------- | ------ | -------- | -------------------------------------------- |
| `apiKey`      | string | Yes      | Your Threadify API key                       |
| `serviceName` | string | No       | Service identifier (e.g., 'payment-service') |
| `options`     | object | No       | Connection options                           |

### Options

| Option        | Type    | Default | Description                          |
| ------------- | ------- | ------- | ------------------------------------ |
| `maxInFlight` | number  | 10      | Max pending notifications (max: 100) |
| `reconnect`   | boolean | true    | Auto-reconnect on disconnect         |
| `timeout`     | number  | 30000   | Connection timeout (ms)              |

<Warning>
  Never commit API keys to version control. Use environment variables or secret managers/vault.
</Warning>

### Next Steps

<CardGroup cols={2}>
  <Card title="Tracking Workflows" icon="chart-line" href="/core-concepts/tracking-workflows">
    Start tracking your first workflow
  </Card>

  <Card title="Handling Failures" icon="triangle-exclamation" href="/core-concepts/handling-failures">
    Learn how to handle step failures
  </Card>
</CardGroup>
