Skip to content
Dashboard
Theme
Theme

Encrypt data under an organization's named key

POST /v1/vault/encrypt: Encrypt data under an organization's named key.

View Markdown

POST /v1/vault/encrypt

Plaintext is base64 (at most 64 KiB decoded). The optional context (at most 16 pairs) is bound to the ciphertext and must be given again to decrypt. Plaintext is never logged or stored.

Scope
vault:use
Auth
Secret key (sk_…)
Since
1.0
  • organization string Required

  • key string Required

    The key name.

  • plaintext string (byte) Required

    Base64 (standard, padded); at most 64 KiB decoded.

    max length 87384

  • context VaultContext

    Additional authenticated data bound to the ciphertext; the same pairs are needed to decrypt.

  • 200 Ciphertext VaultEncryptResult
  • default Any other error, including internal_error. Every code is in the error catalogue. Error

Errors share one shape; see the error code catalogue.

curl -X POST \
"https://api.ohauthcat.com/v1/vault/encrypt" \
-H "Authorization: Bearer $OHAUTHCAT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"organization": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"key": "plan",
"plaintext": "ZXhhbXBsZQ=="
}'
Response 200
{
"object": "vault_ciphertext",
"ciphertext": "example_ciphertext",
"key_id": "vkey_01J9ZQ4M7K2X8V3N5B6C1D0E9F",
"key_version": 1
}