# Initializing DigitalRiver.js

‌Use `DigitalRiver(publishableAPIKey)` to create an instance of the [`DigitalRiver` object](/commerce-api/resources/reference/digitalriver-object.md). The function requires a [public API key](https://docs.digitalriver.com/commerce-api-references/commerce-api-reference-guide/api-structure/api-keys#public-keys).&#x20;

```javascript
let digitalriver = new DigitalRiver("YOUR_PUBLIC_API_KEY", {
     "locale": "en-us"
});
```

It also accepts [`options`](#localizing-digitalriver.js) (*optional*) using the following format: `DigitalRiver(publishableApiKey[, options])`

## ‌Localizing DigitalRiver.js

In `options`, you can specify a `locale` to localize the library.

The following example translates the various display and error strings within DigitalRiver.js into Italian ‌by assigning `it` to `locale`.

```javascript
let digitalriver = new DigitalRiver("YOUR_PUBLIC_API_KEY", {
     "locale": "it"
});
```


---

# 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.digitalriver.com/commerce-api/resources/reference/digital-river-publishable-api-key.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.
