> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tryhamsa.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate to public keys and SDK 0.7.0

> Move a page that starts calls with an older API key to a public key, update to Web SDK 0.7.0, and find what changed for code written for older versions.

## Move from an API key to a public key

A page that starts calls with `new HamsaVoiceAgent(API_KEY)` keeps working: its calls run what your agent's prod serves, as before. Move when you can. Anyone who opens your page can read the key in it, and an older API key can do much more than start calls. A public key can only start calls, in one environment.

**1. Create a public key**

On the [API keys](https://docs.tryhamsa.com/overview/create-api-keys.md) page, create a key under **Website or app**, for prod. Limit it to your agents and to your site's domains.

**2. Update the SDK**

Public keys need version 0.7.0 or later:

```bash theme={null}
npm i @hamsa-ai/voice-agents-sdk@latest
```

On a CDN, change the version in the script's address to `0.7.0`.

**3. Pass the key as publicKey**

Options you already pass go in the same object:

```javascript theme={null}
// Before
const agent = new HamsaVoiceAgent(API_KEY, { region: "uae" });

// After
const agent = new HamsaVoiceAgent({ publicKey: "pk_...", region: "uae" });
```

`start()` and everything after it stay the same.

**4. Delete the old key**

Once your site runs on the public key, delete the API key on the API keys page, if nothing else uses it.

What works differently with a public key:

* **One environment.** A public key reaches only its own environment. Give your staging site a staging key.
* **No choosing a version from the page.** To choose per call, get [call tokens](https://docs.tryhamsa.com/developers/sdks/web-sdk/start-calls.md#with-a-call-token-from-your-server) on your server with a secret key.
* **`getJobDetails()` doesn't work.** Read the call from your server, or use the agent's [webhook](https://docs.tryhamsa.com/agents/connect/webhooks.md).

## Options that no longer do anything

`start()` still accepts `userId`, `preferHeadphonesForIosDevices`, `connectionDelay` and `disableWakeLock`, so code that passes them keeps working, but they have no effect. You can remove them.

## Older versions of the SDK

Connection details are set for you: you don't configure the call server yourself. For code written for versions before 0.4, see the SDK's [migration guide](https://github.com/hamsa-ai/voice-agents-sdk/blob/main/MIGRATION_GUIDE.md) on GitHub.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.