Provides information about your current account.
DigitalOcean PyDo Python Library Reference
Generated on 8 May 2026
from pydo version
v0.34.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.
Add-ons are third-party applications that can be added to your DigitalOcean account.
DigitalOcean Gradient™ AI Agentic Cloud 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, and insights.
The billing endpoints allow you to retrieve your account balance, invoices, billing history, and insights.
The billing endpoints allow you to retrieve your account balance, invoices, billing history, and insights.
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.
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.
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 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.
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 Gradient™ AI Agentic Cloud allows access to serverless inference models.
The billing endpoints allow you to retrieve your account balance, invoices, billing history, and insights.
DigitalOcean Kubernetes allows you to quickly deploy scalable and secure Kubernetes clusters.
DigitalOcean Load Balancers provide a way to distribute traffic across multiple Droplets.
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.
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.
Projects allow you to organize your resources into groups that fit the way you work.
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 CSPM endpoints for scans, scan findings, and settings.
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.
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.
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.
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.