# Configuring the HTTP API

## [Using Rasa’s HTTP API](https://legacy-docs-v1.rasa.com/1.10.3/user-guide/configuring-http-api/#id1)

Note

The instructions below are relevant for configuring how a model is run within a Docker container or for testing the HTTP API locally. If you want to deploy your assistant to users, see [Deploying Your Rasa Assistant](https://legacy-docs-v1.rasa.com/1.10.3/user-guide/how-to-deploy/#deploying-your-rasa-assistant).

You can run a simple HTTP server that handles requests using your trained Rasa model with:

```bash
rasa run -m models --enable-api --log-file out.log
```

All the endpoints this API exposes are documented in [HTTP API](https://legacy-docs-v1.rasa.com/1.10.3/api/http-api/#http-api).

The different parameters are:

- `-m`: the path to the folder containing your Rasa model,
- `--enable-api`: enable this additional API, and
- `--log-file`: the path to the log file.

Rasa can load your model in three different ways:

1. Fetch the model from a server (see [Fetching Models from a Server](https://legacy-docs-v1.rasa.com/1.10.3/user-guide/configuring-http-api/#server-fetch-from-server)), or
2. Fetch the model from a remote storage (see [Cloud Storage](https://legacy-docs-v1.rasa.com/1.10.3/user-guide/cloud-storage/#cloud-storage)).
3. Load the model specified via `-m` from your local storage system,

Rasa tries to load a model in the above mentioned order, i.e. it only tries to load your model from your local storage system if no model server and no remote storage were configured.

### [Fetching Models from a Server](https://legacy-docs-v1.rasa.com/1.10.3/user-guide/configuring-http-api/#id2)

You can configure the HTTP server to fetch models from another URL:

```bash
rasa run --enable-api --log-file out.log --endpoints my_endpoints.yml
```

The model server is specified in the endpoint configuration (`my_endpoints.yml`), where you specify the server URL Rasa regularly queries for zipped Rasa models:

```yaml
models:
  url: http://my-server.com/models/default@latest
  wait_time_between_pulls: 10   # [optional](default: 100)
```

Note

If you want to pull the model just once from the server, set `wait_time_between_pulls` to `None`.

### [Configuring SSL / HTTPS](https://legacy-docs-v1.rasa.com/1.10.3/user-guide/configuring-http-api/#id4)

By default the Rasa server is using HTTP for its communication. To secure the communication with SSL, you need to provide a valid certificate and the corresponding private key file.

You can specify these files as part of the `rasa run` command:

```bash
rasa run --ssl-certificate myssl.crt --ssl-keyfile myssl.key
```

## [Security Considerations](https://legacy-docs-v1.rasa.com/1.10.3/user-guide/configuring-http-api/#id5)

We recommend to not expose the Rasa Server to the outside world, but rather connect to it from your backend over a private connection (e.g. between docker containers).

Nevertheless, there are two authentication methods built in:

**Token Based Auth:**

```bash
rasa run \
    -m models \
    --enable-api \
    --log-file out.log \
    --auth-token thisismysecret
```

Requests should pass the token, in our case `thisismysecret`, as a parameter:

```bash
$ curl -XGET localhost:5005/conversations/default/tracker?token=thisismysecret
```

**JWT Based Auth:**

```bash
rasa run \
    -m models \
    --enable-api \
    --log-file out.log \
    --jwt-secret thisismysecret
```

Your requests should have set a proper JWT header:

```plaintext
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWx0IjoxNTE2MjM5MDIyfQ.qdrr2_a7Sd80gmCWjnDomOGl8eZFVfKXA6jhncgRn-I"
```

## [Endpoint Configuration](https://legacy-docs-v1.rasa.com/1.10.3/user-guide/configuring-http-api/#id6)

To connect Rasa to other endpoints, you can specify an endpoint configuration within a YAML file. Then run Rasa with the flag `--endpoints <path to endpoint configuration.yml>`.

```bash
rasa run \
    --m <Rasa model> \
    --endpoints <path to endpoint configuration>.yml
```

### [Connecting a Tracker Store](https://legacy-docs-v1.rasa.com/1.10.3/user-guide/configuring-http-api/#id7)

To configure a tracker store within your endpoint configuration, see [Tracker Stores](https://legacy-docs-v1.rasa.com/1.10.3/api/tracker-stores/#tracker-stores).

### [Connecting an Event Broker](https://legacy-docs-v1.rasa.com/1.10.3/user-guide/configuring-http-api/#id8)

To configure an event broker within your endpoint configuration, see [Event Brokers](https://legacy-docs-v1.rasa.com/1.10.3/api/event-brokers/#event-brokers).
