> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# run

> Start the HTTP server.

Start the HTTP server to serve the SWML document.

Returns immediately when `SWAIG_CLI_MODE=true` is set, so the CLI testing
tool can load the service without opening a port.

`run()` accepts two call shapes: the positional `(host, port, opts)` form, or a
single options object as the first argument (matching `AgentBase`'s
`run({ host, port })` shape).

## **Parameters**

**`hostOrOpts`** `string | object`

Either a host string (positional form) **or** a single options object with
`host`, `port`, `sslCert`, `sslKey`, `sslEnabled`, and `domain` fields. When an
options object is passed, the remaining positional arguments are ignored.

---

**`host`** `string`

Hostname to bind to. Defaults to the `host` passed to the constructor, or `"0.0.0.0"`.

---

**`port`** `number`

Port number to listen on. Defaults to the `port` passed to the constructor,
which itself falls back to the `PORT` environment variable or `3000`.

---

**`opts`** `object`

Optional SSL/TLS overrides. Each field falls back to the matching value on
the service instance.

---

**`opts.sslCert`** `string`

Path to the SSL certificate file. When both `sslCert` and `sslKey` are
resolved and `sslEnabled` is `true`, the server runs over HTTPS.

---

**`opts.sslKey`** `string`

Path to the SSL private key file.

---

**`opts.sslEnabled`** `boolean`

Override whether SSL/HTTPS is enabled for this run.

---

**`opts.domain`** `string`

Domain name associated with the SSL certificate.

---

## **Returns**

`Promise<void>`

## **Example**

```typescript {8}
import { SWMLService } from '@signalwire/sdk';

const service = new SWMLService({ name: 'my-ivr', route: '/ivr' });
service.addVerb('answer', {});
service.addVerb('play', { url: 'https://example.com/greeting.mp3' });
service.addVerb('hangup', {});

// Positional form
await service.run('0.0.0.0', 8080);

// Options-object form
await service.run({ host: '0.0.0.0', port: 8080 });
```