Skip to content
API Reference

Create

zones.secrets.create(strpath_zone_id, SecretCreateParams**kwargs) -> Secret
POST/zones/{zone_id}/secrets
ParametersExpand Collapse
zone_id: str

A globally unique opaque identifier

minLength1
data: Data
Accepts one of the following:
class SecretTokenFields:
token: str
type: Literal["token"]
class SecretPasswordFields:
password: str
type: Literal["password"]
username: str
entity_id: str

A globally unique opaque identifier

minLength1
name: str

A name for the entity to be displayed in UI

description: Optional[str]

A description of the entity

maxLength128
metadata: Optional[object]

A JSON object containing arbitrary metadata. Metadata will not be encrypted.

zone_id: str

A globally unique opaque identifier

minLength1
x_client_request_id: Optional[str]
formatuuid
ReturnsExpand Collapse
class Secret:
id: str

A globally unique opaque identifier

minLength1
created_at: datetime
formatdate-time
entity_id: str

A globally unique opaque identifier

minLength1
name: str

A name for the entity to be displayed in UI

type: Literal["token", "password"]
Accepts one of the following:
"token"
"password"
updated_at: datetime
formatdate-time
version: int
minimum1
zone_id: str

A globally unique opaque identifier

minLength1
description: Optional[str]

A description of the entity

maxLength128
metadata: Optional[object]

A JSON object containing arbitrary metadata. Metadata will not be encrypted.

Create

from keycardai_api import KeycardAPI

client = KeycardAPI()
secret = client.zones.secrets.create(
    path_zone_id="x",
    data={
        "token": "token",
        "type": "token",
    },
    entity_id="x",
    name="name",
)
print(secret.id)
{
  "id": "x",
  "created_at": "2019-12-27T18:11:19.117Z",
  "entity_id": "x",
  "name": "name",
  "type": "token",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "version": 1,
  "zone_id": "x",
  "description": "description",
  "metadata": {}
}
Returns Examples
{
  "id": "x",
  "created_at": "2019-12-27T18:11:19.117Z",
  "entity_id": "x",
  "name": "name",
  "type": "token",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "version": 1,
  "zone_id": "x",
  "description": "description",
  "metadata": {}
}