pydo.security.create_secret()

Generated on 7 Jul 2026 from pydo version v0.39.0

Usage

client.security.create_secret(
    body={
        "name": "my-database-password",
        "region": "nyc3",
        "values": {...},
    },
)
Returns JSONRaises HttpResponseError

Description

To create a secret, send a POST request to /v2/security/secrets.

Parameters

name string required

Example: my-database-password

The name of the secret to create.

region string required

Example: nyc3

The region where the secret will be stored.

values object required

Example: {'password': 's3cr3t'}

Key-value pairs to store in the secret.

Request Sample

Show Request Sample
import os
from pydo import Client

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

req = {
  "name": "my-database-password",
  "region": "nyc3",
  "values": {
    "password": "s3cr3t"
  }
}

resp = client.security.create_secret(body=req)

Response Example

Show Response Example
{
  "name": "my-database-password",
  "region": "nyc3",
  "version": 1
}

More Information

See /v2/security/secrets 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.