# Problem starting JSON API on all interfaces

**URL:** <https://forum.canton.network/t/problem-starting-json-api-on-all-interfaces/149>\
**Category:** App Development\
**Created:** [April 16, 2020, 7:33am UTC](https://forum.canton.network/t/problem-starting-json-api-on-all-interfaces/149 "2020-04-16T07:33:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bernhard](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/bernhard/32/356_2.png) [@bernhard](https://forum.canton.network/u/bernhard)\
**Post date:** [April 16, 2020, 7:33am UTC](https://forum.canton.network/t/problem-starting-json-api-on-all-interfaces/149/1 "2020-04-16T07:33:33Z")

</div>

`daml start --json-api-option "--address 0.0.0.0"` gives me

```haskell
Waiting for JSON API to start:
Error: Unknown option --address 0.0.0.0

```

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [April 16, 2020, 7:40am UTC](https://forum.canton.network/t/problem-starting-json-api-on-all-interfaces/149/2 "2020-04-16T07:40:20Z")

</div>

If you pass `--json-api-option myoption` (and the same holds for `--sandbox-option` and `--navigator-option`), the JSON API will see exactly one argument with the value `myoption`. There is no magic splitting on spaces performed here. So for your example the JSON API sees a single argument of value `--address 0.0.0.0`. However, it expects this to be passed as two arguments instead: First `--address` and then `0.0.0.0`. There are two ways to fix this:

1. Change the syntax so that JSON-API accepts it as a single option. Pretty much all tools allow you to use an `=` sign to separate the option name and the value and pass them in a single argument. So for your example that would be `--json-api-option "--address=0.0.0.0"`.
2. Use `--json-api-option` multiple times: So for your example that would be `--json-api-option "--address" --json-api-option "0.0.0.0`.

For this simple example I would probably go with 1 but in general if you actually have multiple completely separate options you have to use option 2 to separate them.

---

<div class="post-metadata">

**Author:** ![huw](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/huw/32/2343_2.png) [@huw](https://forum.canton.network/u/huw)\
**Post date:** [June 30, 2021, 4:41am UTC](https://forum.canton.network/t/problem-starting-json-api-on-all-interfaces/149/3 "2021-06-30T04:41:42Z")

</div>

Is your option 2 something that should work or does it require code change on your end? I’ve tried this on SDK 1.14.0:

```haskell
daml start --json-api-option --ledger-host --json-api-option myhost --json-api-option --ledger-port --json-api-option XXXX

```

But I get:

```haskell
.Waiting for JSON API to start:
Error: Unknown option --ledger-host
Error: Unknown argument 'myhost'
Error: Unknown option --ledger-port
Error: Unknown argument 'XXXX'
Try --help for more information.

```

---

<div class="post-metadata">

**Author:** ![bernhard](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/bernhard/32/356_2.png) [@bernhard](https://forum.canton.network/u/bernhard)\
**Post date:** [June 30, 2021, 7:19am UTC](https://forum.canton.network/t/problem-starting-json-api-on-all-interfaces/149/4 "2021-06-30T07:19:55Z")

</div>

I think you can’t set the ledger host and port for the JSON API independently when using `daml start`. `daml start` automatically passes `localhost` and the sandbox port to the JSON API via CLI flags so setting your own CLI flags causes a clash resulting in a somewhat misleading error message.

If you want to start the `json-api` against a remote ledger, use `daml json-api`. If you want to run the sandbox and JSON API with a non-standard Ledger API port using `daml start`, use `daml start --sandbox-port XXXX`.
