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

# Quickstart

> Get a token, create the student, and stream the first answer.

This page takes you from zero to a streamed answer. It uses `curl`. Every step works the same way
from a mobile client.

## Before you start

You need three things:

* The base URL. Production is `https://client-api.lala.ist`.
* A Lala Supabase project. The client signs in against this project.
* A Supabase access token for a signed-in user. Read [Authentication](/authentication) for how to
  get one.

<Note>
  The token is a normal Supabase access token. Lala does not issue its own tokens, and there is no
  API key.
</Note>

## 1. Check that the service is up

```bash theme={null}
curl https://client-api.lala.ist/health
```

The response is `{"ok":true}`. This endpoint needs no token.

## 2. Create the student

```bash theme={null}
curl https://client-api.lala.ist/api/me \
  -H "Authorization: Bearer $LALA_TOKEN"
```

The first call for a new user creates the student row. Call it once after every sign-in, before
you show the chat screen.

```json theme={null}
{
  "id": "9f1c0f2e-1f4a-4c5b-9a2d-0e0f1a2b3c4d",
  "phone": null,
  "email": "ogrenci@example.com",
  "profile": {
    "name": "",
    "examType": null,
    "field": null,
    "grade": "",
    "targetRanking": null,
    "targetRankingNum": null,
    "dailyHours": null,
    "strongSubjects": [],
    "weakSubjects": [],
    "onboardingComplete": false,
    "createdAt": "2026-08-02T09:12:44.000Z",
    "imageUrl": null
  },
  "onboardingComplete": false
}
```

If `onboardingComplete` is `false`, show the onboarding screen. Read
[Profile and onboarding](/guides/profile-and-onboarding).

## 3. Write the profile

```bash theme={null}
curl -X PATCH https://client-api.lala.ist/api/profile \
  -H "Authorization: Bearer $LALA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Zeynep","examType":"YKS","field":"Sayısal","grade":"12","dailyHours":6}'
```

The response holds the full profile after the update. `onboardingComplete` becomes `true` when
`grade` and `examType` are set, and, for YKS, `field` too.

## 4. Stream an answer

```bash theme={null}
curl -N -X POST https://client-api.lala.ist/api/chat/send \
  -H "Authorization: Bearer $LALA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"message":"Bugün matematik çalışacağım, nereden başlayayım?"}'
```

The `-N` flag disables buffering, so you see each event when it arrives. The response is a
`text/event-stream`:

```text theme={null}
event: chunk
data: {"text":"Tamam, "}

event: chunk
data: {"text":"türevden başlayalım."}

event: done
data: {"text":"Tamam, türevden başlayalım.","reactions":[]}
```

Render the `chunk` events as they arrive. Replace the rendered text with the `text` field of the
`done` event when the stream ends. Read [Stream a chat answer](/guides/chat-streaming) for the
full contract.

## 5. Read the history back

```bash theme={null}
curl https://client-api.lala.ist/api/chat/history \
  -H "Authorization: Bearer $LALA_TOKEN"
```

The endpoint returns the last 60 messages, oldest first. Call it when the chat screen opens, and
after a push notification. Read [Conversation history](/guides/conversation-history).

## Next steps

<CardGroup cols={2}>
  <Card title="Errors and limits" icon="triangle-exclamation" href="/guides/errors-and-limits">
    Status codes, body shapes, and the hard limits.
  </Card>

  <Card title="Push notifications" icon="bell" href="/guides/push-notifications">
    Lala writes first. Set the OneSignal alias.
  </Card>
</CardGroup>
