Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion api-reference/analytics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,47 @@ Retrieve aggregated analytics across your classified comments. This endpoint is

### Example request

```bash
<CodeGroup>

```bash cURL
curl "https://api.trynawa.com/v1/analytics?platform=youtube&from=2025-01-01T00:00:00Z&to=2025-01-31T23:59:59Z&group_by=week" \
-H "Authorization: Bearer nawa_test_sk_xxx"
```

```typescript TypeScript
import { Nawa } from '@nawalabs/sdk'

const nawa = new Nawa({ apiKey: process.env.NAWA_API_KEY })

const { data, error } = await nawa.analytics.get({
platform: 'youtube',
from: '2025-01-01T00:00:00Z',
to: '2025-01-31T23:59:59Z',
groupBy: 'week'
})

console.log(data.total_comments)
console.log(data.summary.sentiment)
```

```python Python
from nawa import Nawa

nawa = Nawa(api_key="your_api_key")

result = nawa.analytics.get(
platform="youtube",
from_date="2025-01-01T00:00:00Z",
to_date="2025-01-31T23:59:59Z",
group_by="week"
)

print(result.data.total_comments)
print(result.data.summary.sentiment)
```

</CodeGroup>

## Response

### Success response (200)
Expand Down
1 change: 1 addition & 0 deletions api-reference/classify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Classify a comment in one API call. Returns intent labels, sentiment, language,
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `text` | string | Yes | The comment text to classify. Must be a non-empty string. |
| `context` | object | No | Optional context object. Accepted for forward compatibility; reserved for future use. |

### Query parameters

Expand Down
33 changes: 32 additions & 1 deletion api-reference/health.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,41 @@ Check the operational status of the NAWA API. This endpoint is **free** and does

## Request

```bash
<CodeGroup>

```bash cURL
curl https://api.trynawa.com/v1/health
```

```typescript TypeScript
import { Nawa } from '@nawalabs/sdk'

const nawa = new Nawa({ apiKey: process.env.NAWA_API_KEY })

const { data, error } = await nawa.health.check()

if (data.status === 'healthy') {
console.log('All services operational')
} else {
console.log('Degraded services:', data.services)
}
```

```python Python
from nawa import Nawa

nawa = Nawa(api_key="your_api_key")

result = nawa.health.check()

if result.data.status == "healthy":
print("All services operational")
else:
print(f"Degraded services: {result.data.services}")
```

</CodeGroup>

## Response

### Healthy response (200)
Expand Down
Loading