Creates an application or updates it in place, so a deployment can declare the…
Creates an application or updates it in place, so a deployment can declare the applications it needs and run the same declaration on every environment and…
POST /v1/iam/admin/applications/upsert
| Address | https://api.hanzo.ai/v1/iam/admin/applications/upsert |
| Method | POST |
| Operation | upsertApplication |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Creates an application or updates it in place, so a deployment can declare the applications it needs and run the same declaration on every environment and on every redeploy.
It says which of the two it did. Leave the client secret out and the existing one is kept — so re-running your deployment does not rotate a credential your running services are holding.
Request
14 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
Authorization | header | string | — | |
cert | body | string | — | |
clientId | body | string | — | |
clientSecret | body | string | — | |
displayName | body | string | — | |
enableCodeSignin | body | boolean | — | EnableCodeSignin offers sign-in by an emailed or texted one-time code beside the password. |
expireInHours | body | number | — | ExpireInHours and RefreshExpireInHours are the application's token lifetimes. |
grantTypes | body | string[] | — | |
isShared | body | boolean | — | IsShared declares that this application serves EVERY organization, not only the one named in Organization. |
name | body | string | — | |
organization | body | string | — | |
public | body | boolean | — | Public declares a client that CANNOT hold a credential — a browser SPA, a CLI, a desktop app. |
redirectUris | body | string[] | — | |
refreshExpireInHours | body | number | — |
Response
| Status | Body | Meaning |
|---|---|---|
200 | iam.reply | ok |
400 | iam.reply | bad request |
401 | iam.reply | unauthorized |
500 | iam.reply | internal server error |
200 body — 4 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
action | body | string | — | |
data | body | object | — | |
msg | body | string | — | |
status | body | string | — |
Failure carries the platform error shape — see Errors.
Examples
hanzo iam admin applications upsertimport { Configuration, IamApi } from 'hanzoai';
const api = new IamApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.upsertApplication({ cert: "<cert>", clientId: "<clientId>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import IamApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = IamApi(client).upsert_application(cert="<cert>", client_id="<clientId>")cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.IamAPI.UpsertApplication(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, iam_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = iam_api::upsert_application(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.IamApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new IamApi(client).upsertApplication();curl -X POST https://api.hanzo.ai/v1/iam/admin/applications/upsert \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"cert": "<cert>",
"clientId": "<clientId>"
}'Tool iam, op upsertApplication — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "iam",
"arguments": {
"op": "upsertApplication",
"input": {
"cert": "<cert>",
"clientId": "<clientId>"
}
}
}
}'How is this guide?