### Label Selectors Examples Source: https://docs.hetzner.cloud/reference/hetzner Examples of how to use label selectors to filter resources. ```APIDOC ### Examples * Returns all resources that have a `env=production` label and that don't have a `type=database` label: `env=production,type!=database` * Returns all resources that have a `env=testing` or `env=staging` label: `env in (testing,staging)` * Returns all resources that don't have a `type` label: `!type` ``` -------------------------------- ### Example Storage Boxes Response Source: https://docs.hetzner.cloud/reference/hetzner This is an example of a successful response when retrieving Storage Boxes. It includes an empty list and pagination metadata. ```json { "storage_boxes": [], "meta": { "pagination": { "page": 1, "per_page": 25, "previous_page": null, "next_page": null, "last_page": 1, "total_entries": 0 } } } ``` -------------------------------- ### Example Labels Structure Source: https://docs.hetzner.cloud/reference/hetzner This JSON object demonstrates the structure for applying labels to Hetzner Cloud resources, including valid key and value formats. ```json { "labels": { "environment": "development", "service": "backend", "example.com/my": "label", "just-a-key": "" } } ``` -------------------------------- ### Example Link Header for Pagination Source: https://docs.hetzner.cloud/reference/hetzner Demonstrates the format of the 'Link' header used for API pagination, providing URIs for previous, next, and last pages. ```http Link: ; rel="prev", ; rel="next", ; rel="last" ``` -------------------------------- ### Example Authorization Header Source: https://docs.hetzner.cloud/reference/hetzner This is an example of the required Authorization header format for authenticating API requests. Replace the token with your generated API token. ```http Authorization: Bearer LRK9DAWQ1ZAEFSrCNEEzLCUwhYX1U3g7wMg4dTlkkDC96fyDuyJ39nVbVjCKSDfj ``` -------------------------------- ### Example JSON Response with Pagination Source: https://docs.hetzner.cloud/reference/hetzner Illustrates the structure of a JSON response that includes pagination metadata within the 'meta' object. ```json { "storage_boxes": [...], "meta": { "pagination": { "page": 2, "per_page": 25, "previous_page": 1, "next_page": 3, "last_page": 4, "total_entries": 100 } } } ``` -------------------------------- ### Example Error Response Source: https://docs.hetzner.cloud/reference/hetzner This is an example of an error response from the API, indicating an 'invalid_input' error with details about the problematic field. ```json { "error": { "code": "invalid_input", "message": "invalid input in field 'broken_field': is too long", "details": { "fields": [ { "name": "broken_field", "messages": ["is too long"] } ] } } } ``` -------------------------------- ### List Storage Boxes Source: https://docs.hetzner.cloud/reference/hetzner This example demonstrates how to retrieve a list of all Storage Boxes within your project using a curl command. It includes the necessary Authorization header and the endpoint for listing storage boxes. ```APIDOC ## GET /v1/storage_boxes ### Description Retrieves a list of all Storage Boxes associated with the project. ### Method GET ### Endpoint https://api.hetzner.com/v1/storage_boxes ### Query Parameters #### Pagination - **page** (int) - Optional - The page number to retrieve. - **page_size** (int) - Optional - The number of items to return per page. ### Request Example ```bash curl -H "Authorization: Bearer YOUR_API_TOKEN" \ https://api.hetzner.com/v1/storage_boxes ``` ### Response #### Success Response (200) - **storage_boxes** (array) - A list of storage box objects. - **meta** (object) - Contains pagination information. - **pagination** (object) - **page** (int) - Current page number. - **per_page** (int) - Number of items per page. - **previous_page** (int|null) - Previous page number or null if on the first page. - **next_page** (int|null) - Next page number or null if on the last page. - **last_page** (int) - The last page number. - **total_entries** (int) - Total number of entries. #### Response Example ```json { "storage_boxes": [], "meta": { "pagination": { "page": 1, "per_page": 25, "previous_page": null, "next_page": null, "last_page": 1, "total_entries": 0 } } } ``` ``` -------------------------------- ### Example Sorting API Requests Source: https://docs.hetzner.cloud/reference/hetzner Shows how to use the 'sort' query parameter to order API responses by one or more fields, with options for ascending and descending directions. ```http https://api.hetzner.com/v1/storage_boxes?sort=status ``` ```http https://api.hetzner.com/v1/storage_boxes?sort=status:asc ``` ```http https://api.hetzner.com/v1/storage_boxes?sort=status:desc ``` ```http https://api.hetzner.com/v1/storage_boxes?sort=status:asc&sort=command:desc ``` -------------------------------- ### Make a GET Request for Storage Boxes Source: https://docs.hetzner.cloud/reference/hetzner Use this curl command to retrieve a list of all Storage Boxes in your project. Ensure you replace the placeholder token with your actual API token. ```bash curl -H "Authorization: Bearer LRK9DAWQ1ZAEFSrCNEEzLCUwhYX1U3g7wMg4dTlkkDC96fyDuyJ39nVbVjCKSDfj" \ https://api.hetzner.com/v1/storage_boxes ``` -------------------------------- ### Filter by Label Selector Source: https://docs.hetzner.cloud/reference/hetzner Example of using the 'label_selector' query parameter with URI encoding to filter resources by labels. ```http https://api.hetzner.com/v1/storage_boxes?label_selector=key%3Dvalue ``` -------------------------------- ### Get Storage Box by ID in Go Source: https://docs.hetzner.cloud/reference/hetzner Retrieves a specific Storage Box using its ID. Ensure the HCLOUD_TOKEN environment variable is set. ```Go package examples import ( "context" "os" "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func main() { token := os.Getenv("HCLOUD_TOKEN") client := hcloud.NewClient(hcloud.WithToken(token)) ctx := context.TODO() storageBox, _, err := client.StorageBox.GetByID(ctx, 123) } ``` -------------------------------- ### Paginate Storage Boxes Results Source: https://docs.hetzner.cloud/reference/hetzner Example of using query parameters to specify the page number and the number of items per page for paginated results. ```http https://api.hetzner.com/v1/storage_boxes?page=1&page_size=12 ``` -------------------------------- ### Get a Storage Box by ID Source: https://docs.hetzner.cloud/reference/hetzner Retrieves the details of a specific Storage Box using its unique identifier. This operation allows you to fetch all configuration and status information for a given Storage Box. ```APIDOC ## GET /storage_boxes/{id} ### Description Returns a specific Storage Box. ### Method GET ### Endpoint /storage_boxes/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - ID of the Storage Box. ### Response #### Success Response (200) - **storage_box** (object) - Contains the details of the Storage Box. - **id** (integer) - Unique identifier of the Storage Box. - **name** (string) - Name of the Storage Box. - **storage_box_type** (object) - Information about the Storage Box type. - **location** (object) - Information about the location of the Storage Box. - **access_settings** (object) - Settings for accessing the Storage Box. - **snapshot_plan** (object) - Configuration for automated snapshots. - **protection** (object) - Protection settings, e.g., against deletion. - **labels** (object) - User-defined labels for the Storage Box. - **status** (string) - Current status of the Storage Box (e.g., "active"). - **username** (string) - Username for accessing the Storage Box. - **server** (string) - Server hostname for the Storage Box. - **system** (string) - System identifier for the Storage Box. - **stats** (object) - Statistics about the Storage Box usage. - **created** (string) - Timestamp when the Storage Box was created. ### Request Example ```go package examples import ( "context" "os" "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func main() { token := os.Getenv("HCLOUD_TOKEN") client := hcloud.NewClient(hcloud.WithToken(token)) ctx := context.TODO() storageBox, _, err := client.StorageBox.GetByID(ctx, 123) } ``` ``` -------------------------------- ### Create a Storage Box with Go Source: https://docs.hetzner.cloud/reference/hetzner Use this snippet to create a new Storage Box. Configure name, location, type, password, access settings, and SSH keys. The action is asynchronous; use Action.WaitFor to ensure completion. ```Go package examples import ( "context" "os" "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func main() { token := os.Getenv("HCLOUD_TOKEN") client := hcloud.NewClient(hcloud.WithToken(token)) ctx := context.TODO() result, _, err := client.StorageBox.Create(ctx, hcloud.StorageBoxCreateOpts{ Name: "string", Location: &hcloud.Location{Name: "fsn1"}, StorageBoxType: &hcloud.StorageBoxType{ Name: "bx11", }, Labels: map[string]string{ "environment": "prod", "example.com/my": "label", "just-a-key": "", }, Password: "my-password", AccessSettings: &hcloud.StorageBoxCreateOptsAccessSettings{ ReachableExternally: hcloud.Ptr(false), SambaEnabled: hcloud.Ptr(false), SSHEnabled: hcloud.Ptr(false), WebDAVEnabled: hcloud.Ptr(false), ZFSEnabled: hcloud.Ptr(false), }, SSHKeys: []*hcloud.SSHKey{ {PublicKey: "ssh-rsa AAAjjk76kgf...Xt"}, }, }) err = client.Action.WaitFor(ctx, result.Action) storageBox := result.StorageBox } ``` -------------------------------- ### Sort Storage Boxes by Multiple Fields Source: https://docs.hetzner.cloud/reference/hetzner Demonstrates how to use multiple 'sort' query parameters to define a sorting order for the response. ```http https://api.hetzner.com/v1/storage_boxes?sort=id&sort=name ``` -------------------------------- ### List All Storage Boxes in Go Source: https://docs.hetzner.cloud/reference/hetzner Use this Go snippet to retrieve a list of all available Storage Boxes. Ensure the HCLOUD_TOKEN environment variable is set with your API token. ```go package examples import ( "context" "os" "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func main() { token := os.Getenv("HCLOUD_TOKEN") client := hcloud.NewClient(hcloud.WithToken(token)) ctx := context.TODO() storageBoxes, err := client.StorageBox.All(ctx) } ``` -------------------------------- ### List Storage Box Folders in Go Source: https://docs.hetzner.cloud/reference/hetzner Use this snippet to list folders within a specific Storage Box. Ensure the HCLOUD_TOKEN environment variable is set. ```Go package examples import ( "context" "os" "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func main() { token := os.Getenv("HCLOUD_TOKEN") client := hcloud.NewClient(hcloud.WithToken(token)) ctx := context.TODO() result, _, err := client.StorageBox.Folders(ctx, &hcloud.StorageBox{ID: 123}, hcloud.StorageBoxFoldersOpts{ Path: ".", }) folders := result.Folders } ``` -------------------------------- ### Create Storage Box Source: https://docs.hetzner.cloud/reference/hetzner Creates a new Storage Box with specified configurations including name, location, type, password, access settings, and SSH keys. ```APIDOC ## POST /storage/boxes ### Description Creates a Storage Box. ### Method POST ### Endpoint /storage/boxes ### Parameters #### Request Body - **location** (string) - Required - ID or Name of Location. - **name** (string) - Required - Name of the Storage Box. - **password** (string) - Required - Password of the Storage Box. - **storage_box_type** (string) - Required - ID or Name of the Storage Box Type. - **access_settings** (object) - Optional - Access settings of the Storage Box. - **labels** (object) - Optional - User-defined labels (`key/value` pairs) for the Resource. - **ssh_keys** (array string[]) - Optional - SSH public keys in OpenSSH format to inject into the Storage Box. ### Request Example ```go package examples import ( "context" "os" "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func main() { token := os.Getenv("HCLOUD_TOKEN") client := hcloud.NewClient(hcloud.WithToken(token)) ctx := context.TODO() result, _, err := client.StorageBox.Create(ctx, hcloud.StorageBoxCreateOpts{ Name: "string", Location: &hcloud.Location{Name: "fsn1"}, StorageBoxType: &hcloud.StorageBoxType{ Name: "bx11", }, Labels: map[string]string{ "environment": "prod", "example.com/my": "label", "just-a-key": "", }, Password: "my-password", AccessSettings: &hcloud.StorageBoxCreateOptsAccessSettings{ ReachableExternally: hcloud.Ptr(false), SambaEnabled: hcloud.Ptr(false), SSHEnabled: hcloud.Ptr(false), WebDAVEnabled: hcloud.Ptr(false), ZFSEnabled: hcloud.Ptr(false), }, SSHKeys: []*hcloud.SSHKey{ {PublicKey: "ssh-rsa AAAjjk76kgf...Xt"}, }, }) err = client.Action.WaitFor(ctx, result.Action) storageBox := result.StorageBox } ``` ### Response #### Success Response (201) Application JSON ```json { "storage_box": { "id": 42, "status": "initializing", "name": "my-resource", "username": "u45321", "storage_box_type": { "id": 1, "name": "bx20", "description": "BX20", "snapshot_limit": 10, "automatic_snapshot_limit": 10, "subaccounts_limit": 100, "size": 1073741824, "prices": [ { "location": "fsn1", "price_hourly": { "gross": "0.0061", "net": "0.0051" }, "price_monthly": { "gross": "3.8080", "net": "3.2000" }, "setup_fee": { "gross": "0.0000", "net": "0.0000" } } ], "deprecation": null }, "location": { "id": 1, "country": "DE", "city": "Falkenstein", "name": "fsn1", "network_zone": "eu-central", "latitude": 50.476119, "longitude": 12.370071, "description": "Falkenstein DC Park 1" }, "access_settings": { "reachable_externally": false, "samba_enabled": false, "ssh_enabled": false, "webdav_enabled": false, "zfs_enabled": false }, "server": null, "system": null, "stats": { "size": 0, "size_data": 0, "size_snapshots": 0 }, "labels": { "environment": "prod", "example.com/my": "label", "just-a-key": "" }, "protection": { "delete": false }, "snapshot_plan": null, "created": "2016-01-30T23:50:00Z" }, "action": { "id": 13, "command": "create", "status": "running", "progress": 0, "started": "2016-01-30T23:50:00Z", "finished": null, "resources": [ { "id": 42, "type": "storage_box" } ], "error": null } } ``` #### Error Response (4xx, 5xx) Application JSON ``` -------------------------------- ### Pagination Source: https://docs.hetzner.cloud/reference/hetzner Information on how to paginate through responses that return multiple items. ```APIDOC ## Pagination Responses which return multiple items support pagination. If they do support pagination, it can be controlled with following query string parameters: * A `page` parameter specifies the page to fetch. The number of the first page is 1. * 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. Responses contain a `Link` header with pagination information. Additionally, 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: **Example Pagination** ```json { "storage_boxes": [...], "meta": { "pagination": { "page": 2, "per_page": 25, "previous_page": 1, "next_page": 3, "last_page": 4, "total_entries": 100 } } } ``` The 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. **Example Pagination Link header** ``` Link: ; rel="prev", ; rel="next", ; rel="last" ``` Line breaks have been added for display purposes only and responses may only contain some of the above `rel` values. ``` -------------------------------- ### Filter Resources by Labels Source: https://docs.hetzner.cloud/reference/hetzner Use label selectors to filter resources. Supports inclusion and exclusion of specific labels, as well as logical OR operations. ```text env=production,type!=database ``` ```text env in (testing,staging) ``` ```text !type ``` -------------------------------- ### Update a Storage Box Source: https://docs.hetzner.cloud/reference/hetzner Use this to update the name and labels of an existing Storage Box. Ensure the HCLOUD_TOKEN environment variable is set. ```Go package examples import ( "context" "os" "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func main() { token := os.Getenv("HCLOUD_TOKEN") client := hcloud.NewClient(hcloud.WithToken(token)) ctx := context.TODO() storageBox, _, err := client.StorageBox.Update(ctx, &hcloud.StorageBox{ID: 123}, hcloud.StorageBoxUpdateOpts{ Name: "string", Labels: map[string]string{ "environment": "prod", "example.com/my": "label", "just-a-key": "", }, }) } ``` -------------------------------- ### List folders of a Storage Box Source: https://docs.hetzner.cloud/reference/hetzner Returns a list of (sub)folders in a Storage Box. The folder location is specified by the `path` query parameter. ```APIDOC ## GET /storage_boxes/{id}/folders ### Description Returns a list of (sub)folders in a Storage Box. ### Method GET ### Endpoint /storage_boxes/{id}/folders ### Parameters #### Path Parameters - **id** (integer) - Required - ID of the Storage Box. #### Query Parameters - **path** (string) - Optional - Relative path for which the listing is to be made. Defaults to ".". ### Response #### Success Response (200) - **folders** (array) - List of folder names. ### Response Example ```json { "folders": [ "offsite-backup", "photos" ] } ``` ``` -------------------------------- ### Storage Boxes Operations Source: https://docs.hetzner.cloud/reference/hetzner This section details the available operations for managing Storage Boxes via the Hetzner Cloud API. ```APIDOC ## Storage Boxes Operations This section details the available operations for managing Storage Boxes via the Hetzner Cloud API. ### GET /storage_boxes **Description**: Retrieves a list of all storage boxes. **Method**: GET **Endpoint**: `/storage_boxes` ### POST /storage_boxes **Description**: Creates a new storage box. **Method**: POST **Endpoint**: `/storage_boxes` ### GET /storage_boxes/{id} **Description**: Retrieves details of a specific storage box by its ID. **Method**: GET **Endpoint**: `/storage_boxes/{id}` ### PUT /storage_boxes/{id} **Description**: Updates an existing storage box by its ID. **Method**: PUT **Endpoint**: `/storage_boxes/{id}` ### DELETE /storage_boxes/{id} **Description**: Deletes a storage box by its ID. **Method**: DELETE **Endpoint**: `/storage_boxes/{id}` ### GET /storage_boxes/{id}/folders **Description**: Retrieves a list of folders within a specific storage box. **Method**: GET **Endpoint**: `/storage_boxes/{id}/folders` ``` -------------------------------- ### List Storage Boxes Source: https://docs.hetzner.cloud/reference/hetzner Retrieves a paginated list of Storage Boxes. You can filter, sort, and paginate the results. ```APIDOC ## GET /storage_boxes ### Description Returns a paginated list of Storage Boxes. ### Method GET ### Endpoint /storage_boxes ### Parameters #### Query Parameters - **name** (string) - Optional - Filter resources by their name. The response will only contain the resources matching exactly the specified name. - **label_selector** (string) - Optional - Filter resources by labels. The response will only contain resources matching the label selector. For more information, see "Label Selector". - **sort** (array string[]) - Optional - Sort resources by field and direction. May be used multiple times. Possible values: `id`, `id:asc`, `id:desc`, `name`, `name:asc`, `name:desc`. - **page** (integer) - Optional - Page number to return. Default: 1. For more information, see "Pagination". - **per_page** (integer) - Optional - Maximum number of entries returned per page. Default: 25. For more information, see "Pagination". ### Response #### Success Response (200) - **storage_boxes** (array) - List of storage boxes. - **meta** (object) - Pagination information. #### Response Example ```json { "storage_boxes": [ { "id": 42, "name": "string", "storage_box_type": { "id": 42, "name": "bx11", "description": "BX11", "snapshot_limit": 10, "automatic_snapshot_limit": 10, "subaccounts_limit": 200, "size": 1073741824, "prices": [ { "location": "fsn1", "price_hourly": { "net": "1.0000", "gross": "1.1900" }, "price_monthly": { "net": "1.0000", "gross": "1.1900" }, "setup_fee": { "net": "1.0000", "gross": "1.1900" } } ], "deprecation": { "unavailable_after": "2023-09-01T00:00:00Z", "announced": "2023-06-01T00:00:00Z" } }, "location": { "id": 42, "name": "fsn1", "description": "Falkenstein DC Park 1", "country": "DE", "city": "Falkenstein", "latitude": 50.47612, "longitude": 12.370071, "network_zone": "eu-central" }, "access_settings": { "reachable_externally": true, "samba_enabled": true, "ssh_enabled": true, "webdav_enabled": true, "zfs_enabled": true }, "snapshot_plan": { "max_snapshots": 10, "minute": 30, "hour": 3, "day_of_week": 7, "day_of_month": null }, "protection": { "delete": false }, "labels": { "environment": "prod", "example.com/my": "label", "just-a-key": "" }, "status": "active", "username": "u12345", "server": "u1337.your-storagebox.de", "system": "FSN1-BX355", "stats": { "size": 1, "size_data": 1, "size_snapshots": 1 }, "created": "2016-01-30T23:55:00Z" } ], "meta": { "pagination": { "page": 3, "per_page": 25, "previous_page": 2, "next_page": 4, "last_page": 4, "total_entries": 100 } } } ``` #### Error Responses - **4xx**: Request failed with a user error. (application/json) - **5xx**: Request failed with a server error. (application/json) ``` -------------------------------- ### Sorting Source: https://docs.hetzner.cloud/reference/hetzner Details on how to sort responses that return multiple items. ```APIDOC ## Sorting Some 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. **Example: Sorting** ``` https://api.hetzner.com/v1/storage_boxes?sort=status https://api.hetzner.com/v1/storage_boxes?sort=status:asc https://api.hetzner.com/v1/storage_boxes?sort=status:desc https://api.hetzner.com/v1/storage_boxes?sort=status:asc&sort=command:desc ``` ``` -------------------------------- ### Delete a Storage Box Source: https://docs.hetzner.cloud/reference/hetzner Use this to delete a Storage Box. The operation is asynchronous, and you can wait for its completion using client.Action.WaitFor. Ensure the HCLOUD_TOKEN environment variable is set. ```Go package examples import ( "context" "os" "github.com/hetznercloud/hcloud-go/v2/hcloud" ) func main() { token := os.Getenv("HCLOUD_TOKEN") client := hcloud.NewClient(hcloud.WithToken(token)) ctx := context.TODO() result, _, err := client.StorageBox.Delete(ctx, &hcloud.StorageBox{ID: 123}) err = client.Action.WaitFor(ctx, result.Action) } ``` -------------------------------- ### Resource Limit Exceeded Error Response Source: https://docs.hetzner.cloud/reference/hetzner This JSON structure is returned when an attempt is made to create a resource that would exceed the account's defined limits. ```json { "error": { "code": "resource_limit_exceeded", "message": "project limit exceeded", "details": { "limits": [ { "name": "project_limit" } ] } } } ``` -------------------------------- ### Rate Limiting Source: https://docs.hetzner.cloud/reference/hetzner Information about the rate limiting applied to API requests. ```APIDOC ## Rate Limiting All 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. * The `RateLimit-Limit` header contains the total number of requests you can perform per hour. * The `RateLimit-Remaining` header contains the number of requests remaining in the current rate limit time frame. * 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. The 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. ``` -------------------------------- ### Storage Boxes API Response Schema Source: https://docs.hetzner.cloud/reference/hetzner This JSON schema outlines the structure of the response when listing Storage Boxes. It includes details about individual storage boxes, their types, locations, access settings, labels, and pagination metadata. ```json { "storage_boxes": [ { "id": 42, "name": "string", "storage_box_type": { "id": 42, "name": "bx11", "description": "BX11", "snapshot_limit": 10, "automatic_snapshot_limit": 10, "subaccounts_limit": 200, "size": 1073741824, "prices": [ { "location": "fsn1", "price_hourly": { "net": "1.0000", "gross": "1.1900" }, "price_monthly": { "net": "1.0000", "gross": "1.1900" }, "setup_fee": { "net": "1.0000", "gross": "1.1900" } } ], "deprecation": { "unavailable_after": "2023-09-01T00:00:00Z", "announced": "2023-06-01T00:00:00Z" } }, "location": { "id": 42, "name": "fsn1", "description": "Falkenstein DC Park 1", "country": "DE", "city": "Falkenstein", "latitude": 50.47612, "longitude": 12.370071, "network_zone": "eu-central" }, "access_settings": { "reachable_externally": true, "samba_enabled": true, "ssh_enabled": true, "webdav_enabled": true, "zfs_enabled": true }, "snapshot_plan": { "max_snapshots": 10, "minute": 30, "hour": 3, "day_of_week": 7, "day_of_month": null }, "protection": { "delete": false }, "labels": { "environment": "prod", "example.com/my": "label", "just-a-key": "" }, "status": "active", "username": "u12345", "server": "u1337.your-storagebox.de", "system": "FSN1-BX355", "stats": { "size": 1, "size_data": 1, "size_snapshots": 1 }, "created": "2016-01-30T23:55:00Z" } ], "meta": { "pagination": { "page": 3, "per_page": 25, "previous_page": 2, "next_page": 4, "last_page": 4, "total_entries": 100 } } } ``` -------------------------------- ### Update a Storage Box Source: https://docs.hetzner.cloud/reference/hetzner Updates an existing Storage Box by its ID. This operation allows modification of the box's name and labels. The provided labels will overwrite any existing labels. ```APIDOC ## PUT /storage_boxes/{id} ### Description Updates a Storage Box. ### Method PUT ### Endpoint `/storage_boxes/{id}` ### Parameters #### Path Parameters - **id** (integer) - Required - ID of the Storage Box. #### Request Body - **name** (string) - Optional - Name of the Storage Box. - **labels** (object) - Optional - User-defined labels (`key/value` pairs) for the Resource. The set of Labels provided in the request will overwrite the existing one. ### Request Example ```json { "name": "string", "labels": { "environment": "prod", "example.com/my": "label", "just-a-key": "" } } ``` ### Response #### Success Response (200) - **storage_box** (object) - Details of the updated Storage Box. #### Response Example ```json { "storage_box": { "id": 42, "name": "string", "storage_box_type": { "id": 42, "name": "bx11", "description": "BX11", "snapshot_limit": 10, "automatic_snapshot_limit": 10, "subaccounts_limit": 200, "size": 1073741824, "prices": [ { "location": "fsn1", "price_hourly": { "net": "1.0000", "gross": "1.1900" }, "price_monthly": { "net": "1.0000", "gross": "1.1900" }, "setup_fee": { "net": "1.0000", "gross": "1.1900" } } ], "deprecation": { "unavailable_after": "2023-09-01T00:00:00Z", "announced": "2023-06-01T00:00:00Z" } }, "location": { "id": 42, "name": "fsn1", "description": "Falkenstein DC Park 1", "country": "DE", "city": "Falkenstein", "latitude": 50.47612, "longitude": 12.370071, "network_zone": "eu-central" }, "access_settings": { "reachable_externally": true, "samba_enabled": true, "ssh_enabled": true, "webdav_enabled": true, "zfs_enabled": true }, "snapshot_plan": { "max_snapshots": 10, "minute": 30, "hour": 3, "day_of_week": 7, "day_of_month": null }, "protection": { "delete": false }, "labels": { "environment": "prod", "example.com/my": "label", "just-a-key": "" }, "status": "active", "username": "u12345", "server": "u1337.your-storagebox.de", "system": "FSN1-BX355", "stats": { "size": 1, "size_data": 1, "size_snapshots": 1 }, "created": "2016-01-30T23:55:00Z" } } ``` ``` -------------------------------- ### Delete a Storage Box Source: https://docs.hetzner.cloud/reference/hetzner Deletes a Storage Box identified by its ID. This action is irreversible. ```APIDOC ## DELETE /storage_boxes/{id} ### Description Deletes a Storage Box. ### Method DELETE ### Endpoint `/storage_boxes/{id}` ### Parameters #### Path Parameters - **id** (integer) - Required - ID of the Storage Box. ### Response #### Success Response (201) - **action** (object) - An object containing information about the delete action. #### Response Example ```json { "action": { "id": 13, "command": "delete", "status": "success", "progress": 0, "started": "2016-01-30T23:50:00Z", "finished": null, "resources": [ { "id": 42, "type": "storage_box" } ], "error": null } } ``` ``` -------------------------------- ### Storage Box JSON Schema Source: https://docs.hetzner.cloud/reference/hetzner Defines the structure of a Storage Box object returned by the API. ```JSON { "storage_box": { "id": 42, "name": "string", "storage_box_type": { "id": 42, "name": "bx11", "description": "BX11", "snapshot_limit": 10, "automatic_snapshot_limit": 10, "subaccounts_limit": 200, "size": 1073741824, "prices": [ { "location": "fsn1", "price_hourly": { "net": "1.0000", "gross": "1.1900" }, "price_monthly": { "net": "1.0000", "gross": "1.1900" }, "setup_fee": { "net": "1.0000", "gross": "1.1900" } } ], "deprecation": { "unavailable_after": "2023-09-01T00:00:00Z", "announced": "2023-06-01T00:00:00Z" } }, "location": { "id": 42, "name": "fsn1", "description": "Falkenstein DC Park 1", "country": "DE", "city": "Falkenstein", "latitude": 50.47612, "longitude": 12.370071, "network_zone": "eu-central" }, "access_settings": { "reachable_externally": true, "samba_enabled": true, "ssh_enabled": true, "webdav_enabled": true, "zfs_enabled": true }, "snapshot_plan": { "max_snapshots": 10, "minute": 30, "hour": 3, "day_of_week": 7, "day_of_month": null }, "protection": { "delete": false }, "labels": { "environment": "prod", "example.com/my": "label", "just-a-key": "" }, "status": "active", "username": "u12345", "server": "u1337.your-storagebox.de", "system": "FSN1-BX355", "stats": { "size": 1, "size_data": 1, "size_snapshots": 1 }, "created": "2016-01-30T23:55:00Z" } } ``` -------------------------------- ### Deprecated API Endpoint Error Response Source: https://docs.hetzner.cloud/reference/hetzner This JSON structure indicates that the requested API endpoint is deprecated and has been removed. ```json { "error": { "code": "deprecated_api_endpoint", "message": "API functionality was removed", "details": { "announcement": "https://docs.hetzner.cloud/changelog#2023-07-20-foo-endpoint-is-deprecated" } } } ``` -------------------------------- ### Uniqueness Error Response Source: https://docs.hetzner.cloud/reference/hetzner This JSON structure indicates an error where a resource field that must be unique already exists with the provided value. ```json { "error": { "code": "uniqueness_error", "message": "SSH key with the same fingerprint already exists", "details": { "fields": [ { "name": "public_key" } ] } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.