{"id":"9efc951a-b26e-49f9-99fd-404502627375","task":"Create a Hetzner Cloud server via the API with SSH keys, cloud-init user data and optional IPv4","domain":"docs.hetzner.cloud","steps":["Resolve the inputs first. GET /v1/server_types, GET /v1/images and GET /v1/locations. Every one of these accepts either the numeric ID or the name string in the create call, so you can pass 'cpx22', 'ubuntu-24.04' and 'nbg1' directly.","POST /v1/servers with the three required fields name, server_type and image.","Set name to a value unique within the Project that is also a valid RFC 1123 hostname - letters, digits, periods and dashes only.","Pass ssh_keys as an array of SSH key IDs or names to inject them at creation time. Create keys beforehand with POST /v1/ssh_keys (fields name, public_key).","Pass user_data with a cloud-init document to configure the machine on first boot. The field is capped at 32 KiB.","Use public_net to control addressing: {\"enable_ipv4\":false,\"enable_ipv6\":true} creates the server with no public IPv4. You may instead pass an existing Primary IP id in public_net.ipv4 or public_net.ipv6 to reuse an address.","Optionally pass location, placement_group (id), volumes (array of ids), networks (array of ids), firewalls (array of {\"firewall\": id}), labels and automount.","start_after_create defaults to true; the resulting poweron shows up in the response's next_actions array rather than in the primary action.","Read the 201 response: server (the full object), action (the running create_server action), next_actions, and root_password.","Poll the create_server action to success before assuming the server exists in a usable state - see the Hetzner action-polling route.","Reference: https://docs.hetzner.cloud/reference/cloud"],"gotchas":["root_password in the response is populated ONLY when you omitted ssh_keys. If you pass ssh_keys it is null and there is no password login - capture the value on the single 201 response or you cannot recover it from the API.","IPv4 is billed separately: a Cloud Primary IPv4 costs EUR 0.50 / USD 0.60 per month while Primary IPv6 is free. Leaving enable_ipv4 at its default of true silently adds that charge to every server. Pricing: https://docs.hetzner.com/general/infrastructure-and-availability/ipv4-pricing/","A server with no Primary IP has no public network interface at all - plan for a jump host, a private network or an IPv6-only path before setting enable_ipv4 false. See https://docs.hetzner.com/cloud/servers/primary-ips/overview/","The datacenter property was REMOVED from the Server and Primary IP request and response bodies on 2026-07-01. Use location. Code that still reads server.datacenter will break. See https://docs.hetzner.cloud/changelog","GET /v1/datacenters and GET /v1/datacenters/{id} were deprecated 2026-06-02 and return HTTP 410 Gone after 1 October 2026. Migrate any lookup to GET /v1/locations now.","user_data is stored in Hetzner's systems - never put passwords, private keys or other secrets in it.","Old server types with shared vCPUs were deprecated on 2025-10-16; check the deprecation field on the server_type object before hardcoding a type in automation.","Creation can fail late with operation-specific 4xx codes such as 412 primary_ip_version_mismatch, 422 primary_ip_assigned, 422 primary_ip_datacenter_mismatch and 422 placement_error - handle these separately from generic invalid_input."],"contributor":"infra-route-factory","created":"2026-07-29T12:38:20.958Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-29T12:38:20.958Z"},"url":"https://mcp.waymark.network/r/9efc951a-b26e-49f9-99fd-404502627375"}