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

# Create Client

The `Client` class provides an interface to connect to the CyborgDB service and manage encrypted indexes. It allows you to create, list, and interact with encrypted indexes through the CyborgDB REST API.

## Creating the Client

To create the client, you need to provide the service URL and an API key for authentication:

<CodeGroup>
  ```python Python SDK icon="python" theme={null}
  from cyborgdb import Client

  # Create client with API key
  client = Client(
      base_url='http://localhost:8000', 
      api_key='your-api-key'
  )
  ```

  ```javascript JavaScript SDK icon="js" theme={null}
  import { Client } from 'cyborgdb';

  // Create client with API key
  const client = new Client({ 
      baseUrl: 'http://localhost:8000', 
      apiKey: 'your-api-key' 
  });
  ```

  ```typescript TypeScript SDK icon="code" theme={null}
  import { Client } from 'cyborgdb';

  // Create client with API key
  const client = new Client({ 
      baseUrl: 'http://localhost:8000', 
      apiKey: 'your-api-key' 
  });
  ```

  ```go Go SDK icon="golang" theme={null}
  package main

  import (
      "log"
      
      "github.com/cyborginc/cyborgdb-go"
  )

  func main() {
      // Create client with API key
      client, err := cyborgdb.NewClient("http://localhost:8000", "your-api-key")
      if err != nil {
          log.Fatal(err)
      }
  }
  ```

  ```bash cURL icon="rectangle-terminal" theme={null}
  # Test connection with health check
  curl -X GET "http://localhost:8000/v1/health"

  # All subsequent API calls will use this pattern:
  # curl -H "X-API-Key: your-api-key" "http://localhost:8000/v1/..."
  ```
</CodeGroup>

<Tip>If using the REST API directly, you don't need to create a client. You can make HTTP requests directly to the [service endpoints](../../rest-api/introduction).</Tip>

## API Key Authentication

To use CyborgDB, you'll need an API key for authentication. You can get an API key from the [CyborgDB Admin Dashboard](https://cyborgdb.co).

The client handles all authentication automatically once you provide the API key during initialization.

## Health Checking

You can verify the service connection and health:

<CodeGroup>
  ```python Python SDK icon="python" theme={null}
  # Check service health
  try:
      health = client.get_health()
      print("Service status:", health["status"])
  except Exception as e:
      print(f"Service unavailable: {e}")
  ```

  ```javascript JavaScript SDK icon="js" theme={null}
  // Check service health
  try {
      const health = await client.getHealth();
      console.log('Service status:', health);
  } catch (error) {
      console.error('Service unavailable:', error.message);
  }
  ```

  ```typescript TypeScript SDK icon="code" theme={null}
  // Check service health
  try {
      const health = await client.getHealth();
      console.log('Service status:', health);
  } catch (error) {
      console.error('Service unavailable:', error.message);
  }
  ```

  ```go Go SDK icon="golang" theme={null}
  package main

  import (
      "context"
      "fmt"
      "log"
      
      "github.com/cyborginc/cyborgdb-go"
  )

  func main() {
      // Create client
      client, err := cyborgdb.NewClient("http://localhost:8000", "your-api-key")
      if err != nil {
          log.Fatal(err)
      }
      
      // Check service health
      ctx := context.Background()
      health, err := client.GetHealth(ctx)
      if err != nil {
          fmt.Printf("Service unavailable: %v\n", err)
          return
      }
      fmt.Printf("Service status: %+v\n", health)
  }
  ```

  ```bash cURL icon="rectangle-terminal" theme={null}
  # Check service health (no API key required)
  curl -X GET "http://localhost:8000/v1/health"

  # Expected response:
  # {"status": "healthy", "api_version": "v1", "version": "0.17.0"}
  ```
</CodeGroup>

## API Reference

For more information on the `Client` class, refer to the API Reference:

<CardGroup cols={3}>
  <Card title="Python SDK Reference" href="../../python-sdk/client/client" icon="python">
    API reference for `Client` in Python
  </Card>

  <Card title="JS/TS SDK Reference" href="../../js-ts-sdk/client/client" icon="js">
    API reference for `Client` in JavaScript/TypeScript
  </Card>

  <Card title="Go SDK Reference" href="../../go-sdk/client/client" icon="golang">
    API reference for `Client` in Go
  </Card>
</CardGroup>
