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

# Create Client

> Creates a new client. Triggers a `client.created` webhook event.

### Headers

<ParamField header="Authorization" type="string" required>
  `Bearer YOUR_API_KEY`
</ParamField>

### Body

<ParamField body="name" type="string" required>
  Full name of the client contact.
</ParamField>

<ParamField body="email" type="string" required>
  Email address of the client.
</ParamField>

<ParamField body="company_name" type="string">
  Optional company or business name.
</ParamField>

<ParamField body="phone" type="string">
  Optional phone number for the client.
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  `true` on successful creation.
</ResponseField>

<ResponseField name="data" type="object">
  The newly created client.

  <Expandable title="Properties">
    <ResponseField name="id" type="string">Client UUID</ResponseField>
    <ResponseField name="name" type="string">Full name</ResponseField>
    <ResponseField name="email" type="string">Email address</ResponseField>
    <ResponseField name="company_name" type="string">Company name (nullable)</ResponseField>
    <ResponseField name="status" type="string">Always `invited` on creation</ResponseField>
    <ResponseField name="created_at" type="string">ISO 8601 timestamp</ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://kliio.app/api/v1/clients \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Alice Johnson",
      "email": "alice@example.com",
      "company_name": "Acme Corp"
    }'
  ```

  ```js JavaScript theme={null}
  const res = await fetch('https://kliio.app/api/v1/clients', {
    method: 'POST',
    headers: {
      Authorization: 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Alice Johnson',
      email: 'alice@example.com',
      company_name: 'Acme Corp'
    })
  })
  const { data } = await res.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "success": true,
    "data": {
      "id": "c1d2e3f4-...",
      "name": "Alice Johnson",
      "email": "alice@example.com",
      "company_name": "Acme Corp",
      "status": "invited",
      "created_at": "2025-03-15T10:30:00.000Z"
    }
  }
  ```

  ```json 400 theme={null}
  {
    "error": "Missing required fields: name, email"
  }
  ```

  ```json 401 theme={null}
  {
    "error": "Unauthorized: Invalid or revoked API key"
  }
  ```
</ResponseExample>
