Upsert applications

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.

POST /v1/iam/admin/applications/upsert

Addresshttps://api.hanzo.ai/v1/iam/admin/applications/upsert
MethodPOST
OperationupsertApplication
AuthAuthorization: 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).

FieldInTypeRequiredDescription
Authorizationheaderstring—
certbodystring—
clientIdbodystring—
clientSecretbodystring—
displayNamebodystring—
enableCodeSigninbodyboolean—EnableCodeSignin offers sign-in by an emailed or texted one-time code beside the password.
expireInHoursbodynumber (double)—ExpireInHours and RefreshExpireInHours are the application's token lifetimes.
grantTypesbodystring[]—
isSharedbodyboolean—IsShared declares that this application serves EVERY organization, not only the one named in Organization.
namebodystring—
organizationbodystring—
publicbodyboolean—Public declares a client that CANNOT hold a credential — a browser SPA, a CLI, a desktop app.
redirectUrisbodystring[]—
refreshExpireInHoursbodynumber (double)—

Response

StatusBodyMeaning
200iam.replyok
400iam.replybad request
401iam.replyunauthorized
409iam.replyconflict
500iam.replyinternal server error
defaultproblem-detailsrefused

200 body — 4 fields.

FieldInTypeAlwaysDescription
actionbodystring—
databodyany—
msgbodystring—
statusbodystring—

Failure carries the platform error shape — see Errors.

Examples

hanzo iam admin applications upsert
import { 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 := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.IamAPI.UpsertApplication(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::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.setBearerToken(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>"
           }
         }
       }
     }'

IAM API · All Hanzo APIs · Interactive reference

Was this page useful?