This guide shows how to use the IP Addresses API to manage public IP blocks. Use it to manage public IP blocks through several operations.
All API requests in this guide are relative to:
https://api.phoenixnap.com/ips/v1Code language: HTTP (http)
Note
BYO IPs cannot be added or deleted via API while all other actions are supported. Please contact Support to board or delete a BYO IP block. All other actions remain available.
Prerequisites
BMC API access token with the bmc scope (see API credentials). Ensure there is an added payment method to your account.
Public IP Block Requirements
Use a CIDR block size based on the server operating system and IP version.
For IPv4, use one of the following options:
- /31 for Linux only.
- /30 for all operating systems.
- /29 for all operating systems.
- /28 for all operating systems.
For IPv6, use the /64 CIDR block size.
Purchase Public IP Blocks
Send a POST request to:
POST /ip-blocksCode language: HTTP (http)
The required properties are location and cidrBlockSize. Optionally, specify ipVersion, description, and tags.
Example: IPv4
{
"location": "PHX",
"cidrBlockSize": "/28",
"ipVersion": "V4",
"description": "IPv4 block example",
"tags": [
{
"name": "environment",
"value": "production"
}
]
}Code language: JSON / JSON with Comments (json)
Example: IPv6
{
"location": "PHX",
"cidrBlockSize": "/64",
"ipVersion": "V6",
"description": "IPv6 block example",
"tags": [
{
"name": "environment",
"value": "production"
}
]
}Code language: JSON / JSON with Comments (json)
The response shows the block's status as Unassigned because the allocation is not associated with a resource. Save the block ID for later use.
Find out more
View Public IP Blocks
To view all blocks, send a GET request to:
GET /ip-blocksCode language: HTTP (http)
Use the tag query parameter to filter IP blocks by tag name and value. For example:
GET /ips/v1/ip-blocks?tag=location.phoenixCode language: HTTP (http)
To view the details of a specific IP block, send a GET request to:
GET /ips/v1/ip-blocks/[IP_BLOCK_ID]Code language: HTTP (http)
Update Public IP Blocks
Send a PATCH request to:
PATCH /ip-blocks/[IP_BLOCK_ID]Code language: HTTP (http)
Specify the new description in the body, for example:
{
"description": "IP block updated description"
}Code language: JSON / JSON with Comments (json)
Find out more
Manage Tags
Send a PUT request to:
PUT /ip-blocks/[IP_BLOCK_ID]/tagsCode language: HTTP (http)
For example:
[
{
"name": "environment",
"value": "production"
},
{
"name": "location",
"value": "phoenix"
}
]Code language: JSON / JSON with Comments (json)
The request replaces existing tags. Any tag omitted from the request is unassigned. To keep the existing tags, you must specify them in the request body.
Find out more
Delete Public IP Blocks
Send a DELETE request to:
DELETE /ip-blocks/[IP_BLOCK_ID]Code language: HTTP (http)
Replace with the actual IP block ID. You can delete a public IP allocation only when its status is Unassigned and it does not belong to the BYO IP pool.
This action stops the IP hourly billing instantly.