Primary IP Actions

Assign a Primary IP to a resource

Assign a Primary IP to a resource.

A Server can only have one Primary IP of type ipv4 and one of type ipv6 assigned. If you need more IPs use Floating IPs.

A Server must be powered off (status off) in order for this operation to succeed.

Operation specific errors

StatusCodeDescription
422server_not_stoppedThe Server is running, but needs to be powered off
422primary_ip_already_assignedPrimary IP is already assigned to a different Server
422server_has_ipv4The Server already has an IPv4 address
422server_has_ipv6The Server already has an IPv6 address
post/primary_ips/{id}/actions/assign

Request

  • Base URL: https://api.hetzner.cloud/v1
  • URL: https://api.hetzner.cloud/v1/primary_ips/{id}/actions/assign
  • Auth: HTTP bearer

Path parameters

idinteger required

ID of the Primary IP.

Example:42

ID of the Primary IP.

Request body

assignee_type'server' required

Type of resource assigning the Primary IP to.

assignee_idinteger required

ID of a resource of type assignee_type.

Example request

{
  "assignee_type": "server",
  "assignee_id": 4711
}

Response

Request succeeded.

Example response

{
  "action": {
    "id": 42,
    "command": "start_resource",
    "started": "2016-01-30T23:55:00Z",
    "finished": "2016-01-30T23:55:00Z",
    "progress": 100,
    "resources": [
      {
        "id": 42,
        "type": "server"
      }
    ],
    "error": {
      "code": "action_failed",
      "message": "Action failed"
    }
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.