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

# Get Started with LaraCopilot

> Learn how to authenticate, create your first tenant, and provision an extension using the LaraCopilot REST API in under 5 minutes.

This guide walks you through the minimum steps to go from zero to a live, provisioned extension on LaraCopilot. You will authenticate as the platform admin, create a tenant account, add a VoIP extension to it, and confirm the extension is visible in the system — all using the REST API.

<Steps>
  <Step title="Authenticate">
    Send your admin credentials to `POST /api/admin/login`. On success the server sets a session cookie that authenticates all subsequent requests.

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST https://your-domain.com/api/admin/login \
        -H "Content-Type: application/json" \
        -c cookies.txt \
        -d '{
          "email": "admin@business.com",
          "password": "admin123"
        }'
      ```

      ```json Response theme={null}
      {
        "message": "Login successful.",
        "data": {
          "name": "Admin User",
          "email": "admin@business.com",
          "role": "admin"
        }
      }
      ```
    </CodeGroup>

    Save the cookie jar (the `-c cookies.txt` flag in cURL) and pass it with every subsequent request using `-b cookies.txt`.

    <Note>
      If the credentials are wrong the API returns HTTP 422 with `"message": "Invalid credentials."`. Double-check the email and password and retry.
    </Note>
  </Step>

  <Step title="Create a tenant">
    A tenant represents one customer organisation on your platform. Every resource — extensions, DIDs, queues — belongs to a tenant. Send `POST /api/tenants` with the required fields.

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST https://your-domain.com/api/tenants \
        -H "Content-Type: application/json" \
        -b cookies.txt \
        -d '{
          "name": "Acme Corp",
          "slug": "acme-corp",
          "domain": "acme.your-domain.com",
          "status": "active",
          "timezone": "America/New_York",
          "max_extensions": 50
        }'
      ```

      ```json Response theme={null}
      {
        "message": "Tenant created successfully.",
        "data": {
          "id": 1,
          "name": "Acme Corp",
          "slug": "acme-corp",
          "domain": "acme.your-domain.com",
          "status": "active",
          "timezone": "America/New_York",
          "max_extensions": 50,
          "settings": null,
          "created_at": "2026-04-22T10:00:00.000000Z",
          "updated_at": "2026-04-22T10:00:00.000000Z"
        }
      }
      ```
    </CodeGroup>

    Note the `id` returned in the response — you will use it as `tenant_id` in the next step.

    <Note>
      Both `slug` and `domain` must be unique across all tenants. The API returns HTTP 422 with validation errors if either value is already taken.
    </Note>
  </Step>

  <Step title="Add an extension">
    Provision a SIP extension for the tenant. The `extension_number` is the diallable short code, and `secret` is the SIP registration password for the endpoint device.

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST https://your-domain.com/api/extensions \
        -H "Content-Type: application/json" \
        -b cookies.txt \
        -d '{
          "tenant_id": 1,
          "extension_number": "1001",
          "display_name": "Alice Smith",
          "email": "alice@acme.example.com",
          "secret": "s3cur3P@ssw0rd",
          "status": "active",
          "voicemail_enabled": true
        }'
      ```

      ```json Response theme={null}
      {
        "message": "Extension created successfully.",
        "data": {
          "id": 1,
          "tenant_id": 1,
          "extension_number": "1001",
          "display_name": "Alice Smith",
          "email": "alice@acme.example.com",
          "status": "active",
          "voicemail_enabled": true,
          "created_at": "2026-04-22T10:01:00.000000Z",
          "updated_at": "2026-04-22T10:01:00.000000Z"
        }
      }
      ```
    </CodeGroup>

    <Warning>
      The `secret` field is used as the SIP registration password and is stored as provided. Use a strong, randomly generated value and never reuse passwords across extensions.
    </Warning>
  </Step>

  <Step title="Verify the extension">
    Confirm the extension is listed by calling `GET /api/extensions`. You can optionally filter by `search` query parameter to narrow results by `extension_number`, `display_name`, or `email`.

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X GET "https://your-domain.com/api/extensions?search=1001" \
        -H "Accept: application/json" \
        -b cookies.txt
      ```

      ```json Response theme={null}
      {
        "message": "Extensions fetched successfully.",
        "data": [
          {
            "id": 1,
            "tenant_id": 1,
            "extension_number": "1001",
            "display_name": "Alice Smith",
            "email": "alice@acme.example.com",
            "status": "active",
            "voicemail_enabled": true,
            "tenant": {
              "id": 1,
              "name": "Acme Corp",
              "slug": "acme-corp"
            }
          }
        ]
      }
      ```
    </CodeGroup>
  </Step>
</Steps>

## What's next

You now have an authenticated session, a tenant, and a live extension. From here you can:

* **Assign a DID** — send `POST /api/dids` to assign a direct inward dialing number to the tenant and route it to the extension.
* **Create a call queue** — send `POST /api/queues` to build an ACD queue and add the extension as an agent.
* **Configure SMS** — send `POST /api/sms-gateways` to attach an SMS gateway to the tenant, then use `POST /api/sms-gateways/{smsGateway}/send` to send messages.
