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

# SDK (Node.js)

> Official TypeScript client for the Nephia API.

Install the official SDK and call `/v1/*` with typed namespaces.

```bash theme={null}
npm install nephia
```

```ts theme={null}
import { Nephia } from "nephia";

const client = new Nephia({ apiKey: process.env.NEPHIA_API_KEY });

const balance = await client.account.credits();
const results = await client.vinted.search({ query: "nike", market: "fr" });

const watch = await client.vinted.watches.create({
  criteria: { query: "nike", market: "fr" },
  refreshIntervalSeconds: 300,
  webhookUrl: "https://example.com/webhooks/nephia",
});
```

## Authentication

Pass `apiKey` or set `NEPHIA_API_KEY`. Every request sends the `x-api-key` header.

```ts theme={null}
const client = new Nephia({ apiKey: "YOUR_API_KEY" });
```

## Namespaces

| Namespace        | Examples                                       |
| ---------------- | ---------------------------------------------- |
| `client.account` | `credits()`                                    |
| `client.vinted`  | `search()`, `items.get()`, `watches.*`         |
| `client.x`       | `search()`, `tweets.*`, `users.*`, `watches.*` |
| `client.reddit`  | `search.posts()`, `posts.get()`, `watches.*`   |

Params use **camelCase** in TypeScript. The SDK converts them to **snake\_case** on the wire. Responses are returned as-is (camelCase JSON).

## Watches

```ts theme={null}
await client.vinted.watches.list();
await client.vinted.watches.get(watch.id);
await client.vinted.watches.pause(watch.id);
await client.vinted.watches.resume(watch.id);
await client.vinted.watches.listEvents(watch.id, { since: "2026-07-01T00:00:00.000Z" });
await client.vinted.watches.delete(watch.id);
```

Same lifecycle on `client.x.watches` and `client.reddit.watches`.

## Webhook signatures

```ts theme={null}
import { Nephia } from "nephia";

const ok = Nephia.webhooks.verify(rawBody, req.headers["x-signature"], secret);
```

## Errors & retries

Typed errors: `AuthenticationError` (401), `InsufficientCreditsError` (402), `NotFoundError` (404), `RateLimitError` (429/503).

The client retries **429 / 502 / 503 / 504** and network failures (respects `Retry-After`). It does **not** retry other 4xx or timeouts — so pull credits are not double-charged.

## Next steps

* [Quickstart](/quickstart)
* [Credits](/credits)
* [Watches](/watches)
* [Webhooks](/webhooks)
* [API Reference](/api-reference/overview)
