Menu

Concepts

The CLI, Go SDK, and raw HTTP all talk to https://api.metalhost.net. This page covers what you need to integrate: resource naming, auth, async operations, and the request format. Dashboard UI concepts live in How it works.

Resource names

Every object has a fully-qualified resource name — a slash-separated path. The CLI accepts bare slugs; the SDK should use full names.

KindPatternSlug example
Projectprojects/{slug}my-app
Organizationorganizations/{slug}acme
Datacenterdatacenters/{slug}us-dal-1
VMprojects/{p}/virtual-machines/{id}web-1
SSH keyprojects/{p}/ssh-keys/{id}laptop
Diskprojects/{p}/disks/{id}data-1
File shareprojects/{p}/file-shares/{id}shared-data
Networkprojects/{p}/networks/{id}
Firewall ruleprojects/{p}/firewall-rules/{id}
Bare metal instancebare-metal-instances/{slug}my-box
Available hosthosts/{slug}dal-r740-01
Operationoperations/{id}op_abc123
API keyapi-keys/{id}
Webhook subscriptionwebhook-subscriptions/{slug}deploy-hook
Walletorganizations/{o}/wallets/default

Authentication

Mint an API key in the dashboard (Developers → API keys). Send it on every request:

Authorization: Bearer mh_live_...

Environment variables the CLI and SDK share:

VariablePurpose
METALHOST_API_KEYBearer token (required)
METALHOST_ENDPOINTDefault https://api.metalhost.net
METALHOST_PROJECTDefault projects/… scope
METALHOST_REGIONDefault datacenters/…

Long-running operations

VM create, delete, resize, clone, and reimage return an operation field. Poll GetOperation until state is SUCCEEDED, FAILED, or CANCELLED.

StateMeaning
PENDINGQueued
RUNNINGIn progress
SUCCEEDEDDone — read metadata
FAILEDRead errorMessage

On successful VM create, metadata.virtual_machine_name is the full VM resource name. CLI: metalhost ops wait operations/… or --wait on mutating commands.

VM manifests

CreateVirtualMachine takes a declarative VirtualMachineManifest — region, compute, boot, network, users. Same schema for CLI flags, YAML (vm apply -f), and SDK structs. Full YAML reference: CLI → VMs (YAML manifest). Field tables: Go SDK → VMs.

HTTP protocol

Connect-RPC over JSON. Every RPC is POST to:

https://api.metalhost.net/aes.<service>.v1.<Service>/<Method>

Example:

POST /aes.compute.v1.ComputeService/ListVirtualMachines
Content-Type: application/json
Authorization: Bearer mh_live_...

{"projectName": "projects/my-app"}

Bodies use proto-JSON (camelCase). Browse every method in the API reference or copy from Examples.

What's next