Primary IPs
Create a Primary IP
Create a new Primary IP.
Can optionally be assigned to a resource by providing an assignee_id and assignee_type.
If not assigned to a resource the location key needs to be provided. This can be either the ID or the name of the Location this Primary IP shall be created in.
A Primary IP can only be assigned to resource in the same Location later on.
Operation specific errors
| Status | Code | Description |
|---|---|---|
| 422 | server_not_stopped | The specified Server is running, but needs to be powered off |
| 422 | server_has_ipv4 | The Server already has an ipv4 address |
| 422 | server_has_ipv6 | The Server already has an ipv6 address |
post/primary_ips
Request
- Base URL: https://api.hetzner.cloud/v1
- URL: https://api.hetzner.cloud/v1/primary_ips
- Auth: HTTP bearer
Request body
Example request
{
"name": "my-resource",
"labels": {
"environment": "prod",
"example.com/my": "label",
"just-a-key": ""
},
"type": "ipv6",
"location": "fsn1",
"assignee_type": "server",
"assignee_id": 17
}Response
Request succeeded.
Example response
{
"primary_ip": {
"id": 42,
"name": "my-resource",
"labels": {
"environment": "prod",
"example.com/my": "label",
"just-a-key": ""
},
"created": "2016-01-30T23:55: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"
},
"ip": "2001:db8::/64",
"dns_ptr": [
{
"ip": "2001:db8::1",
"dns_ptr": "server.example.com"
}
],
"type": "ipv6",
"auto_delete": true,
"assignee_type": "server",
"assignee_id": 17
},
"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.