# Replace credentials

URL: https://docs.hanzo.ai/docs/openapi/notify/put-notify-credentials-by-provider-by-key

> Sets one of your org's notify provider credentials.

`PUT /v1/notify/credentials/{provider}/{key}`

> [Notify →](https://docs.hanzo.ai/docs/openapi/notify) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                               |
| ------------- | ------------------------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/notify/credentials/{provider}/{key}` |
| **Method**    | `PUT`                                                         |
| **Operation** | `put_notify_credentials_by_provider_by_key`                   |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`                        |

Sets one of your org's notify provider credentials.

The value is sealed in KMS under your org and read by notify alone, at the
moment it sends; no route answers it back, this one included. Setting a key
that is already set replaces it, which is how a credential is rotated, and the
next send uses the new value. The key must be one the provider reads — Twilio's
account-sid, auth-token and from-number, say — and anything else is a 400
naming the keys it does read. An unknown provider is a 404.

Org admin only: a credential set here is what every message the org sends
goes out with.

## Request

5 fields, body `application/json` (required).

| Field      | In   | Type   | Required | Description                                                                                    |
| ---------- | ---- | ------ | -------- | ---------------------------------------------------------------------------------------------- |
| `provider` | path | string | yes      | Provider is the delivery provider the credential is for: twilio, plivo, twilio\_email or mail. |
| `key`      | path | string | yes      | Key is one of the credentials that provider reads, such as auth-token or smtp-host.            |
| `key`      | body | string | —        | Key is one of the credentials that provider reads, such as auth-token or smtp-host.            |
| `provider` | body | string | —        | Provider is the delivery provider the credential is for: twilio, plivo, twilio\_email or mail. |
| `value`    | body | string | —        | Value is sealed in KMS and never answered, logged or echoed.                                   |

## Response

| Status    | Body                | Meaning |
| --------- | ------------------- | ------- |
| `200`     | notify.notifyStored | ok      |
| `default` | problem-details     | refused |

`200` body — 3 fields.

| Field      | In   | Type    | Always | Description                                                     |
| ---------- | ---- | ------- | ------ | --------------------------------------------------------------- |
| `key`      | body | string  | —      | Key is the credential that was set.                             |
| `provider` | body | string  | —      | Provider is the provider the credential was set for.            |
| `stored`   | body | boolean | —      | Stored is true: the value is sealed and the next send reads it. |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

`hanzo` has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.

**SDK**

**.ts**

```ts
import { Configuration, NotifyApi } from 'hanzoai';

const api = new NotifyApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.putNotifyCredentialsByProviderByKey({ provider: 'provider', key: 'key', key: "<key>", provider: "<provider>" });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import NotifyApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = NotifyApi(client).put_notify_credentials_by_provider_by_key(provider='provider', key='key', key="<key>", provider="<provider>")
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.NotifyAPI.PutNotifyCredentialsByProviderByKey(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, notify_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = notify_api::put_notify_credentials_by_provider_by_key(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.NotifyApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new NotifyApi(client).putNotifyCredentialsByProviderByKey();
```

**HTTP**

```bash
curl -X PUT https://api.hanzo.ai/v1/notify/credentials/<provider>/<key> \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "key": "<key>",
       "provider": "<provider>"
     }'
```

**MCP**

MCP reaches **notify** through the `notify` tool, which names its 4 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "get_notify_health"
         }
       }
     }'
```

---

[Notify API](https://docs.hanzo.ai/docs/openapi/notify) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
