Skip to content

Ports API reference

See https://docs.openstack.org/api-ref/network/.

These endpoints allow you to list existing ports, show details of a specific port, create a new port, update an existing port, and delete a port in the Network service.

In these endpoints, {port_id} is the ID of the port, "network_id" is the ID of the network to which the port is attached, "subnet_id" is the ID of the subnet from which the IP address is allocated, "ip_address" is the specific IP address assigned to the port (optional), "security_group_id" is the ID of the security group associated with the port, and "device_id" is the ID of the device (such as a VM or router) to which the port is attached.

List ports

Bash
GET /v2.0/ports

Show port details

Bash
GET /v2.0/ports/{port_id}

Create a port

Bash
 POST /v2.0/ports

Request body

JSON
{
 "port": {
   "network_id": "network_id",
   "name": "port_name",
   "admin_state_up": true,
   "fixed_ips": [{"subnet_id": "subnet_id", "ip_address": "ip_address"}],
   "security_groups": ["security_group_id"],
   "device_id": "device_id"
 }
}

Update a port

Bash
PUT /v2.0/ports/{port_id}

Request body

JSON
{
 "port": {
   "name": "new_port_name",
   "fixed_ips": [{"subnet_id": "new_subnet_id", "ip_address": "new_ip_address"}],
   "security_groups": ["new_security_group_id"]
 }
}

Delete a port

Bash
DELETE /v2.0/ports/{port_id}`