openapi: 3.0.3 info: title: Hetzner Cloud Actions Load Balancers 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: Load Balancers paths: /load_balancers: get: operationId: list_load_balancers summary: List Load Balancers description: 'Gets all existing Load Balancers that you have available. ' tags: - Load Balancers parameters: - description: 'Sort resources 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 - name - name:asc - name:desc - created - created:asc - created:desc - description: 'Filter resources by their name. The response will only contain the resources matching exactly the specified name. ' name: name in: query required: false schema: type: string - description: 'Filter resources by labels. The response will only contain resources matching the label selector. For more information, see "[Label Selector](#description/label-selector)". ' name: label_selector in: query required: false schema: type: string - 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: type: object properties: load_balancers: type: array items: type: object properties: id: description: ID of the [Load Balancer](#tag/load-balancers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 name: description: Name of the Resource. Must be unique per Project. type: string example: my-resource public_net: description: Public network information. type: object properties: enabled: description: Public Interface enabled or not. type: boolean ipv4: description: IP address (v4). type: object properties: ip: description: IP address (v4) of this Load Balancer. type: string nullable: true example: 1.2.3.4 dns_ptr: description: Reverse DNS PTR entry for the IPv4 address of this Load Balancer. type: string nullable: true example: lb1.example.com required: - ip - dns_ptr ipv6: description: IP address (v6). type: object properties: ip: description: IP address (v6) of this Load Balancer. type: string nullable: true example: 2001:db8::1 dns_ptr: description: Reverse DNS PTR entry for the IPv6 address of this Load Balancer. type: string nullable: true example: lb1.example.com required: - ip - dns_ptr required: - enabled - ipv4 - ipv6 private_net: description: Private networks information. type: array items: type: object properties: network: description: ID of the Network. type: integer format: int64 example: 4711 ip: description: IP address (v4) of this Load Balancer in this Network. type: string example: 10.0.0.2 required: - network - ip location: type: object properties: id: description: ID of the [Location](#tag/locations). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 name: description: Unique identifier of the [Location](#tag/locations). type: string pattern: ^[a-z0-9]+(-?[a-z0-9]*)*$ example: fsn1 description: description: Human readable description of the [Location](#tag/locations). type: string example: Falkenstein DC Park 1 country: description: 'Country the [Location](#tag/locations) resides in. ISO 3166-1 alpha-2 code of the country. ' type: string example: DE city: description: 'Name of the closest city to the [Location](#tag/locations). City name or city name and state in short form. E.g. `Falkenstein` or `Ashburn, VA`. ' type: string example: Falkenstein latitude: description: Latitude of the city closest to the [Location](#tag/locations). type: number format: double example: 50.47612 longitude: description: Longitude of the city closest to the [Location](#tag/locations). type: number format: double example: 12.370071 network_zone: description: Name of the Network Zone this [Location](#tag/locations) resides in. type: string pattern: ^[a-z0-9]+(-?[a-z0-9]*)*$ example: eu-central required: - id - name - description - country - city - latitude - longitude - network_zone load_balancer_type: type: object properties: id: description: ID of the Load Balancer type. type: integer format: int64 example: 1 name: description: Unique identifier of the Load Balancer type. type: string example: lb11 description: description: Description of the Load Balancer type. type: string example: LB11 max_connections: description: Number of maximum simultaneous open connections. type: integer format: int64 example: 20000 max_services: description: Number of services a Load Balancer of this type can have. type: integer format: int64 example: 5 max_targets: description: Number of targets a single Load Balancer can have. type: integer format: int64 example: 25 max_assigned_certificates: description: Number of SSL Certificates that can be assigned to a single Load Balancer. type: integer format: int64 example: 10 deprecated: description: Point in time when the Load Balancer type is deprecated (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time nullable: true example: '2016-01-30T23:50:00Z' prices: description: Price per [Location](#tag/locations). type: array items: type: object properties: location: description: Name of the [Location](#tag/locations) the price is for. type: string example: fsn1 price_hourly: description: Hourly price in this [Location](#tag/locations). type: object properties: net: description: Price without VAT. type: string format: decimal example: '1.0000' gross: description: Price with VAT added. type: string format: decimal example: '1.1900' required: - net - gross price_monthly: description: Monthly price in this [Location](#tag/locations). type: object properties: net: description: Price without VAT. type: string format: decimal example: '1.0000' gross: description: Price with VAT added. type: string format: decimal example: '1.1900' required: - net - gross included_traffic: description: Free traffic per month in bytes in this [Location](#tag/locations). type: integer format: int64 example: 654321 price_per_tb_traffic: description: Additional traffic price per TB in this [Location](#tag/locations). type: object properties: net: description: Price without VAT. type: string format: decimal example: '1.0000' gross: description: Price with VAT added. type: string format: decimal example: '1.1900' required: - net - gross required: - location - price_hourly - price_monthly - included_traffic - price_per_tb_traffic required: - id - name - description - max_connections - max_services - max_targets - max_assigned_certificates - deprecated - prices protection: description: Protection configuration for the Resource. type: object properties: delete: description: Prevent the Resource from being deleted. type: boolean example: false required: - delete 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: '' 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' services: description: List of services that belong to this Load Balancer. type: array items: title: LoadBalancerService oneOf: - title: LoadBalancerServiceTCP allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - tcp example: tcp - title: LoadBalancerServiceHTTPProtocol allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - http example: http http: title: LoadBalancerServiceHTTPConfig description: Configuration option for protocol http. type: object properties: cookie_name: description: Name of the cookie used for sticky sessions. type: string default: HCLBSTICKY minLength: 1 maxLength: 100 example: HCLBSTICKY cookie_lifetime: description: Lifetime of the cookie used for sticky sessions (in seconds). type: integer default: 300 minimum: 30 maximum: 86400 example: 300 timeout_idle: description: Idle timeout in seconds for the client and server side. type: integer default: 50 example: 50 sticky_sessions: description: Use sticky sessions. type: boolean default: false example: true required: - cookie_name - cookie_lifetime - timeout_idle - sticky_sessions required: - http - title: LoadBalancerServiceHTTPSProtocol allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - https example: https http: title: LoadBalancerServiceHTTPSConfig description: Configuration option for protocol https. type: object properties: cookie_name: description: Name of the cookie used for sticky sessions. type: string default: HCLBSTICKY minLength: 1 maxLength: 100 example: HCLBSTICKY cookie_lifetime: description: Lifetime of the cookie used for sticky sessions (in seconds). type: integer default: 300 minimum: 30 maximum: 86400 example: 300 timeout_idle: description: Idle timeout in seconds for the client and server side. type: integer default: 50 example: 50 certificates: description: IDs of the Certificates to use for TLS/SSL termination by the Load Balancer; empty for TLS/SSL passthrough. type: array items: type: integer format: int64 example: - 897 redirect_http: description: Redirect HTTP requests to HTTPS. type: boolean default: false example: true sticky_sessions: description: Use sticky sessions. type: boolean default: false example: true required: - cookie_name - cookie_lifetime - timeout_idle - certificates - redirect_http - sticky_sessions required: - http discriminator: propertyName: protocol mapping: tcp: '#/components/schemas/ServiceTCP' http: '#/components/schemas/ServiceHTTPProtocol' https: '#/components/schemas/ServiceHTTPSProtocol' targets: description: List of targets that belong to this Load Balancer. type: array items: title: LoadBalancerTarget oneOf: - title: LoadBalancerTargetTypeServer allOf: - type: object properties: type: description: Type of the resource. type: string enum: - server - label_selector - ip required: - type - type: object properties: type: type: string enum: - server example: server server: title: LoadBalancerTargetServer description: Server where the traffic should be routed to. Only present for target type "server". type: object properties: id: description: ID of the Server. type: integer format: int64 example: 80 required: - id health_status: title: LoadBalancerTargetHealthStatus description: List of health statuses of the services on this target. Only present for target types "server" and "ip". type: array items: type: object properties: listen_port: type: integer example: 443 status: type: string enum: - healthy - unhealthy - unknown example: healthy required: - listen_port - status use_private_ip: title: LoadBalancerTargetUsePrivateIP description: Use the private network IP instead of the public IP. Only present for target types "server" and "label_selector". type: boolean default: false required: - server - health_status - use_private_ip - title: LoadBalancerTargetTypeLabelSelector allOf: - type: object properties: type: description: Type of the resource. type: string enum: - server - label_selector - ip required: - type - type: object properties: type: type: string enum: - label_selector example: label_selector label_selector: title: LoadBalancerTargetLabelSelector description: Label selector used to determine targets. Only present for target type "label_selector". type: object properties: selector: description: Label selector. type: string minLength: 1 maxLength: 1000 example: env=prod required: - selector targets: description: List of resolved label selector target Servers. type: array items: title: LoadBalancerTargetTarget type: object properties: type: description: Type of the resource. Here always "server". type: string example: server server: title: LoadBalancerTargetServer description: Server where the traffic should be routed to. Only present for target type "server". type: object properties: id: description: ID of the Server. type: integer format: int64 example: 80 required: - id health_status: title: LoadBalancerTargetHealthStatus description: List of health statuses of the services on this target. Only present for target types "server" and "ip". type: array items: type: object properties: listen_port: type: integer example: 443 status: type: string enum: - healthy - unhealthy - unknown example: healthy required: - listen_port - status use_private_ip: title: LoadBalancerTargetUsePrivateIP description: Use the private network IP instead of the public IP. Only present for target types "server" and "label_selector". type: boolean default: false required: - type - server - health_status - use_private_ip use_private_ip: title: LoadBalancerTargetUsePrivateIP description: Use the private network IP instead of the public IP. Only present for target types "server" and "label_selector". type: boolean default: false required: - label_selector - targets - use_private_ip - title: LoadBalancerTargetTypeIP allOf: - type: object properties: type: description: Type of the resource. type: string enum: - server - label_selector - ip required: - type - type: object properties: type: type: string enum: - ip example: ip ip: title: LoadBalancerTargetIP description: IP target where the traffic should be routed to. It is only possible to use the (Public or vSwitch) IPs of Hetzner Online Root Servers belonging to the project owner. IPs belonging to other users are blocked. Additionally IPs belonging to services provided by Hetzner Cloud (Servers, Load Balancers, ...) are blocked as well. Only present for target type `ip`. type: object properties: ip: description: IP of a server that belongs to the same customer (public IPv4/IPv6) or private IP in a subnet type vswitch. type: string example: 203.0.113.1 required: - ip health_status: title: LoadBalancerTargetHealthStatus description: List of health statuses of the services on this target. Only present for target types "server" and "ip". type: array items: type: object properties: listen_port: type: integer example: 443 status: type: string enum: - healthy - unhealthy - unknown example: healthy required: - listen_port - status required: - ip - health_status discriminator: propertyName: type mapping: server: '#/components/schemas/TargetTypeServer' label_selector: '#/components/schemas/TargetTypeLabelSelector' ip: '#/components/schemas/TargetTypeIP' algorithm: description: Algorithm of the Load Balancer. type: object properties: type: description: Type of the algorithm. type: string enum: - round_robin - least_connections required: - type outgoing_traffic: description: Outbound Traffic for the current billing period in bytes. type: integer format: int64 nullable: true ingoing_traffic: description: Inbound Traffic for the current billing period in bytes. type: integer format: int64 nullable: true included_traffic: description: Free Traffic for the current billing period in bytes. type: integer format: int64 example: 10000 required: - id - name - public_net - private_net - location - load_balancer_type - protection - labels - created - services - targets - algorithm - outgoing_traffic - ingoing_traffic - included_traffic 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: - load_balancers - 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\tloadBalancers, err := client.LoadBalancer.All(ctx)\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) load_balancers = client.load_balancers.get_all()' - lang: Shell label: CLI source: hcloud load-balancer list post: operationId: create_load_balancer summary: Create a Load Balancer description: 'Creates a Load Balancer. #### Operation specific errors | Status | Code | Description | | --- | --- | --- | | `412` | `source_port_already_used` | The source port you are trying to add is already in use | | `422` | `ip_not_owned` | The IP is not owned by the owner of the project of the Load Balancer | | `422` | `load_balancer_not_attached_to_network` | The Load Balancer is not attached to a network | | `422` | `resolve_cloud_private_targets_error` | The server you are trying to add as a target is not attached to the same network as the Load Balancer | | `422` | `resolve_cloud_public_targets_error` | The server that you are trying to add as a public target does not have a public IPv4 address | | `422` | `target_already_defined` | The Load Balancer target you are trying to define is already defined | ' tags: - Load Balancers requestBody: required: true content: application/json: schema: title: CreateLoadBalancerRequest type: object properties: name: description: Name of the Load Balancer. type: string minLength: 1 maxLength: 128 pattern: ^\S(.*\S)?$ example: Web Frontend load_balancer_type: description: ID or name of the Load Balancer type this Load Balancer should be created with. type: string example: lb11 algorithm: title: LoadBalancerAlgorithm description: Algorithm of the Load Balancer. type: object properties: type: description: Type of the algorithm. type: string enum: - round_robin - least_connections required: - type default: type: round_robin services: description: Array of services. type: array items: title: LoadBalancerService oneOf: - title: LoadBalancerServiceTCP allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - tcp example: tcp - title: LoadBalancerServiceHTTPProtocol allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - http example: http http: title: LoadBalancerServiceHTTPConfig description: Configuration option for protocol http. type: object properties: cookie_name: description: Name of the cookie used for sticky sessions. type: string default: HCLBSTICKY minLength: 1 maxLength: 100 example: HCLBSTICKY cookie_lifetime: description: Lifetime of the cookie used for sticky sessions (in seconds). type: integer default: 300 minimum: 30 maximum: 86400 example: 300 timeout_idle: description: Idle timeout in seconds for the client and server side. type: integer default: 50 example: 50 sticky_sessions: description: Use sticky sessions. type: boolean default: false example: true required: - cookie_name - cookie_lifetime - timeout_idle - sticky_sessions required: - http - title: LoadBalancerServiceHTTPSProtocol allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - https example: https http: title: LoadBalancerServiceHTTPSConfig description: Configuration option for protocol https. type: object properties: cookie_name: description: Name of the cookie used for sticky sessions. type: string default: HCLBSTICKY minLength: 1 maxLength: 100 example: HCLBSTICKY cookie_lifetime: description: Lifetime of the cookie used for sticky sessions (in seconds). type: integer default: 300 minimum: 30 maximum: 86400 example: 300 timeout_idle: description: Idle timeout in seconds for the client and server side. type: integer default: 50 example: 50 certificates: description: IDs of the Certificates to use for TLS/SSL termination by the Load Balancer; empty for TLS/SSL passthrough. type: array items: type: integer format: int64 example: - 897 redirect_http: description: Redirect HTTP requests to HTTPS. type: boolean default: false example: true sticky_sessions: description: Use sticky sessions. type: boolean default: false example: true required: - cookie_name - cookie_lifetime - timeout_idle - certificates - redirect_http - sticky_sessions required: - http discriminator: propertyName: protocol mapping: tcp: '#/components/schemas/ServiceTCP' http: '#/components/schemas/ServiceHTTPProtocol' https: '#/components/schemas/ServiceHTTPSProtocol' targets: description: Array of targets. type: array items: allOf: - title: LoadBalancerTarget description: Configuration of a Load Balancer target. type: object properties: type: description: Type of the resource. type: string enum: - server - label_selector - ip server: title: LoadBalancerTargetServer description: Configuration for type Server, only valid and required if type is `server`. type: object properties: id: description: ID of the Server. type: integer format: int64 example: 80 additionalProperties: false required: - id label_selector: title: LoadBalancerTargetLabelSelector description: Configuration for label selector targets, only valid and required if type is `label_selector`. type: object properties: selector: description: Label selector. type: string minLength: 1 maxLength: 1000 example: env=prod required: - selector ip: title: LoadBalancerTargetIP description: Configuration for an IP target. It is only possible to use the (Public or vSwitch) IPs of Hetzner Online Root Servers belonging to the project owner. IPs belonging to other users are blocked. Additionally IPs belonging to services provided by Hetzner Cloud (Servers, Load Balancers, ...) are blocked as well. Only valid and required if type is `ip`. type: object properties: ip: description: IP of a server that belongs to the same customer (public IPv4/IPv6) or private IP in a subnet type vswitch. type: string example: 203.0.113.1 required: - ip required: - type - type: object properties: use_private_ip: description: Use the private network IP instead of the public IP of the Server, requires the Server and Load Balancer to be in the same network. Only valid for target types `server` and `label_selector`. type: boolean default: false example: true 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: '' public_interface: description: Enable or disable the public interface of the Load Balancer. type: boolean example: true network: description: ID of the network the Load Balancer should be attached to on creation. type: integer format: int64 example: 123 network_zone: description: Name of network zone. type: string example: eu-central location: description: ID or name of Location to create Load Balancer in. type: string example: fsn1 required: - name - load_balancer_type responses: '201': description: Request succeeded. content: application/json: schema: type: object properties: load_balancer: type: object properties: id: description: ID of the [Load Balancer](#tag/load-balancers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 name: description: Name of the Resource. Must be unique per Project. type: string example: my-resource public_net: description: Public network information. type: object properties: enabled: description: Public Interface enabled or not. type: boolean ipv4: description: IP address (v4). type: object properties: ip: description: IP address (v4) of this Load Balancer. type: string nullable: true example: 1.2.3.4 dns_ptr: description: Reverse DNS PTR entry for the IPv4 address of this Load Balancer. type: string nullable: true example: lb1.example.com required: - ip - dns_ptr ipv6: description: IP address (v6). type: object properties: ip: description: IP address (v6) of this Load Balancer. type: string nullable: true example: 2001:db8::1 dns_ptr: description: Reverse DNS PTR entry for the IPv6 address of this Load Balancer. type: string nullable: true example: lb1.example.com required: - ip - dns_ptr required: - enabled - ipv4 - ipv6 private_net: description: Private networks information. type: array items: type: object properties: network: description: ID of the Network. type: integer format: int64 example: 4711 ip: description: IP address (v4) of this Load Balancer in this Network. type: string example: 10.0.0.2 required: - network - ip location: type: object properties: id: description: ID of the [Location](#tag/locations). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 name: description: Unique identifier of the [Location](#tag/locations). type: string pattern: ^[a-z0-9]+(-?[a-z0-9]*)*$ example: fsn1 description: description: Human readable description of the [Location](#tag/locations). type: string example: Falkenstein DC Park 1 country: description: 'Country the [Location](#tag/locations) resides in. ISO 3166-1 alpha-2 code of the country. ' type: string example: DE city: description: 'Name of the closest city to the [Location](#tag/locations). City name or city name and state in short form. E.g. `Falkenstein` or `Ashburn, VA`. ' type: string example: Falkenstein latitude: description: Latitude of the city closest to the [Location](#tag/locations). type: number format: double example: 50.47612 longitude: description: Longitude of the city closest to the [Location](#tag/locations). type: number format: double example: 12.370071 network_zone: description: Name of the Network Zone this [Location](#tag/locations) resides in. type: string pattern: ^[a-z0-9]+(-?[a-z0-9]*)*$ example: eu-central required: - id - name - description - country - city - latitude - longitude - network_zone load_balancer_type: type: object properties: id: description: ID of the Load Balancer type. type: integer format: int64 example: 1 name: description: Unique identifier of the Load Balancer type. type: string example: lb11 description: description: Description of the Load Balancer type. type: string example: LB11 max_connections: description: Number of maximum simultaneous open connections. type: integer format: int64 example: 20000 max_services: description: Number of services a Load Balancer of this type can have. type: integer format: int64 example: 5 max_targets: description: Number of targets a single Load Balancer can have. type: integer format: int64 example: 25 max_assigned_certificates: description: Number of SSL Certificates that can be assigned to a single Load Balancer. type: integer format: int64 example: 10 deprecated: description: Point in time when the Load Balancer type is deprecated (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time nullable: true example: '2016-01-30T23:50:00Z' prices: description: Price per [Location](#tag/locations). type: array items: type: object properties: location: description: Name of the [Location](#tag/locations) the price is for. type: string example: fsn1 price_hourly: description: Hourly price in this [Location](#tag/locations). type: object properties: net: description: Price without VAT. type: string format: decimal example: '1.0000' gross: description: Price with VAT added. type: string format: decimal example: '1.1900' required: - net - gross price_monthly: description: Monthly price in this [Location](#tag/locations). type: object properties: net: description: Price without VAT. type: string format: decimal example: '1.0000' gross: description: Price with VAT added. type: string format: decimal example: '1.1900' required: - net - gross included_traffic: description: Free traffic per month in bytes in this [Location](#tag/locations). type: integer format: int64 example: 654321 price_per_tb_traffic: description: Additional traffic price per TB in this [Location](#tag/locations). type: object properties: net: description: Price without VAT. type: string format: decimal example: '1.0000' gross: description: Price with VAT added. type: string format: decimal example: '1.1900' required: - net - gross required: - location - price_hourly - price_monthly - included_traffic - price_per_tb_traffic required: - id - name - description - max_connections - max_services - max_targets - max_assigned_certificates - deprecated - prices protection: description: Protection configuration for the Resource. type: object properties: delete: description: Prevent the Resource from being deleted. type: boolean example: false required: - delete 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: '' 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' services: description: List of services that belong to this Load Balancer. type: array items: title: LoadBalancerService oneOf: - title: LoadBalancerServiceTCP allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - tcp example: tcp - title: LoadBalancerServiceHTTPProtocol allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - http example: http http: title: LoadBalancerServiceHTTPConfig description: Configuration option for protocol http. type: object properties: cookie_name: description: Name of the cookie used for sticky sessions. type: string default: HCLBSTICKY minLength: 1 maxLength: 100 example: HCLBSTICKY cookie_lifetime: description: Lifetime of the cookie used for sticky sessions (in seconds). type: integer default: 300 minimum: 30 maximum: 86400 example: 300 timeout_idle: description: Idle timeout in seconds for the client and server side. type: integer default: 50 example: 50 sticky_sessions: description: Use sticky sessions. type: boolean default: false example: true required: - cookie_name - cookie_lifetime - timeout_idle - sticky_sessions required: - http - title: LoadBalancerServiceHTTPSProtocol allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - https example: https http: title: LoadBalancerServiceHTTPSConfig description: Configuration option for protocol https. type: object properties: cookie_name: description: Name of the cookie used for sticky sessions. type: string default: HCLBSTICKY minLength: 1 maxLength: 100 example: HCLBSTICKY cookie_lifetime: description: Lifetime of the cookie used for sticky sessions (in seconds). type: integer default: 300 minimum: 30 maximum: 86400 example: 300 timeout_idle: description: Idle timeout in seconds for the client and server side. type: integer default: 50 example: 50 certificates: description: IDs of the Certificates to use for TLS/SSL termination by the Load Balancer; empty for TLS/SSL passthrough. type: array items: type: integer format: int64 example: - 897 redirect_http: description: Redirect HTTP requests to HTTPS. type: boolean default: false example: true sticky_sessions: description: Use sticky sessions. type: boolean default: false example: true required: - cookie_name - cookie_lifetime - timeout_idle - certificates - redirect_http - sticky_sessions required: - http discriminator: propertyName: protocol mapping: tcp: '#/components/schemas/ServiceTCP' http: '#/components/schemas/ServiceHTTPProtocol' https: '#/components/schemas/ServiceHTTPSProtocol' targets: description: List of targets that belong to this Load Balancer. type: array items: title: LoadBalancerTarget oneOf: - title: LoadBalancerTargetTypeServer allOf: - type: object properties: type: description: Type of the resource. type: string enum: - server - label_selector - ip required: - type - type: object properties: type: type: string enum: - server example: server server: title: LoadBalancerTargetServer description: Server where the traffic should be routed to. Only present for target type "server". type: object properties: id: description: ID of the Server. type: integer format: int64 example: 80 required: - id health_status: title: LoadBalancerTargetHealthStatus description: List of health statuses of the services on this target. Only present for target types "server" and "ip". type: array items: type: object properties: listen_port: type: integer example: 443 status: type: string enum: - healthy - unhealthy - unknown example: healthy required: - listen_port - status use_private_ip: title: LoadBalancerTargetUsePrivateIP description: Use the private network IP instead of the public IP. Only present for target types "server" and "label_selector". type: boolean default: false required: - server - health_status - use_private_ip - title: LoadBalancerTargetTypeLabelSelector allOf: - type: object properties: type: description: Type of the resource. type: string enum: - server - label_selector - ip required: - type - type: object properties: type: type: string enum: - label_selector example: label_selector label_selector: title: LoadBalancerTargetLabelSelector description: Label selector used to determine targets. Only present for target type "label_selector". type: object properties: selector: description: Label selector. type: string minLength: 1 maxLength: 1000 example: env=prod required: - selector targets: description: List of resolved label selector target Servers. type: array items: title: LoadBalancerTargetTarget type: object properties: type: description: Type of the resource. Here always "server". type: string example: server server: title: LoadBalancerTargetServer description: Server where the traffic should be routed to. Only present for target type "server". type: object properties: id: description: ID of the Server. type: integer format: int64 example: 80 required: - id health_status: title: LoadBalancerTargetHealthStatus description: List of health statuses of the services on this target. Only present for target types "server" and "ip". type: array items: type: object properties: listen_port: type: integer example: 443 status: type: string enum: - healthy - unhealthy - unknown example: healthy required: - listen_port - status use_private_ip: title: LoadBalancerTargetUsePrivateIP description: Use the private network IP instead of the public IP. Only present for target types "server" and "label_selector". type: boolean default: false required: - type - server - health_status - use_private_ip use_private_ip: title: LoadBalancerTargetUsePrivateIP description: Use the private network IP instead of the public IP. Only present for target types "server" and "label_selector". type: boolean default: false required: - label_selector - targets - use_private_ip - title: LoadBalancerTargetTypeIP allOf: - type: object properties: type: description: Type of the resource. type: string enum: - server - label_selector - ip required: - type - type: object properties: type: type: string enum: - ip example: ip ip: title: LoadBalancerTargetIP description: IP target where the traffic should be routed to. It is only possible to use the (Public or vSwitch) IPs of Hetzner Online Root Servers belonging to the project owner. IPs belonging to other users are blocked. Additionally IPs belonging to services provided by Hetzner Cloud (Servers, Load Balancers, ...) are blocked as well. Only present for target type `ip`. type: object properties: ip: description: IP of a server that belongs to the same customer (public IPv4/IPv6) or private IP in a subnet type vswitch. type: string example: 203.0.113.1 required: - ip health_status: title: LoadBalancerTargetHealthStatus description: List of health statuses of the services on this target. Only present for target types "server" and "ip". type: array items: type: object properties: listen_port: type: integer example: 443 status: type: string enum: - healthy - unhealthy - unknown example: healthy required: - listen_port - status required: - ip - health_status discriminator: propertyName: type mapping: server: '#/components/schemas/TargetTypeServer' label_selector: '#/components/schemas/TargetTypeLabelSelector' ip: '#/components/schemas/TargetTypeIP' algorithm: description: Algorithm of the Load Balancer. type: object properties: type: description: Type of the algorithm. type: string enum: - round_robin - least_connections required: - type outgoing_traffic: description: Outbound Traffic for the current billing period in bytes. type: integer format: int64 nullable: true ingoing_traffic: description: Inbound Traffic for the current billing period in bytes. type: integer format: int64 nullable: true included_traffic: description: Free Traffic for the current billing period in bytes. type: integer format: int64 example: 10000 required: - id - name - public_net - private_net - location - load_balancer_type - protection - labels - created - services - targets - algorithm - outgoing_traffic - ingoing_traffic - included_traffic 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: - load_balancer - action examples: default: value: load_balancer: id: 4711 name: Web Frontend public_net: enabled: false ipv4: ip: 1.2.3.4 dns_ptr: lb1.example.com ipv6: ip: 2001:db8::1 dns_ptr: lb1.example.com private_net: - network: 4711 ip: 10.0.0.2 location: id: 1 name: fsn1 description: Falkenstein DC Park 1 country: DE city: Falkenstein latitude: 50.47612 longitude: 12.370071 network_zone: eu-central load_balancer_type: id: 1 name: lb11 description: LB11 max_connections: 20000 max_services: 5 max_targets: 25 max_assigned_certificates: 10 deprecated: '2016-01-30T23:50:00Z' prices: - location: fsn1 price_hourly: net: '1.0000000000' gross: '1.1900000000000000' price_monthly: net: '1.0000000000' gross: '1.1900000000000000' included_traffic: 654321 price_per_tb_traffic: net: '1.0000000000' gross: '1.1900000000000000' protection: delete: false labels: key: value created: '2016-01-30T23:50:00Z' services: - protocol: https listen_port: 443 destination_port: 80 proxyprotocol: false health_check: protocol: http port: 4711 interval: 15 timeout: 10 retries: 3 http: domain: example.com path: / response: '{"status": "ok"}' status_codes: - 2??,3?? tls: false http: cookie_name: HCLBSTICKY cookie_lifetime: 300 certificates: - 897 redirect_http: true sticky_sessions: true timeout_idle: 50 targets: - type: server server: id: 80 health_status: - listen_port: 443 status: healthy use_private_ip: true targets: - type: server server: id: 80 health_status: - listen_port: 443 status: healthy use_private_ip: true algorithm: type: round_robin outgoing_traffic: 123456 ingoing_traffic: 123456 included_traffic: 654321 action: id: 13 command: create_load_balancer status: success progress: 100 started: '2016-01-30T23:55:00Z' finished: '2016-01-30T23:56:00Z' resources: - id: 4711 type: load_balancer 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\t\"time\"\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.LoadBalancer.Create(ctx, hcloud.LoadBalancerCreateOpts{\n\t\tAlgorithm: &hcloud.LoadBalancerAlgorithm{\n\t\t\tType: hcloud.LoadBalancerAlgorithmTypeRoundRobin,\n\t\t},\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\tLoadBalancerType: &hcloud.LoadBalancerType{Name: \"lb11\"},\n\t\tLocation: &hcloud.Location{Name: \"fsn1\"},\n\t\tName: \"Web Frontend\",\n\t\tNetwork: &hcloud.Network{ID: 123},\n\t\tNetworkZone: hcloud.NetworkZoneEUCentral,\n\t\tPublicInterface: hcloud.Ptr(true),\n\t\tServices: []hcloud.LoadBalancerCreateOptsService{\n\t\t\t{\n\t\t\t\tDestinationPort: hcloud.Ptr(80),\n\t\t\t\tHealthCheck: &hcloud.LoadBalancerCreateOptsServiceHealthCheck{\n\t\t\t\t\tHTTP: &hcloud.LoadBalancerCreateOptsServiceHealthCheckHTTP{\n\t\t\t\t\t\tDomain: hcloud.Ptr(\"example.com\"),\n\t\t\t\t\t\tPath: hcloud.Ptr(\"/\"),\n\t\t\t\t\t\tResponse: hcloud.Ptr(`{\"status\": \"ok\"}`),\n\t\t\t\t\t\tStatusCodes: []string{\"2??\", \"3??\"},\n\t\t\t\t\t\tTLS: hcloud.Ptr(false),\n\t\t\t\t\t},\n\t\t\t\t\tInterval: hcloud.Ptr(15 * time.Second),\n\t\t\t\t\tPort: hcloud.Ptr(4711),\n\t\t\t\t\tProtocol: hcloud.LoadBalancerServiceProtocolHTTP,\n\t\t\t\t\tRetries: hcloud.Ptr(3),\n\t\t\t\t\tTimeout: hcloud.Ptr(10 * time.Second),\n\t\t\t\t},\n\t\t\t\tHTTP: &hcloud.LoadBalancerCreateOptsServiceHTTP{\n\t\t\t\t\tCertificates: []*hcloud.Certificate{{ID: 897}},\n\t\t\t\t\tCookieLifetime: hcloud.Ptr(300 * time.Second),\n\t\t\t\t\tCookieName: hcloud.Ptr(\"HCLBSTICKY\"),\n\t\t\t\t\tRedirectHTTP: hcloud.Ptr(true),\n\t\t\t\t\tStickySessions: hcloud.Ptr(true),\n\t\t\t\t},\n\t\t\t\tListenPort: hcloud.Ptr(443),\n\t\t\t\tProtocol: hcloud.LoadBalancerServiceProtocolHTTPS,\n\t\t\t\tProxyprotocol: hcloud.Ptr(false),\n\t\t\t},\n\t\t},\n\t\tTargets: []hcloud.LoadBalancerCreateOptsTarget{\n\t\t\t{\n\t\t\t\tIP: hcloud.LoadBalancerCreateOptsTargetIP{\n\t\t\t\t\tIP: \"203.0.113.1\",\n\t\t\t\t},\n\t\t\t\tLabelSelector: hcloud.LoadBalancerCreateOptsTargetLabelSelector{\n\t\t\t\t\tSelector: \"env=prod\",\n\t\t\t\t},\n\t\t\t\tServer: hcloud.LoadBalancerCreateOptsTargetServer{\n\t\t\t\t\tServer: &hcloud.Server{ID: 80},\n\t\t\t\t},\n\t\t\t\tType: hcloud.LoadBalancerTargetTypeServer,\n\t\t\t\tUsePrivateIP: hcloud.Ptr(false),\n\t\t\t},\n\t\t},\n\t})\n\n\terr = client.Action.WaitFor(ctx, result.Action)\n\n\tloadBalancer := result.LoadBalancer\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.certificates import Certificate\nfrom hcloud.load_balancer_types import LoadBalancerType\nfrom hcloud.load_balancers import (\n LoadBalancerAlgorithm,\n LoadBalancerHealtCheckHttp,\n LoadBalancerHealthCheck,\n LoadBalancerService,\n LoadBalancerServiceHttp,\n LoadBalancerTarget,\n LoadBalancerTargetIP,\n LoadBalancerTargetLabelSelector,\n)\nfrom hcloud.locations import Location\nfrom hcloud.networks import Network\nfrom hcloud.servers import Server\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\nresponse = client.load_balancers.create(\n algorithm=LoadBalancerAlgorithm(type=\"round_robin\"),\n labels={\n \"environment\": \"prod\",\n \"example.com/my\": \"label\",\n \"just-a-key\": \"\",\n },\n load_balancer_type=LoadBalancerType(name=\"lb11\"),\n location=Location(name=\"fsn1\"),\n name=\"Web Frontend\",\n network=Network(id=123),\n network_zone=\"eu-central\",\n public_interface=True,\n services=[\n LoadBalancerService(\n destination_port=80,\n health_check=LoadBalancerHealthCheck(\n http=LoadBalancerHealtCheckHttp(\n domain=\"example.com\",\n path=\"/\",\n response='{\"status\": \"ok\"}',\n status_codes=[\"2??\", \"3??\"],\n tls=False,\n ),\n interval=15,\n port=4711,\n protocol=\"http\",\n retries=3,\n timeout=10,\n ),\n http=LoadBalancerServiceHttp(\n certificates=[Certificate(id=897)],\n cookie_lifetime=300,\n cookie_name=\"HCLBSTICKY\",\n redirect_http=True,\n sticky_sessions=True,\n ),\n listen_port=443,\n protocol=\"https\",\n proxyprotocol=False,\n )\n ],\n targets=[\n LoadBalancerTarget(\n ip=LoadBalancerTargetIP(\n ip=\"203.0.113.1\",\n ),\n label_selector=LoadBalancerTargetLabelSelector(\n selector=\"env=prod\",\n ),\n server=Server(\n id=80,\n ),\n type=\"server\",\n use_private_ip=True,\n )\n ],\n)\n\nresponse.action.wait_until_finished()\n\nload_balancer = response.load_balancer" - lang: Shell label: CLI source: "hcloud load-balancer create \\\n --algorithm-type round_robin \\\n --label \"environment=prod\" \\\n --label \"example.com/my=label\" \\\n --label \"just-a-key=\" \\\n --type lb11 \\\n --location fsn1 \\\n --name \"Web Frontend\"\n\nhcloud load-balancer enable-public-interface \"Web Frontend\"\n\nhcloud load-balancer add-service \"Web Frontend\" \\\n --destination-port 80 \\\n --health-check-http-domain example.com \\\n --health-check-http-path \"/\" \\\n --health-check-http-response '{\"status\": \"ok\"}' \\\n --health-check-http-status-codes \"2??,3??\" \\\n --health-check-http-tls=false \\\n --health-check-interval 15s \\\n --health-check-port 4711 \\\n --health-check-protocol http \\\n --health-check-retries 3 \\\n --health-check-timeout 10s \\\n --http-certificates 897 \\\n --http-cookie-lifetime 300s \\\n --http-cookie-name HCLBSTICKY \\\n --http-redirect-http=true \\\n --http-sticky-sessions=true \\\n --listen-port 443 \\\n --protocol https \\\n --proxy-protocol=false\n\nhcloud load-balancer add-target \"Web Frontend\" --ip 203.0.113.1\nhcloud load-balancer add-target \"Web Frontend\" --label-selector \"env=prod\"\nhcloud load-balancer add-target \"Web Frontend\" --server 80 --use-private-ip" /load_balancers/{id}: get: operationId: get_load_balancer summary: Get a Load Balancer description: 'Gets a specific Load Balancer object. ' tags: - Load Balancers parameters: - description: ID of the Load Balancer. name: id in: path required: true schema: description: ID of the [Load Balancer](#tag/load-balancers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '200': description: Request succeeded. content: application/json: schema: type: object properties: load_balancer: type: object properties: id: description: ID of the [Load Balancer](#tag/load-balancers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 name: description: Name of the Resource. Must be unique per Project. type: string example: my-resource public_net: description: Public network information. type: object properties: enabled: description: Public Interface enabled or not. type: boolean ipv4: description: IP address (v4). type: object properties: ip: description: IP address (v4) of this Load Balancer. type: string nullable: true example: 1.2.3.4 dns_ptr: description: Reverse DNS PTR entry for the IPv4 address of this Load Balancer. type: string nullable: true example: lb1.example.com required: - ip - dns_ptr ipv6: description: IP address (v6). type: object properties: ip: description: IP address (v6) of this Load Balancer. type: string nullable: true example: 2001:db8::1 dns_ptr: description: Reverse DNS PTR entry for the IPv6 address of this Load Balancer. type: string nullable: true example: lb1.example.com required: - ip - dns_ptr required: - enabled - ipv4 - ipv6 private_net: description: Private networks information. type: array items: type: object properties: network: description: ID of the Network. type: integer format: int64 example: 4711 ip: description: IP address (v4) of this Load Balancer in this Network. type: string example: 10.0.0.2 required: - network - ip location: type: object properties: id: description: ID of the [Location](#tag/locations). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 name: description: Unique identifier of the [Location](#tag/locations). type: string pattern: ^[a-z0-9]+(-?[a-z0-9]*)*$ example: fsn1 description: description: Human readable description of the [Location](#tag/locations). type: string example: Falkenstein DC Park 1 country: description: 'Country the [Location](#tag/locations) resides in. ISO 3166-1 alpha-2 code of the country. ' type: string example: DE city: description: 'Name of the closest city to the [Location](#tag/locations). City name or city name and state in short form. E.g. `Falkenstein` or `Ashburn, VA`. ' type: string example: Falkenstein latitude: description: Latitude of the city closest to the [Location](#tag/locations). type: number format: double example: 50.47612 longitude: description: Longitude of the city closest to the [Location](#tag/locations). type: number format: double example: 12.370071 network_zone: description: Name of the Network Zone this [Location](#tag/locations) resides in. type: string pattern: ^[a-z0-9]+(-?[a-z0-9]*)*$ example: eu-central required: - id - name - description - country - city - latitude - longitude - network_zone load_balancer_type: type: object properties: id: description: ID of the Load Balancer type. type: integer format: int64 example: 1 name: description: Unique identifier of the Load Balancer type. type: string example: lb11 description: description: Description of the Load Balancer type. type: string example: LB11 max_connections: description: Number of maximum simultaneous open connections. type: integer format: int64 example: 20000 max_services: description: Number of services a Load Balancer of this type can have. type: integer format: int64 example: 5 max_targets: description: Number of targets a single Load Balancer can have. type: integer format: int64 example: 25 max_assigned_certificates: description: Number of SSL Certificates that can be assigned to a single Load Balancer. type: integer format: int64 example: 10 deprecated: description: Point in time when the Load Balancer type is deprecated (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time nullable: true example: '2016-01-30T23:50:00Z' prices: description: Price per [Location](#tag/locations). type: array items: type: object properties: location: description: Name of the [Location](#tag/locations) the price is for. type: string example: fsn1 price_hourly: description: Hourly price in this [Location](#tag/locations). type: object properties: net: description: Price without VAT. type: string format: decimal example: '1.0000' gross: description: Price with VAT added. type: string format: decimal example: '1.1900' required: - net - gross price_monthly: description: Monthly price in this [Location](#tag/locations). type: object properties: net: description: Price without VAT. type: string format: decimal example: '1.0000' gross: description: Price with VAT added. type: string format: decimal example: '1.1900' required: - net - gross included_traffic: description: Free traffic per month in bytes in this [Location](#tag/locations). type: integer format: int64 example: 654321 price_per_tb_traffic: description: Additional traffic price per TB in this [Location](#tag/locations). type: object properties: net: description: Price without VAT. type: string format: decimal example: '1.0000' gross: description: Price with VAT added. type: string format: decimal example: '1.1900' required: - net - gross required: - location - price_hourly - price_monthly - included_traffic - price_per_tb_traffic required: - id - name - description - max_connections - max_services - max_targets - max_assigned_certificates - deprecated - prices protection: description: Protection configuration for the Resource. type: object properties: delete: description: Prevent the Resource from being deleted. type: boolean example: false required: - delete 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: '' 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' services: description: List of services that belong to this Load Balancer. type: array items: title: LoadBalancerService oneOf: - title: LoadBalancerServiceTCP allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - tcp example: tcp - title: LoadBalancerServiceHTTPProtocol allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - http example: http http: title: LoadBalancerServiceHTTPConfig description: Configuration option for protocol http. type: object properties: cookie_name: description: Name of the cookie used for sticky sessions. type: string default: HCLBSTICKY minLength: 1 maxLength: 100 example: HCLBSTICKY cookie_lifetime: description: Lifetime of the cookie used for sticky sessions (in seconds). type: integer default: 300 minimum: 30 maximum: 86400 example: 300 timeout_idle: description: Idle timeout in seconds for the client and server side. type: integer default: 50 example: 50 sticky_sessions: description: Use sticky sessions. type: boolean default: false example: true required: - cookie_name - cookie_lifetime - timeout_idle - sticky_sessions required: - http - title: LoadBalancerServiceHTTPSProtocol allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - https example: https http: title: LoadBalancerServiceHTTPSConfig description: Configuration option for protocol https. type: object properties: cookie_name: description: Name of the cookie used for sticky sessions. type: string default: HCLBSTICKY minLength: 1 maxLength: 100 example: HCLBSTICKY cookie_lifetime: description: Lifetime of the cookie used for sticky sessions (in seconds). type: integer default: 300 minimum: 30 maximum: 86400 example: 300 timeout_idle: description: Idle timeout in seconds for the client and server side. type: integer default: 50 example: 50 certificates: description: IDs of the Certificates to use for TLS/SSL termination by the Load Balancer; empty for TLS/SSL passthrough. type: array items: type: integer format: int64 example: - 897 redirect_http: description: Redirect HTTP requests to HTTPS. type: boolean default: false example: true sticky_sessions: description: Use sticky sessions. type: boolean default: false example: true required: - cookie_name - cookie_lifetime - timeout_idle - certificates - redirect_http - sticky_sessions required: - http discriminator: propertyName: protocol mapping: tcp: '#/components/schemas/ServiceTCP' http: '#/components/schemas/ServiceHTTPProtocol' https: '#/components/schemas/ServiceHTTPSProtocol' targets: description: List of targets that belong to this Load Balancer. type: array items: title: LoadBalancerTarget oneOf: - title: LoadBalancerTargetTypeServer allOf: - type: object properties: type: description: Type of the resource. type: string enum: - server - label_selector - ip required: - type - type: object properties: type: type: string enum: - server example: server server: title: LoadBalancerTargetServer description: Server where the traffic should be routed to. Only present for target type "server". type: object properties: id: description: ID of the Server. type: integer format: int64 example: 80 required: - id health_status: title: LoadBalancerTargetHealthStatus description: List of health statuses of the services on this target. Only present for target types "server" and "ip". type: array items: type: object properties: listen_port: type: integer example: 443 status: type: string enum: - healthy - unhealthy - unknown example: healthy required: - listen_port - status use_private_ip: title: LoadBalancerTargetUsePrivateIP description: Use the private network IP instead of the public IP. Only present for target types "server" and "label_selector". type: boolean default: false required: - server - health_status - use_private_ip - title: LoadBalancerTargetTypeLabelSelector allOf: - type: object properties: type: description: Type of the resource. type: string enum: - server - label_selector - ip required: - type - type: object properties: type: type: string enum: - label_selector example: label_selector label_selector: title: LoadBalancerTargetLabelSelector description: Label selector used to determine targets. Only present for target type "label_selector". type: object properties: selector: description: Label selector. type: string minLength: 1 maxLength: 1000 example: env=prod required: - selector targets: description: List of resolved label selector target Servers. type: array items: title: LoadBalancerTargetTarget type: object properties: type: description: Type of the resource. Here always "server". type: string example: server server: title: LoadBalancerTargetServer description: Server where the traffic should be routed to. Only present for target type "server". type: object properties: id: description: ID of the Server. type: integer format: int64 example: 80 required: - id health_status: title: LoadBalancerTargetHealthStatus description: List of health statuses of the services on this target. Only present for target types "server" and "ip". type: array items: type: object properties: listen_port: type: integer example: 443 status: type: string enum: - healthy - unhealthy - unknown example: healthy required: - listen_port - status use_private_ip: title: LoadBalancerTargetUsePrivateIP description: Use the private network IP instead of the public IP. Only present for target types "server" and "label_selector". type: boolean default: false required: - type - server - health_status - use_private_ip use_private_ip: title: LoadBalancerTargetUsePrivateIP description: Use the private network IP instead of the public IP. Only present for target types "server" and "label_selector". type: boolean default: false required: - label_selector - targets - use_private_ip - title: LoadBalancerTargetTypeIP allOf: - type: object properties: type: description: Type of the resource. type: string enum: - server - label_selector - ip required: - type - type: object properties: type: type: string enum: - ip example: ip ip: title: LoadBalancerTargetIP description: IP target where the traffic should be routed to. It is only possible to use the (Public or vSwitch) IPs of Hetzner Online Root Servers belonging to the project owner. IPs belonging to other users are blocked. Additionally IPs belonging to services provided by Hetzner Cloud (Servers, Load Balancers, ...) are blocked as well. Only present for target type `ip`. type: object properties: ip: description: IP of a server that belongs to the same customer (public IPv4/IPv6) or private IP in a subnet type vswitch. type: string example: 203.0.113.1 required: - ip health_status: title: LoadBalancerTargetHealthStatus description: List of health statuses of the services on this target. Only present for target types "server" and "ip". type: array items: type: object properties: listen_port: type: integer example: 443 status: type: string enum: - healthy - unhealthy - unknown example: healthy required: - listen_port - status required: - ip - health_status discriminator: propertyName: type mapping: server: '#/components/schemas/TargetTypeServer' label_selector: '#/components/schemas/TargetTypeLabelSelector' ip: '#/components/schemas/TargetTypeIP' algorithm: description: Algorithm of the Load Balancer. type: object properties: type: description: Type of the algorithm. type: string enum: - round_robin - least_connections required: - type outgoing_traffic: description: Outbound Traffic for the current billing period in bytes. type: integer format: int64 nullable: true ingoing_traffic: description: Inbound Traffic for the current billing period in bytes. type: integer format: int64 nullable: true included_traffic: description: Free Traffic for the current billing period in bytes. type: integer format: int64 example: 10000 required: - id - name - public_net - private_net - location - load_balancer_type - protection - labels - created - services - targets - algorithm - outgoing_traffic - ingoing_traffic - included_traffic required: - load_balancer 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\tloadBalancer, _, err := client.LoadBalancer.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) load_balancer = client.load_balancers.get_by_id(123)' - lang: Shell label: CLI source: hcloud load-balancer describe $LOADBALANCER put: operationId: update_load_balancer summary: Update a Load Balancer description: 'Updates a Load Balancer. You can update a Load Balancer’s name and a Load Balancer’s labels. Note: if the Load Balancer object changes during the request, the response will be a “conflict” error. ' tags: - Load Balancers parameters: - description: ID of the Load Balancer. name: id in: path required: true schema: description: ID of the [Load Balancer](#tag/load-balancers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 requestBody: required: true content: application/json: schema: type: object properties: name: description: New Load Balancer name. type: string minLength: 1 maxLength: 128 pattern: ^\S(.*\S)?$ example: new-name labels: description: 'User-defined labels (`key/value` pairs) for the Resource. Note that the set of [Labels](#description/labels) provided in the request will overwrite the existing one. For more information, see "[Labels](#description/labels)". ' type: object additionalProperties: type: string example: environment: prod example.com/my: label just-a-key: '' responses: '200': description: Request succeeded. content: application/json: schema: type: object properties: load_balancer: type: object properties: id: description: ID of the [Load Balancer](#tag/load-balancers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 name: description: Name of the Resource. Must be unique per Project. type: string example: my-resource public_net: description: Public network information. type: object properties: enabled: description: Public Interface enabled or not. type: boolean ipv4: description: IP address (v4). type: object properties: ip: description: IP address (v4) of this Load Balancer. type: string nullable: true example: 1.2.3.4 dns_ptr: description: Reverse DNS PTR entry for the IPv4 address of this Load Balancer. type: string nullable: true example: lb1.example.com required: - ip - dns_ptr ipv6: description: IP address (v6). type: object properties: ip: description: IP address (v6) of this Load Balancer. type: string nullable: true example: 2001:db8::1 dns_ptr: description: Reverse DNS PTR entry for the IPv6 address of this Load Balancer. type: string nullable: true example: lb1.example.com required: - ip - dns_ptr required: - enabled - ipv4 - ipv6 private_net: description: Private networks information. type: array items: type: object properties: network: description: ID of the Network. type: integer format: int64 example: 4711 ip: description: IP address (v4) of this Load Balancer in this Network. type: string example: 10.0.0.2 required: - network - ip location: type: object properties: id: description: ID of the [Location](#tag/locations). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 name: description: Unique identifier of the [Location](#tag/locations). type: string pattern: ^[a-z0-9]+(-?[a-z0-9]*)*$ example: fsn1 description: description: Human readable description of the [Location](#tag/locations). type: string example: Falkenstein DC Park 1 country: description: 'Country the [Location](#tag/locations) resides in. ISO 3166-1 alpha-2 code of the country. ' type: string example: DE city: description: 'Name of the closest city to the [Location](#tag/locations). City name or city name and state in short form. E.g. `Falkenstein` or `Ashburn, VA`. ' type: string example: Falkenstein latitude: description: Latitude of the city closest to the [Location](#tag/locations). type: number format: double example: 50.47612 longitude: description: Longitude of the city closest to the [Location](#tag/locations). type: number format: double example: 12.370071 network_zone: description: Name of the Network Zone this [Location](#tag/locations) resides in. type: string pattern: ^[a-z0-9]+(-?[a-z0-9]*)*$ example: eu-central required: - id - name - description - country - city - latitude - longitude - network_zone load_balancer_type: type: object properties: id: description: ID of the Load Balancer type. type: integer format: int64 example: 1 name: description: Unique identifier of the Load Balancer type. type: string example: lb11 description: description: Description of the Load Balancer type. type: string example: LB11 max_connections: description: Number of maximum simultaneous open connections. type: integer format: int64 example: 20000 max_services: description: Number of services a Load Balancer of this type can have. type: integer format: int64 example: 5 max_targets: description: Number of targets a single Load Balancer can have. type: integer format: int64 example: 25 max_assigned_certificates: description: Number of SSL Certificates that can be assigned to a single Load Balancer. type: integer format: int64 example: 10 deprecated: description: Point in time when the Load Balancer type is deprecated (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time nullable: true example: '2016-01-30T23:50:00Z' prices: description: Price per [Location](#tag/locations). type: array items: type: object properties: location: description: Name of the [Location](#tag/locations) the price is for. type: string example: fsn1 price_hourly: description: Hourly price in this [Location](#tag/locations). type: object properties: net: description: Price without VAT. type: string format: decimal example: '1.0000' gross: description: Price with VAT added. type: string format: decimal example: '1.1900' required: - net - gross price_monthly: description: Monthly price in this [Location](#tag/locations). type: object properties: net: description: Price without VAT. type: string format: decimal example: '1.0000' gross: description: Price with VAT added. type: string format: decimal example: '1.1900' required: - net - gross included_traffic: description: Free traffic per month in bytes in this [Location](#tag/locations). type: integer format: int64 example: 654321 price_per_tb_traffic: description: Additional traffic price per TB in this [Location](#tag/locations). type: object properties: net: description: Price without VAT. type: string format: decimal example: '1.0000' gross: description: Price with VAT added. type: string format: decimal example: '1.1900' required: - net - gross required: - location - price_hourly - price_monthly - included_traffic - price_per_tb_traffic required: - id - name - description - max_connections - max_services - max_targets - max_assigned_certificates - deprecated - prices protection: description: Protection configuration for the Resource. type: object properties: delete: description: Prevent the Resource from being deleted. type: boolean example: false required: - delete 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: '' 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' services: description: List of services that belong to this Load Balancer. type: array items: title: LoadBalancerService oneOf: - title: LoadBalancerServiceTCP allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - tcp example: tcp - title: LoadBalancerServiceHTTPProtocol allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - http example: http http: title: LoadBalancerServiceHTTPConfig description: Configuration option for protocol http. type: object properties: cookie_name: description: Name of the cookie used for sticky sessions. type: string default: HCLBSTICKY minLength: 1 maxLength: 100 example: HCLBSTICKY cookie_lifetime: description: Lifetime of the cookie used for sticky sessions (in seconds). type: integer default: 300 minimum: 30 maximum: 86400 example: 300 timeout_idle: description: Idle timeout in seconds for the client and server side. type: integer default: 50 example: 50 sticky_sessions: description: Use sticky sessions. type: boolean default: false example: true required: - cookie_name - cookie_lifetime - timeout_idle - sticky_sessions required: - http - title: LoadBalancerServiceHTTPSProtocol allOf: - type: object properties: protocol: description: Protocol of the Load Balancer. type: string enum: - tcp - http - https listen_port: description: Port the Load Balancer listens on. type: integer example: 443 destination_port: description: Port the Load Balancer will balance to. type: integer example: 80 proxyprotocol: description: Is Proxyprotocol enabled or not. type: boolean example: false health_check: title: LoadBalancerServiceHealthCheck description: Service health check. type: object properties: protocol: description: Type of the health check. type: string enum: - tcp - http example: http port: description: Port the health check will be performed on. type: integer example: 4711 interval: description: Time interval in seconds health checks are performed. type: integer minimum: 3 maximum: 60 example: 15 timeout: description: Time in seconds after an attempt is considered a timeout. type: integer minimum: 1 maximum: 60 example: 10 retries: description: Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again. type: integer minimum: 1 maximum: 5 example: 3 http: description: Additional configuration for protocol http. type: object properties: domain: description: Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. type: string nullable: true maxLength: 128 example: example.com path: description: HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. type: string minLength: 1 maxLength: 256 example: / response: description: String that must be contained in HTTP response in order to pass the health check. type: string maxLength: 256 example: '{"status": "ok"}' status_codes: description: List of returned HTTP status codes in order to pass the health check. Supports the wildcards `?` for exactly one character and `*` for multiple ones. type: array items: type: string default: - 2?? - 3?? maxItems: 20 example: - 2?? - 3?? tls: description: Use HTTPS for health check. type: boolean example: false additionalProperties: false required: - domain - path additionalProperties: false required: - protocol - port - interval - timeout - retries required: - protocol - listen_port - destination_port - proxyprotocol - health_check - type: object properties: protocol: type: string enum: - https example: https http: title: LoadBalancerServiceHTTPSConfig description: Configuration option for protocol https. type: object properties: cookie_name: description: Name of the cookie used for sticky sessions. type: string default: HCLBSTICKY minLength: 1 maxLength: 100 example: HCLBSTICKY cookie_lifetime: description: Lifetime of the cookie used for sticky sessions (in seconds). type: integer default: 300 minimum: 30 maximum: 86400 example: 300 timeout_idle: description: Idle timeout in seconds for the client and server side. type: integer default: 50 example: 50 certificates: description: IDs of the Certificates to use for TLS/SSL termination by the Load Balancer; empty for TLS/SSL passthrough. type: array items: type: integer format: int64 example: - 897 redirect_http: description: Redirect HTTP requests to HTTPS. type: boolean default: false example: true sticky_sessions: description: Use sticky sessions. type: boolean default: false example: true required: - cookie_name - cookie_lifetime - timeout_idle - certificates - redirect_http - sticky_sessions required: - http discriminator: propertyName: protocol mapping: tcp: '#/components/schemas/ServiceTCP' http: '#/components/schemas/ServiceHTTPProtocol' https: '#/components/schemas/ServiceHTTPSProtocol' targets: description: List of targets that belong to this Load Balancer. type: array items: title: LoadBalancerTarget oneOf: - title: LoadBalancerTargetTypeServer allOf: - type: object properties: type: description: Type of the resource. type: string enum: - server - label_selector - ip required: - type - type: object properties: type: type: string enum: - server example: server server: title: LoadBalancerTargetServer description: Server where the traffic should be routed to. Only present for target type "server". type: object properties: id: description: ID of the Server. type: integer format: int64 example: 80 required: - id health_status: title: LoadBalancerTargetHealthStatus description: List of health statuses of the services on this target. Only present for target types "server" and "ip". type: array items: type: object properties: listen_port: type: integer example: 443 status: type: string enum: - healthy - unhealthy - unknown example: healthy required: - listen_port - status use_private_ip: title: LoadBalancerTargetUsePrivateIP description: Use the private network IP instead of the public IP. Only present for target types "server" and "label_selector". type: boolean default: false required: - server - health_status - use_private_ip - title: LoadBalancerTargetTypeLabelSelector allOf: - type: object properties: type: description: Type of the resource. type: string enum: - server - label_selector - ip required: - type - type: object properties: type: type: string enum: - label_selector example: label_selector label_selector: title: LoadBalancerTargetLabelSelector description: Label selector used to determine targets. Only present for target type "label_selector". type: object properties: selector: description: Label selector. type: string minLength: 1 maxLength: 1000 example: env=prod required: - selector targets: description: List of resolved label selector target Servers. type: array items: title: LoadBalancerTargetTarget type: object properties: type: description: Type of the resource. Here always "server". type: string example: server server: title: LoadBalancerTargetServer description: Server where the traffic should be routed to. Only present for target type "server". type: object properties: id: description: ID of the Server. type: integer format: int64 example: 80 required: - id health_status: title: LoadBalancerTargetHealthStatus description: List of health statuses of the services on this target. Only present for target types "server" and "ip". type: array items: type: object properties: listen_port: type: integer example: 443 status: type: string enum: - healthy - unhealthy - unknown example: healthy required: - listen_port - status use_private_ip: title: LoadBalancerTargetUsePrivateIP description: Use the private network IP instead of the public IP. Only present for target types "server" and "label_selector". type: boolean default: false required: - type - server - health_status - use_private_ip use_private_ip: title: LoadBalancerTargetUsePrivateIP description: Use the private network IP instead of the public IP. Only present for target types "server" and "label_selector". type: boolean default: false required: - label_selector - targets - use_private_ip - title: LoadBalancerTargetTypeIP allOf: - type: object properties: type: description: Type of the resource. type: string enum: - server - label_selector - ip required: - type - type: object properties: type: type: string enum: - ip example: ip ip: title: LoadBalancerTargetIP description: IP target where the traffic should be routed to. It is only possible to use the (Public or vSwitch) IPs of Hetzner Online Root Servers belonging to the project owner. IPs belonging to other users are blocked. Additionally IPs belonging to services provided by Hetzner Cloud (Servers, Load Balancers, ...) are blocked as well. Only present for target type `ip`. type: object properties: ip: description: IP of a server that belongs to the same customer (public IPv4/IPv6) or private IP in a subnet type vswitch. type: string example: 203.0.113.1 required: - ip health_status: title: LoadBalancerTargetHealthStatus description: List of health statuses of the services on this target. Only present for target types "server" and "ip". type: array items: type: object properties: listen_port: type: integer example: 443 status: type: string enum: - healthy - unhealthy - unknown example: healthy required: - listen_port - status required: - ip - health_status discriminator: propertyName: type mapping: server: '#/components/schemas/TargetTypeServer' label_selector: '#/components/schemas/TargetTypeLabelSelector' ip: '#/components/schemas/TargetTypeIP' algorithm: description: Algorithm of the Load Balancer. type: object properties: type: description: Type of the algorithm. type: string enum: - round_robin - least_connections required: - type outgoing_traffic: description: Outbound Traffic for the current billing period in bytes. type: integer format: int64 nullable: true ingoing_traffic: description: Inbound Traffic for the current billing period in bytes. type: integer format: int64 nullable: true included_traffic: description: Free Traffic for the current billing period in bytes. type: integer format: int64 example: 10000 required: - id - name - public_net - private_net - location - load_balancer_type - protection - labels - created - services - targets - algorithm - outgoing_traffic - ingoing_traffic - included_traffic required: - load_balancer examples: default: value: load_balancer: id: 4711 name: new-name public_net: enabled: false ipv4: ip: 1.2.3.4 dns_ptr: lb1.example.com ipv6: ip: 2001:db8::1 dns_ptr: lb1.example.com private_net: - network: 4711 ip: 10.0.0.2 location: id: 1 name: fsn1 description: Falkenstein DC Park 1 country: DE city: Falkenstein latitude: 50.47612 longitude: 12.370071 network_zone: eu-central load_balancer_type: id: 1 name: lb11 description: LB11 max_connections: 20000 max_services: 5 max_targets: 25 max_assigned_certificates: 10 deprecated: '2016-01-30T23:50:00Z' prices: - location: fsn1 price_hourly: net: '1.0000000000' gross: '1.1900000000000000' price_monthly: net: '1.0000000000' gross: '1.1900000000000000' included_traffic: 654321 price_per_tb_traffic: net: '1.0000000000' gross: '1.1900000000000000' protection: delete: false labels: key: value created: '2016-01-30T23:50:00Z' services: - protocol: https listen_port: 443 destination_port: 80 proxyprotocol: false health_check: protocol: http port: 4711 interval: 15 timeout: 10 retries: 3 http: domain: example.com path: / response: '{"status": "ok"}' status_codes: - 2??,3?? tls: false http: cookie_name: HCLBSTICKY cookie_lifetime: 300 certificates: - 897 redirect_http: true sticky_sessions: true timeout_idle: 50 targets: - type: server server: id: 80 health_status: - listen_port: 443 status: healthy use_private_ip: true label_selector: selector: env=prod ip: ip: 203.0.113.1 targets: - type: server server: id: 80 health_status: - listen_port: 443 status: healthy use_private_ip: true algorithm: type: round_robin outgoing_traffic: 123456 ingoing_traffic: 123456 included_traffic: 654321 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\tloadBalancer, _, err := client.LoadBalancer.Update(ctx, &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerUpdateOpts{\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\tName: \"new-name\",\n\t})\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.load_balancers import LoadBalancer\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\nload_balancer = client.load_balancers.update(\n load_balancer=LoadBalancer(id=123),\n labels={\n \"environment\": \"prod\",\n \"example.com/my\": \"label\",\n \"just-a-key\": \"\",\n },\n name=\"new-name\",\n)" - lang: Shell label: CLI source: "hcloud load-balancer update $LOADBALANCER --name new-name\nhcloud load-balancer add-label --overwrite $LOADBALANCER \\\n \"environment=prod\" \"example.com/my=label\" \"just-a-key=\"\nhcloud load-balancer remove-label $LOADBALANCER \\\n \"environment\" \"example.com\" \"just-a-key\"" delete: operationId: delete_load_balancer summary: Delete a Load Balancer description: 'Deletes a Load Balancer. ' tags: - Load Balancers parameters: - description: ID of the Load Balancer. name: id in: path required: true schema: description: ID of the [Load Balancer](#tag/load-balancers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 responses: '204': description: Request succeeded. 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\t_, err := client.LoadBalancer.Delete(ctx, &hcloud.LoadBalancer{ID: 123})\n}" - lang: Python label: Python source: 'from __future__ import annotations from os import environ from hcloud import Client from hcloud.load_balancers import LoadBalancer token = environ["HCLOUD_TOKEN"] client = Client(token=token) client.load_balancers.delete(load_balancer=LoadBalancer(id=123))' - lang: Shell label: CLI source: hcloud load-balancer delete $LOADBALANCER /load_balancers/{id}/metrics: get: operationId: get_load_balancer_metrics summary: Get Metrics for a LoadBalancer description: 'You must specify the type of metric to get: `open_connections`, `connections_per_second`, `requests_per_second` or `bandwidth`. You can also specify more than one type by comma separation, e.g. `requests_per_second,bandwidth`. Depending on the type you will get different time series data: |Type | Timeseries | Unit | Description | |---- |------------|------|-------------| | open_connections | open_connections | number | Open connections | | connections_per_second | connections_per_second | connections/s | Connections per second | | requests_per_second | requests_per_second | requests/s | Requests per second | | bandwidth | bandwidth.in | bytes/s | Ingress bandwidth | || bandwidth.out | bytes/s | Egress bandwidth | Metrics are available for the last 30 days only. If you do not provide the step argument we will automatically adjust it so that 200 samples are returned. We limit the number of samples to a maximum of 500 and will adjust the step parameter accordingly. ' tags: - Load Balancers parameters: - description: ID of the Load Balancer. name: id in: path required: true schema: description: ID of the [Load Balancer](#tag/load-balancers). type: integer format: int64 minimum: 1 maximum: 9007199254740991 example: 42 - description: Type of metrics to get. name: type in: query required: true schema: type: array items: type: string enum: - open_connections - connections_per_second - requests_per_second - bandwidth - description: Start of period to get Metrics for (must be in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). name: start in: query required: true schema: type: string - description: End of period to get Metrics for (must be in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). name: end in: query required: true schema: type: string - description: Resolution of results in seconds. name: step in: query required: false schema: type: string responses: '200': description: Request succeeded. content: application/json: schema: type: object properties: metrics: type: object properties: start: description: Start of period of metrics reported (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2017-01-01T00:00:00Z' end: description: End of period of metrics reported (in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format). type: string format: date-time example: '2017-01-01T23:00:00Z' step: description: Resolution of results in seconds. type: number example: 60 time_series: description: Hash with timeseries information, containing the name of timeseries as key. type: object additionalProperties: type: object properties: values: type: array items: type: array items: oneOf: - type: number - type: string description: Metrics Timestamps with values. required: - values example: name_of_timeseries: values: - - 1435781470.622 - '42' - - 1435781471.622 - '43' required: - start - end - step - time_series required: - metrics 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\t\"time\"\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\tmetrics, _, err := client.LoadBalancer.GetMetrics(ctx, &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerGetMetricsOpts{\n\t\tStart: time.Date(2017, 1, 1, 0, 0, 0, 0, time.UTC),\n\t\tEnd: time.Date(2017, 1, 1, 23, 0, 0, 0, time.UTC),\n\t\tStep: 60,\n\t\tTypes: []hcloud.LoadBalancerMetricType{\n\t\t\thcloud.LoadBalancerMetricBandwidth,\n\t\t\thcloud.LoadBalancerMetricOpenConnections,\n\t\t\thcloud.LoadBalancerMetricConnectionsPerSecond,\n\t\t\thcloud.LoadBalancerMetricRequestsPerSecond,\n\t\t},\n\t})\n}" - lang: Python label: Python source: "from __future__ import annotations\n\nimport datetime\nfrom os import environ\n\nfrom hcloud import Client\nfrom hcloud.load_balancers import LoadBalancer\n\ntoken = environ[\"HCLOUD_TOKEN\"]\nclient = Client(token=token)\n\nresponse = client.load_balancers.get_metrics(\n load_balancer=LoadBalancer(id=123),\n start=datetime.datetime(2017, 1, 1, 0, 0, 0, 0, datetime.UTC),\n end=datetime.datetime(2017, 1, 1, 23, 0, 0, 0, datetime.UTC),\n step=60,\n type=[\n \"bandwidth\",\n \"open_connections\",\n \"connections_per_second\",\n \"requests_per_second\",\n ],\n)\n\nresponse.action.wait_until_finished()\n\nmetrics = response.metrics" - lang: Shell label: CLI source: "hcloud load-balancer metrics $LOADBALANCER \\\n --type open_connections,connections_per_second,requests_per_second,bandwidth \\\n --start 2017-01-01T00:00:00Z \\\n --end 2017-01-01T23:00:00Z" 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