openapi: 3.0.3 info: title: Hetzner Cloud Actions Server Actions API version: 1.0.0 x-summary: 'Manage Hetzner Cloud services and resources linked to them, such as Floating IPs, Volumes and Load Balancers. ' description: "# Overview\n\nThis is the official documentation for the Hetzner Cloud API.\n\n## Introduction\n\nThe Hetzner Cloud API operates over HTTPS and uses JSON as its data format. The API is a RESTful API and utilizes HTTP methods and HTTP status codes to specify requests and responses.\n\nAs an alternative to working directly with our API you may also consider to use:\n\n- Our CLI program [hcloud](https://github.com/hetznercloud/cli)\n- Our [library for Go](https://github.com/hetznercloud/hcloud-go)\n- Our [library for Python](https://github.com/hetznercloud/hcloud-python)\n\nYou can find even more libraries, tools and integrations on our [Awesome List on GitHub](https://github.com/hetznercloud/awesome-hcloud).\n\n### Open source credits\n\nIf you are developing an open-source project that supports or intends to add support for Hetzner APIs, you may be eligible for a free one-time credit of up to € 50 / $ 50 on your account. Please contact us via the support page on your [Hetzner Console](https://console.hetzner.cloud/support) and let us know the following:\n\n- The name of the project you are working on\n- A short description of the project\n- Link to the project website or repo where the project is hosted\n- Affiliation with / role in the project (e.g. project maintainer)\n- Link to some other open-source work you have already done (if you have done so)\n\n**Note:** We only consider rewards for projects that provide Hetzner-specific functionality or integrations. For example, our Object Storage exposes a standard S3 API without any Hetzner-specific extensions. Projects that focus solely on generic S3 capabilities (e.g., general S3 clients or SDKs) are not Hetzner-specific and are therefore not eligible for Hetzner Rewards.\n\n## Getting Started\n\nTo get started using the API you first need an API token. Sign in into the [Hetzner Console](https://console.hetzner.com/) choose a Project, go to `Security` → `API Tokens`, and generate a new token. Make sure to copy the token because it won’t be shown to you again. A token is bound to a Project, to interact with the API of another Project you have to create a new token inside the Project. Let’s say your new token is `LRK9DAWQ1ZAEFSrCNEEzLCUwhYX1U3g7wMg4dTlkkDC96fyDuyJ39nVbVjCKSDfj`.\n\nYou’re now ready to do your first request against the API. To get a list of all Servers in your Project, issue the example request on the right side using [curl](https://curl.se/).\n\nMake sure to replace the token in the example command with the token you have just created. Since your Project probably does not contain any Servers yet, the example response will look like the response on the right side. We will almost always provide a resource root like `servers` inside the example response. A response can also contain a `meta` object with information like [Pagination](#description/pagination).\n\n**Example Request**\n\n```shell\ncurl -H \"Authorization: Bearer LRK9DAWQ1ZAEFSrCNEEzLCUwhYX1U3g7wMg4dTlkkDC96fyDuyJ39nVbVjCKSDfj\" \\\n https://api.hetzner.cloud/v1/servers\n```\n\n**Example Response**\n\n```json\n{\n \"servers\": [],\n \"meta\": {\n \"pagination\": {\n \"page\": 1,\n \"per_page\": 25,\n \"previous_page\": null,\n \"next_page\": null,\n \"last_page\": 1,\n \"total_entries\": 0\n }\n }\n}\n```\n\n## Authentication\n\nAll requests to the Hetzner Cloud API must be authenticated via a API token. Include your secret API token in every request you send to the API with the `Authorization` HTTP header.\n\nTo create a new API token for your Project, switch into the [Hetzner Console](https://console.hetzner.com/) choose a Project, go to `Security` → `API Tokens`, and generate a new token.\n\n**Example Authorization header**\n\n```http\nAuthorization: Bearer LRK9DAWQ1ZAEFSrCNEEzLCUwhYX1U3g7wMg4dTlkkDC96fyDuyJ39nVbVjCKSDfj\n```\n\n## Query Parameters\n\nThe API makes use of query parameters to sort and filter responses. The parameter names and values must be URI encoded according to [RFC2396](https://datatracker.ietf.org/doc/html/rfc2396). Query parameters of type `array` can be used multiple times:\n\n**Example query parameters for pagination**\n\n```\nhttps://api.hetzner.cloud/v1/certificates?page=1&page_size=12\n```\n\n**Example use of multiple values for a parameter**\n\n```\nhttps://api.hetzner.cloud/v1/certificates?type=uploaded&type=managed\n```\n\n**Example use of an encoded parameter**\n\n```\nhttps://api.hetzner.cloud/v1/certificates?label_selector=key%3Dvalue\n```\n\n## Errors\n\nErrors are indicated by HTTP status codes. Further, the response of the request which generated the error contains an error code, an error message, and, optionally, error details. The schema of the error details object depends on the error code.\n\nThe error response contains the following keys:\n\n| Keys | Meaning |\n| --------- | --------------------------------------------------------------------- |\n| `code` | Short string indicating the type of error (machine-parsable) |\n| `message` | Textual description on what has gone wrong |\n| `details` | An object providing for details on the error (schema depends on code) |\n\n**Example response**\n\n```json\n{\n \"error\": {\n \"code\": \"invalid_input\",\n \"message\": \"invalid input in field 'broken_field': is too long\",\n \"details\": {\n \"fields\": [\n {\n \"name\": \"broken_field\",\n \"messages\": [\"is too long\"]\n }\n ]\n }\n }\n}\n```\n\n### Error Codes\n\n| Status | Code | Description |\n| --- | --- | --- |\n| `400` | `json_error` | Invalid JSON input in your request. |\n| `401` | `unauthorized` | Request was made with an invalid or unknown token. |\n| `401` | `token_readonly` | The token is only allowed to perform GET requests. |\n| `403` | `forbidden` | Insufficient permissions for this request. |\n| `403` | `maintenance` | Cannot perform operation due to maintenance. |\n| `403` | `resource_limit_exceeded` | Error when exceeding the maximum quantity of a resource for an account. |\n| `404` | `not_found` | Entity not found. |\n| `405` | `method_not_allowed` | The request method is not allowed |\n| `409` | `uniqueness_error` | One or more of the objects fields must be unique. |\n| `409` | `conflict` | The resource has changed during the request, please retry. |\n| `410` | `deprecated_api_endpoint` | The API endpoint functionality was removed. |\n| `412` | `resource_unavailable` | The requested resource is currently unavailable (e.g. not available for order). |\n| `422` | `invalid_input` | Error while parsing or processing the input. |\n| `422` | `service_error` | Error within a service. |\n| `422` | `unsupported_error` | The corresponding resource does not support the Action. |\n| `423` | `locked` | The item you are trying to access is locked (there is already an Action running). |\n| `423` | `protected` | The Action you are trying to start is protected for this resource. |\n| `429` | `rate_limit_exceeded` | Error when sending too many requests. |\n| `500` | `server_error` | Error within the API backend. |\n| `503` | `unavailable` | A service or product is currently not available. |\n| `504` | `timeout` | The request could not be answered in time, please retry. |\n\n**invalid_input**\n\n```json\n{\n \"error\": {\n \"code\": \"invalid_input\",\n \"message\": \"invalid input in field 'broken_field': is too long\",\n \"details\": {\n \"fields\": [\n {\n \"name\": \"broken_field\",\n \"messages\": [\"is too long\"]\n }\n ]\n }\n }\n}\n```\n\n**uniqueness_error**\n\n```json\n{\n \"error\": {\n \"code\": \"uniqueness_error\",\n \"message\": \"SSH key with the same fingerprint already exists\",\n \"details\": {\n \"fields\": [\n {\n \"name\": \"public_key\"\n }\n ]\n }\n }\n}\n```\n\n**resource_limit_exceeded**\n\n```json\n{\n \"error\": {\n \"code\": \"resource_limit_exceeded\",\n \"message\": \"project limit exceeded\",\n \"details\": {\n \"limits\": [\n {\n \"name\": \"project_limit\"\n }\n ]\n }\n }\n}\n```\n\n**deprecated_api_endpoint**\n\n```json\n{\n \"error\": {\n \"code\": \"deprecated_api_endpoint\",\n \"message\": \"API functionality was removed\",\n \"details\": {\n \"announcement\": \"https://docs.hetzner.cloud/changelog#2023-07-20-foo-endpoint-is-deprecated\"\n }\n }\n}\n```\n\n## Actions\n\nActions represent asynchronous tasks within the API, targeting one or more resources. Triggering changes in the API may return a `running` action.\n\nAn action should be waited upon, until it reaches either the `success` or `error` state. Avoid polling the action's state too frequently to reduce the risk of exhausting your API requests and hitting the [rate limit](#description/rate-limiting).\n\nIf an action fails, it will contain details about the underlying error.\n\nOnce the asynchronous tasks have completed and the targeted resources are in a consistent state, the action is marked as succeeded.\n\nIn some cases, you may trigger multiple changes at once, and only wait for the returned actions at a later stage.\n\n## Labels\n\nLabels are `key/value` pairs that can be attached to all resources.\n\nValid label keys have two segments: an optional prefix and name, separated by a slash (`/`). The name segment is required and must be a string of 63 characters or less, beginning and ending with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between. The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS labels separated by dots (`.`), not longer than 253 characters in total, followed by a slash (`/`).\n\nValid label values must be a string of 63 characters or less and must be empty or begin and end with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between.\n\nThe `hetzner.cloud/` prefix is reserved and cannot be used.\n\n**Example Labels**\n\n```json\n{\n \"labels\": {\n \"environment\": \"development\",\n \"service\": \"backend\",\n \"example.com/my\": \"label\",\n \"just-a-key\": \"\"\n }\n}\n```\n\n## Label Selector\n\nFor resources with labels, you can filter resources by their labels using the label selector query language.\n\n| Expression | Meaning |\n| -------------------- | ---------------------------------------------------- |\n| `k==v` / `k=v` | Value of key `k` does equal value `v` |\n| `k!=v` | Value of key `k` does not equal value `v` |\n| `k` | Key `k` is present |\n| `!k` | Key `k` is not present |\n| `k in (v1,v2,v3)` | Value of key `k` is `v1`, `v2`, or `v3` |\n| `k notin (v1,v2,v3)` | Value of key `k` is neither `v1`, nor `v2`, nor `v3` |\n| `k1==v,!k2` | Value of key `k1` is `v` and key `k2` is not present |\n\n### Examples\n\n- Returns all resources that have a `env=production` label and that don't have a `type=database` label:\n\n `env=production,type!=database`\n\n- Returns all resources that have a `env=testing` or `env=staging` label:\n\n `env in (testing,staging)`\n\n- Returns all resources that don't have a `type` label:\n\n `!type`\n\n## Pagination\n\nResponses which return multiple items support pagination. If they do support pagination, it can be controlled with following query string parameters:\n\n- A `page` parameter specifies the page to fetch. The number of the first page is 1.\n- A `per_page` parameter specifies the number of items returned per page. The default value is 25, the maximum value is 50 except otherwise specified in the documentation.\n\nResponses contain a `Link` header with pagination information.\n\nAdditionally, if the response body is JSON and the root object is an object, that object has a `pagination` object inside the `meta` object with pagination information:\n\n**Example Pagination**\n\n```json\n{\n \"servers\": [...],\n \"meta\": {\n \"pagination\": {\n \"page\": 2,\n \"per_page\": 25,\n \"previous_page\": 1,\n \"next_page\": 3,\n \"last_page\": 4,\n \"total_entries\": 100\n }\n }\n}\n```\n\nThe keys `previous_page`, `next_page`, `last_page`, and `total_entries` may be `null` when on the first page, last page, or when the total number of entries is unknown.\n\n**Example Pagination Link header**\n\n```http\nLink: ; rel=\"prev\",\n ; rel=\"next\",\n ; rel=\"last\"\n```\n\nLine breaks have been added for display purposes only and responses may only contain some of the above `rel` values.\n\n## Rate Limiting\n\nAll requests, whether they are authenticated or not, are subject to rate limiting. If you have reached your limit, your requests will be handled with a `429 Too Many Requests` error. Burst requests are allowed. Responses contain several headers which provide information about your current rate limit status.\n\n- The `RateLimit-Limit` header contains the total number of requests you can perform per hour.\n- The `RateLimit-Remaining` header contains the number of requests remaining in the current rate limit time frame.\n- The `RateLimit-Reset` header contains a UNIX timestamp of the point in time when your rate limit will have recovered, and you will have the full number of requests available again.\n\nThe default limit is 3600 requests per hour and per Project. The number of remaining requests increases gradually. For example, when your limit is 3600 requests per hour, the number of remaining requests will increase by 1 every second.\n\n## Server Metadata\n\nYour Server can discover metadata about itself by doing a HTTP request to specific URLs. The following data is available:\n\n| Data | Format | Contents |\n| ----------------- | ------ | ------------------------------------------------------------ |\n| hostname | text | Name of the Server as set in the api |\n| instance-id | number | ID of the server |\n| public-ipv4 | text | Primary public IPv4 address |\n| private-networks | yaml | Details about the private networks the Server is attached to |\n| availability-zone | text | Name of the availability zone that Server runs in |\n| region | text | Network zone, e.g. eu-central |\n\n**Example: Summary**\n\n```shell\n$ curl http://169.254.169.254/hetzner/v1/metadata\n```\n\n```yaml\navailability-zone: hel1-dc2\nhostname: my-server\ninstance-id: 42\npublic-ipv4: 1.2.3.4\nregion: eu-central\n```\n\n**Example: Hostname**\n\n```shell\n$ curl http://169.254.169.254/hetzner/v1/metadata/hostname\nmy-server\n```\n\n**Example: Instance ID**\n\n```shell\n$ curl http://169.254.169.254/hetzner/v1/metadata/instance-id\n42\n```\n\n**Example: Public IPv4**\n\n```shell\n$ curl http://169.254.169.254/hetzner/v1/metadata/public-ipv4\n1.2.3.4\n```\n\n**Example: Private Networks**\n\n```shell\n$ curl http://169.254.169.254/hetzner/v1/metadata/private-networks\n```\n\n```yaml\n- ip: 10.0.0.2\n alias_ips: [10.0.0.3, 10.0.0.4]\n interface_num: 1\n mac_address: 86:00:00:2a:7d:e0\n network_id: 1234\n network_name: nw-test1\n network: 10.0.0.0/8\n subnet: 10.0.0.0/24\n gateway: 10.0.0.1\n- ip: 192.168.0.2\n alias_ips: []\n interface_num: 2\n mac_address: 86:00:00:2a:7d:e1\n network_id: 4321\n network_name: nw-test2\n network: 192.168.0.0/16\n subnet: 192.168.0.0/24\n gateway: 192.168.0.1\n```\n\n**Example: Availability Zone**\n\n```shell\n$ curl http://169.254.169.254/hetzner/v1/metadata/availability-zone\nhel1-dc2\n```\n\n**Example: Region**\n\n```shell\n$ curl http://169.254.169.254/hetzner/v1/metadata/region\neu-central\n```\n\n## Sorting\n\nSome responses which return multiple items support sorting. If they do support sorting the documentation states which fields can be used for sorting. You specify sorting with the `sort` query string parameter. You can sort by multiple fields. You can set the sort direction by appending `:asc` or `:desc` to the field name. By default, ascending sorting is used.\n\n**Example: Sorting**\n\n```\nhttps://api.hetzner.cloud/v1/actions?sort=status\nhttps://api.hetzner.cloud/v1/actions?sort=status:asc\nhttps://api.hetzner.cloud/v1/actions?sort=status:desc\nhttps://api.hetzner.cloud/v1/actions?sort=status:asc&sort=command:desc\n```\n\n## Deprecation Notices\n\nYou can find all announced deprecations in our [Changelog](/changelog).\n" servers: - url: https://api.hetzner.cloud/v1 security: - APIToken: [] tags: - name: Server Actions paths: /servers/actions: get: operationId: list_servers_actions summary: List Actions description: 'Returns all Action objects. You can `sort` the results by using the sort URI parameter, and filter them with the `status` and `id` parameter. ' tags: - Server Actions parameters: - description: 'Filter the actions by ID. May be used multiple times. The response will only contain actions matching the specified IDs. ' name: id in: query required: false schema: type: array items: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 - description: 'Sort actions by field and direction. May be used multiple times. For more information, see "[Sorting](#description/sorting)". ' name: sort in: query required: false schema: type: array items: type: string enum: - id - id:asc - id:desc - command - command:asc - command:desc - status - status:asc - status:desc - started - started:asc - started:desc - finished - finished:asc - finished:desc - description: 'Filter the actions by status. May be used multiple times. The response will only contain actions matching the specified statuses. ' name: status in: query required: false schema: type: array items: description: Status of the Action. type: string enum: - running - success - error - description: Page number to return. For more information, see "[Pagination](#description/pagination)". name: page in: query required: false schema: type: integer format: int64 default: 1 example: 1 - description: Maximum number of entries returned per page. For more information, see "[Pagination](#description/pagination)". name: per_page in: query required: false schema: type: integer format: int64 default: 25 example: 25 responses: '200': description: Request succeeded. content: application/json: schema: title: ActionListResponseWithMeta type: object properties: actions: type: array items: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error meta: title: ListMeta type: object properties: pagination: description: See "[Pagination](#description/pagination)" for more information. type: object properties: page: description: Current page number. type: integer format: int64 example: 3 per_page: description: Maximum number of entries returned per page. type: integer format: int64 example: 25 previous_page: description: Page number of the previous page. Can be null if the current page is the first one. type: integer format: int64 nullable: true example: 2 next_page: description: Page number of the next page. Can be null if the current page is the last one. type: integer format: int64 nullable: true example: 4 last_page: description: Page number of the last page available. Can be null if the current page is the last one. type: integer format: int64 nullable: true example: 4 total_entries: description: Total number of entries that exist for this query. Can be null if unknown. type: integer format: int64 nullable: true example: 100 required: - page - per_page - previous_page - next_page - last_page - total_entries required: - pagination required: - actions - meta 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\tactions, err := client.Server.Action.All(ctx, hcloud.ActionListOpts{})\n}" - lang: Python label: Python source: 'from __future__ import annotations from os import environ from hcloud import Client token = environ["HCLOUD_TOKEN"] client = Client(token=token) actions = client.servers.actions.get_all()' /servers/actions/{id}: get: operationId: get_servers_action summary: Get an Action description: 'Returns a specific Action object. ' tags: - Server Actions parameters: - description: ID of the Action. name: id in: path required: true schema: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '200': description: Request succeeded. content: application/json: schema: title: ActionResponse type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.Action.GetByID(ctx, 123)\n}" - lang: Python label: Python source: 'from __future__ import annotations from os import environ from hcloud import Client token = environ["HCLOUD_TOKEN"] client = Client(token=token) action = client.servers.actions.get_by_id(123)' /servers/{id}/actions: get: operationId: list_server_actions summary: List Actions for a Server description: 'Returns all Action objects for a Server. You can `sort` the results by using the sort URI parameter, and filter them with the `status` parameter. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 - description: 'Sort actions by field and direction. May be used multiple times. For more information, see "[Sorting](#description/sorting)". ' name: sort in: query required: false schema: type: array items: type: string enum: - id - id:asc - id:desc - command - command:asc - command:desc - status - status:asc - status:desc - started - started:asc - started:desc - finished - finished:asc - finished:desc - description: 'Filter the actions by status. May be used multiple times. The response will only contain actions matching the specified statuses. ' name: status in: query required: false schema: type: array items: description: Status of the Action. type: string enum: - running - success - error - description: Page number to return. For more information, see "[Pagination](#description/pagination)". name: page in: query required: false schema: type: integer format: int64 default: 1 example: 1 - description: Maximum number of entries returned per page. For more information, see "[Pagination](#description/pagination)". name: per_page in: query required: false schema: type: integer format: int64 default: 25 example: 25 responses: '200': description: Request succeeded. content: application/json: schema: title: ActionListResponseWithMeta type: object properties: actions: type: array items: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error meta: title: ListMeta type: object properties: pagination: description: See "[Pagination](#description/pagination)" for more information. type: object properties: page: description: Current page number. type: integer format: int64 example: 3 per_page: description: Maximum number of entries returned per page. type: integer format: int64 example: 25 previous_page: description: Page number of the previous page. Can be null if the current page is the first one. type: integer format: int64 nullable: true example: 2 next_page: description: Page number of the next page. Can be null if the current page is the last one. type: integer format: int64 nullable: true example: 4 last_page: description: Page number of the last page available. Can be null if the current page is the last one. type: integer format: int64 nullable: true example: 4 total_entries: description: Total number of entries that exist for this query. Can be null if unknown. type: integer format: int64 nullable: true example: 100 required: - page - per_page - previous_page - next_page - last_page - total_entries required: - pagination required: - actions - meta examples: default: value: actions: - id: 13 command: start_server status: success progress: 100 started: '2016-01-30T23:55:00Z' finished: '2016-01-30T23:56:00Z' resources: - id: 42 type: server error: code: action_failed message: Action failed meta: pagination: page: 1 per_page: 25 previous_page: null next_page: null last_page: 1 total_entries: 21 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] /servers/{id}/actions/add_to_placement_group: post: operationId: add_server_to_placement_group summary: Add a Server to a Placement Group description: 'Adds a Server to a Placement Group. Server must be powered off for this command to succeed. #### Operation specific errors | Status | Code | Description | | --- | --- | --- | | `422` | `server_not_stopped` | The action requires a stopped server | | `422` | `already_in_placement_group` | The server is already part of a placement group | ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 requestBody: required: true content: application/json: schema: title: AddToPlacementGroupRequest type: object properties: placement_group: description: ID of Placement Group the Server should be added to. type: integer format: int64 example: 1 required: - placement_group responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: add_to_placement_group status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.AddToPlacementGroup(ctx, &hcloud.Server{ID: 123}, &hcloud.PlacementGroup{ID: 1})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.placement_groups import PlacementGroup\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.add_to_placement_group(\n server=Server(id=123), placement_group=PlacementGroup(id=1)\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server add-to-placement-group --placement-group 1 $SERVER /servers/{id}/actions/attach_iso: post: operationId: attach_server_iso summary: Attach an ISO to a Server description: 'Attaches an ISO to a Server. The Server will immediately see it as a new disk. An already attached ISO will automatically be detached before the new ISO is attached. Servers with attached ISOs have a modified boot order: They will try to boot from the ISO first before falling back to hard disk. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 requestBody: required: true content: application/json: schema: type: object properties: iso: description: ID or name of ISO to attach to the Server as listed in GET `/isos`. type: string example: FreeBSD-11.0-RELEASE-amd64-dvd1 required: - iso responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: attach_iso status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.AttachISO(ctx, &hcloud.Server{ID: 123}, &hcloud.ISO{\n\t\tName: \"FreeBSD-11.0-RELEASE-amd64-dvd1\",\n\t})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.isos import Iso\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.attach_iso(\n server=Server(id=123), iso=Iso(name=\"FreeBSD-11.0-RELEASE-amd64-dvd1\")\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server attach-iso $SERVER "FreeBSD-11.0-RELEASE-amd64-dvd1" /servers/{id}/actions/attach_to_network: post: operationId: attach_server_to_network summary: Attach a Server to a Network description: 'Attaches a Server to a network. This will complement the fixed public Server interface by adding an additional ethernet interface to the Server which is connected to the specified network. The Server will get an IP auto assigned from a subnet of type `server` in the same `network_zone`. Using the `alias_ips` attribute you can also define one or more additional IPs to the Servers. Please note that you will have to configure these IPs by hand on your Server since only the primary IP will be given out by DHCP. #### Operation specific errors | Status | Code | Description | | --- | --- | --- | | `422` | `server_already_attached` | The server is already attached to the network | | `422` | `ip_not_available` | The provided Network IP is not available | | `422` | `no_subnet_available` | No Subnet or IP is available for the Server within the network | | `422` | `networks_overlap` | The network IP range overlaps with one of the server networks | ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 requestBody: required: true content: application/json: schema: title: AttachToNetworkRequest type: object properties: network: description: ID of an existing network to attach the Server to. type: integer format: int64 example: 4711 ip: description: IP to request to be assigned to this Server; if you do not provide this then you will be auto assigned an IP address. type: string example: 10.0.1.1 alias_ips: description: Additional IPs to be assigned to this Server. type: array items: type: string example: - 10.0.1.2 ip_range: description: 'IP range in CIDR block notation of the subnet to attach to. This allows for auto assigning an IP address for a specific subnet. Providing `ip` that is not part of `ip_range` will result in an error. ' type: string example: 10.0.1.0/24 required: - network responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: attach_to_network status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server - id: 4711 type: network error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"net\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.AttachToNetwork(ctx, &hcloud.Server{ID: 123}, hcloud.ServerAttachToNetworkOpts{\n\t\tAliasIPs: []net.IP{\n\t\t\tnet.ParseIP(\"10.0.1.2\"),\n\t\t},\n\t\tIP: net.ParseIP(\"10.0.1.1\"),\n\t\tNetwork: &hcloud.Network{\n\t\t\tID: 4711,\n\t\t},\n\t})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.networks import Network\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.attach_to_network(\n server=Server(id=123),\n alias_ips=[\"10.0.1.2\"],\n ip=\"10.0.1.1\",\n network=Network(id=4711),\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: "hcloud server attach-to-network $SERVER \\\n --alias-ips 10.0.1.2 \\\n --ip 10.0.1.1 \\\n --network 4711" /servers/{id}/actions/change_alias_ips: post: operationId: change_server_alias_ips summary: Change alias IPs of a Network description: 'Changes the alias IPs of an already attached Network. Note that the existing aliases for the specified Network will be replaced with these provided in the request body. So if you want to add an alias IP, you have to provide the existing ones from the Network plus the new alias IP in the request body. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 requestBody: required: true content: application/json: schema: type: object properties: network: description: ID of an existing Network already attached to the Server. type: integer format: int64 example: 4711 alias_ips: description: New alias IPs to set for this Server. type: array items: type: string example: - 10.0.1.2 required: - network - alias_ips responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: change_alias_ips status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server - id: 4711 type: network error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"net\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.ChangeAliasIPs(ctx, &hcloud.Server{ID: 123}, hcloud.ServerChangeAliasIPsOpts{\n\t\tAliasIPs: []net.IP{\n\t\t\tnet.ParseIP(\"10.0.1.2\"),\n\t\t},\n\t\tNetwork: &hcloud.Network{\n\t\t\tID: 4711,\n\t\t},\n\t})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.networks import Network\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.change_alias_ips(\n server=Server(id=123),\n alias_ips=[\"10.0.1.2\"],\n network=Network(id=4711),\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: "hcloud server change-alias-ips $SERVER \\\n --alias-ips 10.0.1.2 \\\n --network 4711" /servers/{id}/actions/change_dns_ptr: post: operationId: change_server_dns_ptr summary: Change reverse DNS entry for this Server description: 'Changes the hostname that will appear when getting the hostname belonging to the primary IPs (IPv4 and IPv6) of this Server. Floating IPs assigned to the Server are not affected by this. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 requestBody: description: Select the IP address for which to change the DNS entry by passing `ip`. It can be either IPv4 or IPv6. The target hostname is set by passing `dns_ptr`, which must be a fully qualified domain name (FQDN) without trailing dot. required: true content: application/json: schema: type: object properties: ip: description: 'Single IPv4 or IPv6 address to create pointer for. ' type: string example: 2001:db8::1 dns_ptr: description: 'Domain Name to point to. PTR record content used for reverse DNS. Set to null to reset (IPv4) to the default value or remove (IPv6) the record. ' type: string nullable: true example: server.example.com required: - ip responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: change_dns_ptr status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.ChangeDNSPtr(ctx, &hcloud.Server{ID: 123}, \"1.2.3.4\", hcloud.Ptr(\"server01.example.com\"))\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.change_dns_ptr(\n server=Server(id=123), dns_ptr=\"server01.example.com\", ip=\"1.2.3.4\"\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: "hcloud server set-rdns $SERVER \\\n --ip 1.2.3.4 \\\n --hostname server01.example.com" /servers/{id}/actions/change_protection: post: operationId: change_server_protection summary: Change Server Protection description: 'Changes the protection configuration of the Server. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 requestBody: required: true content: application/json: schema: type: object properties: delete: description: If true, prevents the Server from being deleted (currently delete and rebuild attribute needs to have the same value). type: boolean example: true rebuild: description: If true, prevents the Server from being rebuilt (currently delete and rebuild attribute needs to have the same value). type: boolean example: true responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: change_protection status: success progress: 100 started: '2016-01-30T23:55:00Z' finished: '2016-01-30T23:56:00Z' resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.ChangeProtection(ctx, &hcloud.Server{ID: 123}, hcloud.ServerChangeProtectionOpts{\n\t\tDelete: hcloud.Ptr(true),\n\t\tRebuild: hcloud.Ptr(true),\n\t})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.change_dns_ptr(\n server=Server(id=123), dns_ptr=\"server01.example.com\", ip=\"1.2.3.4\"\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: 'hcloud server enable-protection $SERVER delete rebuild hcloud server disable-protection $SERVER delete rebuild' /servers/{id}/actions/change_type: post: operationId: change_server_type summary: Change the Type of a Server description: 'Changes the type (Cores, RAM and disk sizes) of a Server. Server must be powered off for this command to succeed. This copies the content of its disk, and starts it again. You can only migrate to Server types with the same `storage_type` and equal or bigger disks. Shrinking disks is not possible as it might destroy data. If the disk gets upgraded, the Server type can not be downgraded any more. If you plan to downgrade the Server type, set `upgrade_disk` to `false`. #### Operation specific errors | Status | Code | Description | | --- | --- | --- | | `422` | `invalid_server_type` | The server type does not fit for the given server or is deprecated | | `422` | `server_not_stopped` | The action requires a stopped server | ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 requestBody: required: true content: application/json: schema: type: object properties: upgrade_disk: description: If false, do not upgrade the disk (this allows downgrading the Server type later). type: boolean example: true server_type: description: ID or name of Server type the Server should migrate to. type: string example: cpx22 required: - upgrade_disk - server_type responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: change_server_type status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.ChangeType(ctx, &hcloud.Server{ID: 123}, hcloud.ServerChangeTypeOpts{\n\t\tServerType: &hcloud.ServerType{Name: \"cpx22\"},\n\t\tUpgradeDisk: true,\n\t})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.server_types import ServerType\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.change_type(\n server=Server(id=123),\n server_type=ServerType(name=\"cpx22\"),\n upgrade_disk=True,\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server change-type --keep-disk $SERVER cpx32 /servers/{id}/actions/create_image: post: operationId: create_server_image summary: Create Image from a Server description: 'Creates an Image (snapshot) from a Server by copying the contents of its disks. This creates a snapshot of the current state of the disk and copies it into an Image. If the Server is currently running you must make sure that its disk content is consistent. Otherwise, the created Image may not be readable. To make sure disk content is consistent, we recommend to shut down the Server prior to creating an Image. You can either create a `backup` Image that is bound to the Server and therefore will be deleted when the Server is deleted, or you can create a `snapshot` Image which is completely independent of the Server it was created from and will survive Server deletion. Backup Images are only available when the backup option is enabled for the Server. Snapshot Images are billed on a per GB basis. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 requestBody: required: true content: application/json: schema: title: CreateImageRequest type: object properties: description: description: Description of the Image, will be auto-generated if not set. type: string example: my image type: description: Type of Image to create. type: string enum: - snapshot - backup default: snapshot example: snapshot labels: description: 'User-defined labels (`key/value` pairs) for the Resource. For more information, see "[Labels](#description/labels)". ' type: object additionalProperties: type: string example: environment: prod example.com/my: label just-a-key: '' responses: '201': description: Request succeeded. content: application/json: schema: type: object properties: image: type: object properties: id: description: ID of the [Image](#tag/images). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Image. type: string enum: - system - app - snapshot - backup example: snapshot status: description: Status of the Image. type: string enum: - available - creating - unavailable example: available name: description: Unique identifier of the Image. This value is only set for system Images. type: string nullable: true example: ubuntu-24.04 description: description: Description of the Image. type: string example: Ubuntu 24.04 Standard 64 bit image_size: description: Size of the Image file in our storage in GB. For snapshot Images this is the value relevant for calculating costs for the Image. type: number nullable: true example: 2.3 disk_size: description: Size of the disk contained in the Image in GB. type: number example: 10 created: description: Point in time when the Resource was created (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' created_from: description: Information about the Server the Image was created from. type: object nullable: true properties: id: description: ID of the Server the Image was created from. type: integer format: int64 example: 1 name: description: Server name at the time the Image was created. type: string example: Server required: - id - name bound_to: description: ID of Server the Image is bound to. Only set for Images of type `backup`. type: integer format: int64 nullable: true example: null os_flavor: description: Flavor of operating system contained in the Image. type: string enum: - ubuntu - centos - debian - fedora - rocky - alma - opensuse - unknown example: ubuntu os_version: description: Operating system version. type: string nullable: true example: '24.04' rapid_deploy: description: Indicates that rapid deploy of the Image is available. type: boolean example: false protection: description: Protection configuration for the Resource. type: object properties: delete: description: Prevent the Resource from being deleted. type: boolean example: false required: - delete deprecated: description: Point in time when the Image is considered to be deprecated (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time nullable: true example: '2018-02-28T00:00:00Z' deleted: description: Point in time where the Image was deleted (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string nullable: true example: null labels: description: 'User-defined labels (`key/value` pairs) for the Resource. For more information, see "[Labels](#description/labels)". ' type: object additionalProperties: type: string example: environment: prod example.com/my: label just-a-key: '' architecture: description: 'CPU architecture compatible with the Image. ' type: string enum: - x86 - arm example: x86 required: - id - type - status - name - description - image_size - disk_size - created - created_from - bound_to - os_flavor - os_version - protection - deprecated - deleted - labels - architecture action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error examples: default: value: image: id: 4711 type: snapshot status: creating name: null description: my image image_size: 2.3 disk_size: 10 created: '2016-01-30T23:50:00Z' created_from: id: 1 name: Server bound_to: null os_flavor: ubuntu os_version: '20.04' rapid_deploy: false protection: delete: false deprecated: '2018-02-28T00:00:00Z' deleted: null labels: key: value architecture: x86 action: id: 13 command: create_image status: success progress: 100 started: '2016-01-30T23:55:00Z' finished: '2016-01-30T23:56:00Z' resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\tresult, _, err := client.Server.CreateImage(ctx, &hcloud.Server{ID: 123}, &hcloud.ServerCreateImageOpts{\n\t\tDescription: hcloud.Ptr(\"my image\"),\n\t\tLabels: map[string]string{\n\t\t\t\"environment\": \"prod\",\n\t\t\t\"example.com/my\": \"label\",\n\t\t\t\"just-a-key\": \"\",\n\t\t},\n\t\tType: hcloud.ImageTypeSnapshot,\n\t})\n\n\terr = client.Action.WaitFor(ctx, result.Action)\n\n\timage := result.Image\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.create_image(\n server=Server(id=123),\n description=\"my image\",\n labels={\n \"environment\": \"prod\",\n \"example.com/my\": \"label\",\n \"just-a-key\": \"\",\n },\n type=\"snapshot\",\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: "hcloud server create-image $SERVER \\\n --description \"my image\" \\\n --label \"environment=prod\" \\\n --label \"example.com/my=label\" \\\n --label \"just-a-key=\" \\\n --type snapshot" /servers/{id}/actions/detach_from_network: post: operationId: detach_server_from_network summary: Detach a Server from a Network description: 'Detaches a Server from a network. The interface for this network will vanish. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 requestBody: required: true content: application/json: schema: title: DetachFromNetworkRequest type: object properties: network: description: ID of an existing network to detach the Server from. type: integer format: int64 example: 4711 required: - network responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: detach_from_network status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server - id: 4711 type: network error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.DetachFromNetwork(ctx, &hcloud.Server{ID: 123}, hcloud.ServerDetachFromNetworkOpts{\n\t\tNetwork: &hcloud.Network{ID: 4711},\n\t})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.networks import Network\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.detach_from_network(\n server=Server(id=123), network=Network(id=4711)\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server detach-from-network --network 4711 $SERVER /servers/{id}/actions/detach_iso: post: operationId: detach_server_iso summary: Detach an ISO from a Server description: 'Detaches an ISO from a Server. In case no ISO Image is attached to the Server, the status of the returned Action is immediately set to `success`. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: detach_iso status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.DetachISO(ctx, &hcloud.Server{ID: 123})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.detach_iso(\n server=Server(id=123),\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server detach-iso $SERVER /servers/{id}/actions/disable_backup: post: operationId: disable_server_backup summary: Disable Backups for a Server description: 'Disables the automatic backup option and deletes all existing Backups for a Server. No more additional charges for backups will be made. Caution: This immediately removes all existing backups for the Server! ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: disable_backup status: success progress: 100 started: '2016-01-30T23:55:00Z' finished: '2016-01-30T23:56:00Z' resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.DisableBackup(ctx, &hcloud.Server{ID: 123})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.disable_backup(\n server=Server(id=123),\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server disable-backup $SERVER /servers/{id}/actions/disable_rescue: post: operationId: disable_server_rescue summary: Disable Rescue Mode for a Server description: 'Disables the Hetzner Rescue System for a Server. This makes a Server start from its disks on next reboot. Rescue Mode is automatically disabled when you first boot into it or if you do not use it for 60 minutes. Disabling rescue mode will not reboot your Server — you will have to do this yourself. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: disable_rescue status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.DisableRescue(ctx, &hcloud.Server{ID: 123})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.disable_rescue(\n server=Server(id=123),\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server disable-rescue $SERVER /servers/{id}/actions/enable_backup: post: operationId: enable_server_backup summary: Enable and Configure Backups for a Server description: 'Enables and configures the automatic daily backup option for the Server. Enabling automatic backups will increase the price of the Server by 20%. In return, you will get seven slots where Images of type backup can be stored. Backups are automatically created daily. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: enable_backup status: success progress: 100 started: '2016-01-30T23:55:00Z' finished: '2016-01-30T23:56:00Z' resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.EnableBackup(ctx, &hcloud.Server{ID: 123}, \"\")\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.enable_backup(\n server=Server(id=123),\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server enable-backup $SERVER /servers/{id}/actions/enable_rescue: post: operationId: enable_server_rescue summary: Enable Rescue Mode for a Server description: 'Enable the Hetzner Rescue System for this Server. The next time a Server with enabled rescue mode boots it will start a special minimal Linux distribution designed for repair and reinstall. In case a Server cannot boot on its own you can use this to access a Server’s disks. Rescue Mode is automatically disabled when you first boot into it or if you do not use it for 60 minutes. Enabling rescue mode will not [reboot](https://docs.hetzner.cloud/#server-actions-soft-reboot-a-server) your Server — you will have to do this yourself. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 requestBody: required: true content: application/json: schema: type: object properties: type: description: Type of rescue system to boot. type: string enum: - linux64 default: linux64 ssh_keys: description: Array of SSH key IDs which should be injected into the rescue system. type: array items: type: integer format: int64 example: - 2323 responses: '201': description: Request succeeded. content: application/json: schema: description: 'The `root_password` key in the reply contains the root password that can be used to access the booted rescue system. ' type: object properties: root_password: description: Password that will be set for this Server once the Action succeeds. type: string example: zCWbFhnu950dUTko5f40 action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error examples: default: value: root_password: zCWbFhnu950dUTko5f40 action: id: 13 command: enable_rescue status: success progress: 100 started: '2016-01-30T23:55:00Z' finished: '2016-01-30T23:56:00Z' resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\tresult, _, err := client.Server.EnableRescue(ctx, &hcloud.Server{ID: 123}, hcloud.ServerEnableRescueOpts{\n\t\tSSHKeys: []*hcloud.SSHKey{{\n\t\t\tID: 2323,\n\t\t}},\n\t\tType: hcloud.ServerRescueTypeLinux64,\n\t})\n\n\terr = client.Action.WaitFor(ctx, result.Action)\n\n\trootPassword := result.RootPassword\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\nfrom hcloud.ssh_keys import SSHKey\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.enable_rescue(\n server=Server(id=123),\n ssh_keys=[SSHKey(id=2323)],\n type=\"linux64\",\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server enable-rescue $SERVER /servers/{id}/actions/poweroff: post: operationId: poweroff_server summary: Power off a Server description: 'Cuts power to the Server. This forcefully stops it without giving the Server operating system time to gracefully stop. May lead to data loss, equivalent to pulling the power cord. Power off should only be used when shutdown does not work. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: stop_server status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.Poweroff(ctx, &hcloud.Server{ID: 123})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.power_off(\n server=Server(id=123),\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server poweroff $SERVER /servers/{id}/actions/poweron: post: operationId: poweron_server summary: Power on a Server description: 'Starts a Server by turning its power on. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: start_server status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.Poweron(ctx, &hcloud.Server{ID: 123})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.power_on(\n server=Server(id=123),\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server poweron $SERVER /servers/{id}/actions/reboot: post: operationId: reboot_server summary: Soft-reboot a Server description: 'Reboots a Server gracefully by sending an ACPI request. The Server operating system must support ACPI and react to the request, otherwise the Server will not reboot. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: reboot_server status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.Reboot(ctx, &hcloud.Server{ID: 123})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.reboot(\n server=Server(id=123),\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server reboot $SERVER /servers/{id}/actions/rebuild: post: operationId: rebuild_server summary: Rebuild a Server from an Image description: 'Rebuilds a Server overwriting its disk with the content of an Image, thereby **destroying all data** on the target Server The Image can either be one you have created earlier (`backup` or `snapshot` Image) or it can be a completely fresh `system` Image provided by us. You can get a list of all available Images with `GET /images`. Your Server will automatically be powered off before the rebuild command executes. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 requestBody: description: To select which Image to rebuild from you can either pass an ID or a name as the `image` argument. Passing a name only works for `system` Images since the other Image types do not have a name set. required: true content: application/json: schema: title: RebuildServerRequest type: object properties: image: description: ID or name of Image to rebuilt from. type: string example: ubuntu-24.04 user_data: description: Cloud-Init user data to use during Server rebuild. This field is limited to 32KiB. If not specified, the Server's previous user_data value will be re-used (if any was set). type: string example: '#cloud-config runcmd: - [touch, /root/cloud-init-worked] ' required: - image responses: '201': description: Request succeeded. content: application/json: schema: type: object properties: root_password: description: New root password when not using SSH keys. type: string nullable: true action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error examples: default: value: action: id: 13 command: rebuild_server status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server error: code: action_failed message: Action failed root_password: null 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\tresult, _, err := client.Server.RebuildWithResult(ctx, &hcloud.Server{ID: 123}, hcloud.ServerRebuildOpts{\n\t\tImage: &hcloud.Image{Name: \"ubuntu-24.04\"},\n\t})\n\n\terr = client.Action.WaitFor(ctx, result.Action)\n\n\trootPassword := result.RootPassword\n}" - lang: Python label: Python source: 'from __future__ import annotations from os import environ from hcloud import Client from hcloud.images import Image from hcloud.servers import Server token = environ["HCLOUD_TOKEN"] client = Client(token=token) action = client.servers.rebuild(server=Server(id=123), image=Image(name="ubuntu-24.04")) action.wait_until_finished()' - lang: Shell label: CLI source: hcloud server rebuild --image ubuntu-24.04 $SERVER /servers/{id}/actions/remove_from_placement_group: post: operationId: remove_server_from_placement_group summary: Remove from Placement Group description: 'Removes a Server from a Placement Group. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: remove_from_placement_group status: success progress: 100 started: '2016-01-30T23:55:00Z' finished: '2016-01-30T23:56:00Z' resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.RemoveFromPlacementGroup(ctx, &hcloud.Server{ID: 123})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.remove_from_placement_group(\n server=Server(id=123),\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server remove-from-placement-group $SERVER /servers/{id}/actions/request_console: post: operationId: request_server_console summary: Request Console for a Server description: 'Requests credentials for remote access via VNC over websocket to keyboard, monitor, and mouse for a Server. The provided URL is valid for 1 minute, after this period a new url needs to be created to connect to the Server. How long the connection is open after the initial connect is not subject to this timeout. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '201': description: Request succeeded. content: application/json: schema: type: object properties: wss_url: description: URL of websocket proxy to use; this includes a token which is valid for a limited time only. type: string example: wss://console.hetzner.cloud/?server_id=1&token=3db32d15-af2f-459c-8bf8-dee1fd05f49c password: description: VNC password to use for this connection (this password only works in combination with a wss_url with valid token). type: string example: 9MQaTg2VAGI0FIpc10k3UpRXcHj2wQ6x action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - wss_url - password - action examples: default: value: wss_url: wss://console.hetzner.cloud/?server_id=1&token=3db32d15-af2f-459c-8bf8-dee1fd05f49c password: 9MQaTg2VAGI0FIpc10k3UpRXcHj2wQ6x action: id: 13 command: request_console status: success progress: 100 started: '2016-01-30T23:55:00Z' finished: '2016-01-30T23:56:00Z' resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\tresult, _, err := client.Server.RequestConsole(ctx, &hcloud.Server{ID: 123})\n\n\terr = client.Action.WaitFor(ctx, result.Action)\n\n\twssUrl, password := result.WSSURL, result.Password\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\nresponse = client.servers.request_console(\n server=Server(id=123),\n)\n\nresponse.action.wait_until_finished()\n\nwss_url, password = response.wss_url, response.password" - lang: Shell label: CLI source: hcloud server request-console $SERVER /servers/{id}/actions/reset: post: operationId: reset_server summary: Reset a Server description: 'Cuts power to a Server and starts it again. This forcefully stops it without giving the Server operating system time to gracefully stop. This may lead to data loss, it’s equivalent to pulling the power cord and plugging it in again. Reset should only be used when reboot does not work. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: reset_server status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.Reset(ctx, &hcloud.Server{ID: 123})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.reset(\n server=Server(id=123),\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server reset $SERVER /servers/{id}/actions/reset_password: post: operationId: reset_server_password summary: Reset root Password of a Server description: 'Resets the root password. Only works for Linux systems that are running the qemu guest agent. Server must be powered on (status `running`) in order for this operation to succeed. This will generate a new password for this Server and return it. If this does not succeed you can use the rescue system to netboot the Server and manually change your Server password by hand. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '201': description: Request succeeded. content: application/json: schema: description: 'The `root_password` key in the reply contains the new root password that will be active if the Action succeeds. ' type: object properties: root_password: description: Password that will be set for this Server once the Action succeeds. type: string example: zCWbFhnu950dUTko5f40 action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error examples: default: value: root_password: zCWbFhnu950dUTko5f40 action: id: 13 command: reset_password status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\tresult, _, err := client.Server.ResetPassword(ctx, &hcloud.Server{ID: 123})\n\n\terr = client.Action.WaitFor(ctx, result.Action)\n\n\trootPassword := result.RootPassword\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\nresponse = client.servers.reset_password(\n server=Server(id=123),\n)\n\nresponse.action.wait_until_finished()\n\nroot_password = response.root_password" - lang: Shell label: CLI source: hcloud server reset-password $SERVER /servers/{id}/actions/shutdown: post: operationId: shutdown_server summary: Shutdown a Server description: 'Shuts down a Server gracefully by sending an ACPI shutdown request. The Server operating system must support ACPI and react to the request, otherwise the Server will not shut down. Please note that the `action` status in this case only reflects whether the action was sent to the server. It does not mean that the server actually shut down successfully. If you need to ensure that the server is off, use the `poweroff` action. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '201': description: Request succeeded. content: application/json: schema: title: ActionResponse description: 'Response for a created [Action](#description/actions). Make sure to wait for the [Action](#description/actions) completion to ensure your changes are applied. ' type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: shutdown_server status: running progress: 0 started: '2016-01-30T23:50:00Z' finished: null resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] x-codeSamples: - lang: Go label: Go source: "package examples\n\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n)\n\nfunc main() {\n\ttoken := os.Getenv(\"HCLOUD_TOKEN\")\n\n\tclient := hcloud.NewClient(hcloud.WithToken(token))\n\tctx := context.TODO()\n\n\taction, _, err := client.Server.Shutdown(ctx, &hcloud.Server{ID: 123})\n\n\terr = client.Action.WaitFor(ctx, action)\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\naction = client.servers.shutdown(\n server=Server(id=123),\n)\n\naction.wait_until_finished()" - lang: Shell label: CLI source: hcloud server shutdown $SERVER /servers/{id}/actions/{action_id}: get: deprecated: true operationId: get_server_action summary: Get an Action for a Server description: '**Deprecated**: This operation is deprecated, see our [changelog](https://docs.hetzner.cloud/changelog#2026-04-30-deprecate-get-resource-action-endpoints) for more details. Returns a specific Action object for a Server. ' tags: - Server Actions parameters: - description: ID of the Server. name: id in: path required: true schema: description: ID of the [Server](#tag/servers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 - description: ID of the Action. name: action_id in: path required: true schema: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '200': description: Request succeeded. content: application/json: schema: title: ActionResponse type: object properties: action: title: Action type: object properties: id: description: ID of the [Action](#description/actions). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 command: description: Command executed in the Action. type: string example: start_resource status: description: Status of the Action. type: string enum: - running - success - error started: description: Point in time when the Action was started (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2016-01-30T23:55:00Z' finished: description: Point in time when the Action was finished (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). Only set if the Action is finished otherwise null. type: string format: date-time example: '2016-01-30T23:55:00Z' nullable: true progress: description: Progress of the Action in percent. type: integer format: int32 example: 100 resources: description: Resources the Action relates to. type: array items: type: object properties: id: description: ID of the Resource. type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 type: description: Type of the Resource. type: string example: server required: - id - type error: description: Error message for the Action if an error occurred, otherwise null. type: object nullable: true properties: code: description: Fixed error code for machines. type: string example: action_failed message: description: Error message for humans. type: string example: Action failed required: - code - message required: - id - command - status - progress - started - finished - resources - error required: - action examples: default: value: action: id: 13 command: start_server status: success progress: 100 started: '2016-01-30T23:55:00Z' finished: '2016-01-30T23:56:00Z' resources: - id: 42 type: server error: code: action_failed message: Action failed 4xx: description: Request failed with a user error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: unauthorized message: unable to authenticate details: null 5xx: description: Request failed with a server error. content: application/json: schema: type: object properties: error: type: object properties: code: description: Error code for machines. type: string message: description: Error message for humans. type: string details: description: Details about the error. type: object nullable: true required: - code - message required: - error example: error: code: timeout message: request timeout details: null security: - APIToken: [] components: securitySchemes: APIToken: type: http scheme: bearer x-tagGroups: - name: Actions tags: - Actions - name: Servers tags: - Servers - Server Actions - Server Types - Images - Image Actions - ISOs - Placement Groups - Primary IPs - Primary IP Actions - name: Volumes tags: - Volumes - Volume Actions - name: Floating IPs tags: - Floating IPs - Floating IP Actions - name: Firewalls tags: - Firewalls - Firewall Actions - name: Load Balancers tags: - Load Balancers - Load Balancer Actions - Load Balancer Types - name: Networks tags: - Networks - Network Actions - name: DNS tags: - Zones - Zone Actions - Zone RRSets - Zone RRSet Actions - name: Security tags: - Certificates - Certificate Actions - SSH Keys - name: Locations tags: - Locations - Data Centers - name: Billing tags: - Pricing