Create token

Mints a short-lived, pull-only registry token for exactly one of the org's images, through the same IAM realm the docker CLI authenticates against.

POST /v1/registry/token

Addresshttps://api.hanzo.ai/v1/registry/token
MethodPOST
Operationpost_registry_token
AuthAuthorization: Bearer $HANZO_API_KEY

Mints a short-lived, pull-only registry token for exactly one of the org's images, through the same IAM realm the docker CLI authenticates against. The scope is pinned server-side to <org>/<image> with the pull action — no field exists to name another org's image or ask for push. Use it as Authorization: Bearer … on the OCI wire; it expires in minutes.

Request

1 field, body application/json (required).

FieldInTypeRequiredDescription
imagebodystring—Image is the repository name inside the org's namespace (e.g. "cloud").

Response

StatusBodyMeaning
200registry.registryTokenok
defaultproblem-detailsrefused

200 body — 3 fields.

FieldInTypeAlwaysDescription
expiresbodyinteger (int64)—Expires is the token's lifetime in seconds.
refbodystring—Ref is the one repository reference the token can pull.
tokenbodystring—Token is the bearer to present on the OCI wire (Authorization: Bearer … against the host's /v2/ routes).

Failure carries the platform error shape — see Errors.

Examples

hanzo registry token
import { Configuration, RegistryApi } from 'hanzoai';

const api = new RegistryApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postRegistryToken({ image: "<image>" });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import RegistryApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = RegistryApi(client).post_registry_token(image="<image>")
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.RegistryAPI.PostRegistryToken(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, registry_api};

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

let result = registry_api::post_registry_token(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.RegistryApi;

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

var result = new RegistryApi(client).postRegistryToken();
curl -X POST https://api.hanzo.ai/v1/registry/token \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "image": "<image>"
     }'

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

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": "list_registry_images"
         }
       }
     }'

Registry API · All Hanzo APIs · Interactive reference

Was this page useful?