[ Web Proxy ]
URL:
Viewing: https://docs.digitalocean.com/reference/pydo/reference/security/create_secret/ [Back]  [Original]

pydo.security.create_secret() | DigitalOcean Documentation

For AI agents: The documentation index is at https://docs.digitalocean.com/llms.txt. Markdown versions of pages use the same URL with index.html.md in place of the HTML page (for example, append index.html.md to the directory path instead of opening the HTML document).

pydo.security.create_secret()

Generated on 3 Aug 2026 from pydo version v0.40.0

Copy page as Markdown View page as Markdown

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.

In this article...


We can't find any results for your search.

Try using different keywords or simplifying your search terms.


Web Proxy Viewer  |  New URL  |  Original Page