# Service connection

These options tell WProofreader where to send spell check and grammar check requests.

#### Cloud

```js
serviceId: 'your-service-ID'
```

You can find your Service ID on the [Credentials](https://app.wproofreader.com/credentials) page in the admin panel.

#### Self-hosted

```js
serviceProtocol: 'https',
serviceHost: 'your_host_name',
servicePort: '443',
servicePath: 'wscservice/api'
```

You also need to point the `wscbundle.js` script `src` to your server. For NPM SDK integration, set the `srcUrl` option as well.

#### Request headers

If your server requires authentication, use the `requestHeaders` function to pass headers with every request. Only the `Authorization` header is supported. For cross-site requests, set `withCredentials: true`.

```js
requestHeaders: function() {
  return {
    Authorization: 'Bearer ' + localStorage.getItem('authorization')
  };
},
withCredentials: true,
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wproofreader.com/integrations/initialization/configuration-options/service-connection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
