Hanzo
OpenapiTools

Builds and stores one plugin for the caller's org.

Builds and stores one plugin for the caller's org. The 201 carries the bundle's size, whether a model wrote the source, and the plugin as stored.

POST /v1/tools/plugins/build

Addresshttps://api.hanzo.ai/v1/tools/plugins/build
MethodPOST
Operationpost_tools_plugins_build
AuthAuthorization: Bearer $HANZO_API_KEY

Builds and stores one plugin for the caller's org. The 201 carries the bundle's size, whether a model wrote the source, and the plugin as stored.

Post source to build TypeScript as-is, or spec — an OpenAPI document or plain prose describing the endpoints — to have one generated; the generated source comes back in the answer, so a caller reads what will run before it runs. Exactly one of the two, and name must be one lowercase path segment; both or neither is 400.

COMPILING IS THE GATE. The source goes through the same pipeline the committed connectors do — esbuild to one CommonJS program, then compiled in the goja runtime that will actually execute it — and anything that fails is rejected and NEVER stored. So a plugin in the store is one this deployment has already loaded once, not one a model claimed was fine. A failed build answers 422 carrying the diagnostics a caller needs to fix it: the bundler's error (detail), the source that failed, and whether the model wrote it.

CREDENTIALS ARE NOT PART OF A PLUGIN. A plugin names the connectors provider it needs and reads that credential from ctx.auth at run time, under KMS custody. Source that carries something key-shaped is REFUSED rather than silently persisted — a scrubbed key looks like it worked.

Request

4 fields, body application/json (required).

FieldInTypeRequiredDescription
namebodystringName is the plugin's name: one lowercase path segment (a-z0-9, _ or -), and the id the runtime loads it by.
providerbodystringProvider is the connectors provider whose credential the plugin reads at run time.
sourcebodystringSource is TypeScript to build as-is.
specbodystringSpec is API documentation — an OpenAPI document, or prose describing the endpoints — that the generator turns into Source.

Response

StatusBodyMeaning
201buildOutcreated

201 body — 9 fields.

FieldInTypeAlwaysDescription
bytesbodyintegerBytes is the size of the bundled CommonJS the runtime will execute.
generatedbodybooleanGenerated is whether a model wrote the source from a spec, rather than the caller posting the source itself.
pluginbodyAuthoredPlugin
plugin.createdAtbodyintegerCreatedAt is when the plugin was last built, Unix seconds.
plugin.idbodystringID is the plugin's id within the org, and the id a delete addresses.
plugin.namebodystringName is the plugin's name: one lowercase path segment, the id it runs by.
plugin.orgbodystringOrg is the org that built the plugin — the validated caller's.
plugin.providerbodystringProvider is the connectors provider whose credential this plugin uses at run time. Absent for a plugin that needs none.
plugin.sourcebodystringSource is the TypeScript as authored (or as generated from a spec).

Failure carries the platform error shape — see Errors.

Examples

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


Tools API · All Hanzo APIs · Interactive reference

How is this guide?

On this page