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

# Start the daemon

Run `barkd` and point it at a datadir. On first start, it initializes the datadir and generates an [auth token](/barkd/authenticate).

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
barkd --datadir <path-to-bark-data>
```

The API listens on `http://localhost:3535/api/v1` by default. A Swagger UI is served at `/swagger-ui` and the OpenAPI spec at `/api-docs/openapi.json`.

## Common flags

* `--datadir <path>` — where `barkd` stores wallet data and its auth secret. Defaults to `~/.bark`. Also settable via `BARKD_DATADIR`.
* `--host <host>` and `--port <port>` — bind address for the REST API. Also settable via `BARKD_BIND_HOST` and `BARKD_BIND_PORT`.
* `--allowed-origins <origins>` — comma-separated list of CORS origins allowed to call the API from a browser. Cross-origin requests are denied by default. Also settable via `BARKD_ALLOWED_ORIGINS`.

<Warning>
  The `barkd` API is designed for local use. Do not expose it to the public internet without additional authentication in front of it—anyone with the bearer token can control the wallet.
</Warning>
