pydo.projects.list_resources()

Generated on 3 Aug 2026 from pydo version v0.40.0

Usage

client.projects.list_resources(
    project_id="4de7ac8b-495b-4884-9a69-1050c6793cd6",
    per_page=20,
    page=1,
)
Returns JSONRaises HttpResponseError

Description

To list all your resources in a project, send a GET request to /v2/projects/{project_id}/resources.

This endpoint will only return resources that you are authorized to see. For example, to see Droplets in a project, include the droplet:read scope.

Parameters

project_id string required

A unique identifier for a project.

Min: 1

per_page integer optional

Number of items returned per page

Min: 1

Max: 200

Default: 20

page integer optional

Which 'page' of paginated results to return.

Min: 1

Default: 1

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

resp = client.projects.list_resources(project_id="4e1bfbc3")

Pagination

This method returns paginated results. The response includes a links.pages object with URLs for navigating between pages. To retrieve the next page, parse the next URL and pass the page parameter:

from urllib.parse import urlparse, parse_qs

resp = client.projects.list_resources(project_id="4de7ac8b-495b-4884-9a69-1050c6793cd6", )
pages = resp.get("links", {}).get("pages", {})

while "next" in pages:
    parsed = urlparse(pages["next"])
    page = int(parse_qs(parsed.query)["page"][0])
    resp = client.projects.list_resources(project_id="4de7ac8b-495b-4884-9a69-1050c6793cd6", page=page)
    pages = resp.get("links", {}).get("pages", {})

Response Example

Show Response Example
{
  "resources": [
    {
      "urn": "do:droplet:13457723",
      "assigned_at": "2018-09-28T19:26:37Z",
      "links": {
        "self": "https://api.digitalocean.com/v2/droplets/13457723"
      },
      "status": "ok"
    },
    {
      "urn": "do:domain:example.com",
      "assigned_at": "2019-03-31T16:24:14Z",
      "links": {
        "self": "https://api.digitalocean.com/v2/domains/example.com"
      },
      "status": "ok"
    }
  ],
  "links": {
    "pages": {
      "first": "https://api.digitalocean.com/v2/projects/4e1bfbc3-dc3e-41f2-a18f-1b4d7ba71679/resources?page=1",
      "last": "https://api.digitalocean.com/v2/projects/4e1bfbc3-dc3e-41f2-a18f-1b4d7ba71679/resources?page=1"
    }
  },
  "meta": {
    "total": 2
  }
}

More Information

See /v2/projects/{project_id}/resources in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.