Provides information about your current account.
DigitalOcean PyDo Python Library Reference
Generated on 13 Nov 2026
from pydo version
v0.46.0
PyDo is the official Python client library for the DigitalOcean API. It provides a Python abstraction layer on top of the raw HTTP API, wrapping a generated client based on the DigitalOcean OpenAPI Specification.
Installation
Install pydo using pip:
Requires Python 3.7.2 or later.
Initialization
Create a client by passing your DigitalOcean API token:
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))The Client constructor accepts the following parameters:
| Name | Type | Default | Description |
|---|---|---|---|
token |
string |
A valid API token, model access key, or agent access key. Required. | |
endpoint |
string |
https://api.digitalocean.com |
Base URL for API requests. |
timeout |
integer |
120 |
Request timeout in seconds. |
inference_endpoint |
string |
https://inference.do-ai.run |
Serverless inference URL. |
agent_endpoint |
string |
"" |
Agent inference endpoint URL. Required only for agent inference methods. |
You can also customize retry behavior:
# Modify the total number of retries
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"), retry_total=3)For examples of advanced client configuration, including logging, custom user agents, and per-request timeouts, see the pydo examples directory.
Serverless inference methods can authenticate with either an API token or a model access key. Agent inference methods require an agent access key and a per-agent endpoint URL:
client = Client(
token=os.environ.get("AGENT_ACCESS_KEY"),
agent_endpoint="https://your_agent_url",
)Usage
Call API methods through client.<resource>.<method>():
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
ssh_keys_resp = client.ssh_keys.list()
for k in ssh_keys_resp["ssh_keys"]:
print(f"ID: {k['id']}, NAME: {k['name']}, FINGERPRINT: {k['fingerprint']}")All methods raise HttpResponseError on failure. Each method page documents its specific return type.
Resources
Actions are records of events that have occurred on the resources in your account.
Action Gateway gives AI agents governed access to tools over the Model Context Protocol (MCP).
Add-ons are third-party applications that can be added to your DigitalOcean account.
DigitalOcean Agent Platform allows you to create multi-agent workflows to power your AI applications.
App Platform is a Platform-as-a-Service (PaaS) offering from DigitalOcean that allows developers to publish code directly to DigitalOcean servers without worrying about the underlying infrastructure.
Droplet autoscale pools manage automatic horizontal scaling for your applications based on resource usage (CPU, memory, or both) or a static configuration.
The billing endpoints allow you to retrieve your account balance, invoices, billing history, insights, and prepayment information.
The billing endpoints allow you to retrieve your account balance, invoices, billing history, insights, and prepayment information.
The billing endpoints allow you to retrieve your account balance, invoices, billing history, insights, and prepayment information.
Bring your own IP (BYOIP) lets you provision your own IPv4 network prefixes to your account, then assign those IPs to your DigitalOcean resources.
Content hosted in DigitalOcean’s object storage solution, Spaces, can optionally be served by our globally distributed Content Delivery Network (CDN).
In order to perform SSL termination on load balancers, DigitalOcean offers two types of SSL certificate management.
Action Gateway gives AI agents governed access to tools over the Model Context Protocol (MCP).
DigitalOcean’s managed database service simplifies the creation and management of highly available database clusters.
Dedicated Inference delivers scalable production-grade LLM hosting on DigitalOcean.
Domain resources are domain names that you have purchased from a domain name registrar that you are managing through the DigitalOcean DNS interface.
Droplet actions are tasks that can be executed on a Droplet.
A Droplet is a DigitalOcean virtual machine.
Action Gateway gives AI agents governed access to tools over the Model Context Protocol (MCP).
Action Gateway gives AI agents governed access to tools over the Model Context Protocol (MCP).
DigitalOcean Cloud Firewalls provide the ability to restrict network access to and from a Droplet allowing you to define which ports will accept inbound or outbound connections.
Serverless functions are blocks of code that run on demand without the need to manage any infrastructure.
Serverless functions are blocks of code that run on demand without the need to manage any infrastructure.
The Action Gateway data plane finds and runs tools in a session.
The Action Gateway data plane finds and runs tools in a session.
The Action Gateway data plane finds and runs tools in a session.
The Action Gateway data plane finds and runs tools in a session.
The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
DigitalOcean Harness Runtime API under /v2/agents.
Image actions are commands that can be given to a DigitalOcean image.
A DigitalOcean image can be used to create a Droplet and may come in a number of flavors.
DigitalOcean Inference allows access to serverless inference models.
The DigitalOcean Insights API provides observability resources for monitoring your infrastructure, including alert rules that evaluate metrics, notification channels that deliver alert events, read-only alert instances that record when alert rules fire, user-defined dashboards, PromQL, logs, spans, and traces query interfaces, and per-resource enablement of the metrics, logs, and traces signals.
The billing endpoints allow you to retrieve your account balance, invoices, billing history, insights, and prepayment information.
DigitalOcean Kubernetes allows you to quickly deploy scalable and secure Kubernetes clusters.
DigitalOcean Load Balancers provide a way to distribute traffic across multiple Droplets.
Action Gateway gives AI agents governed access to tools over the Model Context Protocol (MCP).
DigitalOcean MicroVMs
are lightweight virtual machines that run a linux/amd64 container image
in an isolated kernel.
DigitalOcean MicroVMs
are lightweight virtual machines that run a linux/amd64 container image
in an isolated kernel.
DigitalOcean MicroVMs
are lightweight virtual machines that run a linux/amd64 container image
in an isolated kernel.
DigitalOcean MicroVMs
are lightweight virtual machines that run a linux/amd64 container image
in an isolated kernel.
The DigitalOcean Monitoring API makes it possible to programmatically retrieve metrics as well as configure alert policies based on these metrics.
NFS lets you create fully managed, POSIX-compliant network file storage that delivers secure, high-performance shared storage right inside your VPC.
1-Click applications are pre-built Droplet images or Kubernetes apps with software, features, and configuration details already set up for you.
Organizations group multiple teams under a shared administrative boundary.
Action Gateway gives AI agents governed access to tools over the Model Context Protocol (MCP).
Partner Network Connect lets you establish high-bandwidth, low-latency network connections directly between DigitalOcean VPC networks and other public cloud providers or on-premises datacenters.
The billing endpoints allow you to retrieve your account balance, invoices, billing history, insights, and prepayment information.
The billing endpoints allow you to retrieve your account balance, invoices, billing history, insights, and prepayment information.
Projects allow you to organize your resources into groups that fit the way you work.
Action Gateway gives AI agents governed access to tools over the Model Context Protocol (MCP).
Provides information about DigitalOcean data center regions.
DigitalOcean now supports up to nine additional registries (for a total maximum of 10) per team if your container registry uses the Professional subscription plan.
DigitalOcean offers the ability for you to create a private container registry to store your Docker images for use with your Kubernetes clusters.
As of 16 June 2022, we have renamed the [Floating IP](/reference/api/reference/floating-ips/ product to Reserved IPs.
As of 16 June 2022, we have renamed the [Floating IP](/reference/api/reference/floating-ips/ product to Reserved IPs.
DigitalOcean Reserved IPv6s are publicly-accessible static IP addresses that can be mapped to one of your Droplets.
Reserved IPv6 actions requests are made on the actions endpoint of a specific reserved IPv6.
Security endpoints for CSPM scans, scan findings, settings, and Secrets Manager.
Action Gateway gives AI agents governed access to tools over the Model Context Protocol (MCP).
The DigitalOcean Signals API provides observability for environment conversations, such as Harness Runtime conversations and Serverless Inference chat completions, detecting behavioral signals such as user disengagement, execution failures, and satisfaction indicators.
The sizes objects represent different packages of hardware resources that can be used for Droplets.
Snapshots are saved
instances of a Droplet or a block storage volume, which is reflected in
the resource_type attribute.
Spaces keys authenticate requests to DigitalOcean Spaces Buckets.
Manage SSH keys available on your account.
A tag is a label that can be applied to a resource (currently Droplets, Images, Volumes, Volume Snapshots, and Database clusters) in order to better organize or facilitate the lookups and actions on it.
Action Gateway gives AI agents governed access to tools over the Model Context Protocol (MCP).
Action Gateway gives AI agents governed access to tools over the Model Context Protocol (MCP).
DigitalOcean Uptime Checks provide the ability to monitor your endpoints from around the world, and alert you when they’re slow, unavailable, or SSL certificates are expiring.
Action Gateway gives AI agents governed access to tools over the Model Context Protocol (MCP).
Vector DB provides APIs for provisioning and managing vector database instances on DigitalOcean.
Block storage actions are commands that can be given to a DigitalOcean Block Storage Volume.
DigitalOcean Block Storage Volumes provide expanded storage capacity for your Droplets and can be moved between Droplets within a specific region.
DigitalOcean Block Storage Volumes provide expanded storage capacity for your Droplets and can be moved between Droplets within a specific region.
VPC Peerings join two VPC networks with a secure, private connection.
Routes control how traffic from resources in VPC subnets reaches destination networks.
Routes control how traffic from resources in VPC subnets reaches destination networks.
VPC subnets divide a VPC network into isolated IP ranges.
VPC NAT Gateways allow resources in a private VPC to access the public internet without exposing them to incoming traffic.
VPCs (virtual private clouds) allow you to create virtual networks containing resources that can communicate with each other in full isolation using private IP addresses.