godo.ReservedIPs.List()

Generated on 5 Nov 2026 from godo version v1.236.0

Usage

client.ReservedIPs.List(ctx context.Context, opt *godo.ListOptions) ([]godo.ReservedIP, *godo.Response, error)

Description

List all reserved IPs.

This method sends a GET request to /v2/reserved_ips.

Parameters

opt *godo.ListOptions

Fields of godo.ListOptions

ListOptions specifies the optional parameters to various List methods that support pagination.

Page int

For paginated result sets, page of results to retrieve.

PerPage int

For paginated result sets, the number of results to include per page.

WithProjects bool

Whether App responses should include project_id fields. The field will be empty if false or if omitted. (ListApps)

Deployed bool

This parameter is used to only list agents that are deployed in the response.

PublicOnly bool

This parameter is used to include models that are publicly available.

Usecases []string

This parameter is used to include models according to the use cases.

Returns

[]godo.ReservedIP
*godo.Response

The HTTP response, with pagination Links, Meta, and Rate limit information.

error

Non-nil when the request fails. API errors are returned as *godo.ErrorResponse.

Fields of godo.ReservedIP

ReservedIP represents a Digital Ocean reserved IP.

Region *godo.Region

JSON key: region

Droplet *godo.Droplet

JSON key: droplet

IP string

JSON key: ip

ProjectID string

JSON key: project_id

Locked bool

JSON key: locked

Request Sample

Show Request Sample
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/digitalocean/godo"
)

func main() {
	client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN"))
	ctx := context.TODO()

	result, _, err := client.ReservedIPs.List(ctx, &godo.ListOptions{Page: 1, PerPage: 50})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", result)
}

Pagination

This method returns one page of results. Response.Links carries the pagination state; loop until IsLastPage reports true.

Show Pagination Sample
opt := &godo.ListOptions{Page: 1, PerPage: 50}
for {
	items, resp, err := client.ReservedIPs.List(ctx, opt)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", items)

	if resp.Links == nil || resp.Links.IsLastPage() {
		break
	}
	page, err := resp.Links.CurrentPage()
	if err != nil {
		log.Fatal(err)
	}
	opt.Page = page + 1
}

Response Example

Show Response Example
{
  "reserved_ips": [
    {
      "ip": "45.55.96.47",
      "droplet": null,
      "region": {
        "name": "New York 3",
        "slug": "nyc3",
        "features": [
          "private_networking",
          "backups",
          "ipv6",
          "metadata",
          "install_agent",
          "storage",
          "image_transfer"
        ],
        "available": true,
        "sizes": [
          "s-1vcpu-1gb",
          "s-1vcpu-2gb",
          "s-1vcpu-3gb",
          "s-2vcpu-2gb",
          "s-3vcpu-1gb",
          "s-2vcpu-4gb",
          "s-4vcpu-8gb",
          "s-6vcpu-16gb",
          "s-8vcpu-32gb",
          "s-12vcpu-48gb",
          "s-16vcpu-64gb",
          "s-20vcpu-96gb",
          "s-24vcpu-128gb",
          "s-32vcpu-192g"
        ]
      },
      "locked": false,
      "project_id": "746c6152-2fa2-11ed-92d3-27aaa54e4988"
    }
  ],
  "links": {},
  "meta": {
    "total": 1
  }
}

More Information

See GET /v2/reserved_ips in the API reference for additional detail on responses, headers, parameters, and more.

See the Go package documentation for the source of this method.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.