Encrypt data under an organization's named key
POST /v1/vault/encrypt: Encrypt data under an organization's named key.
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
Request body
Section titled “Request body”organizationstring Required
The key name.keystring Required
Base64 (standard, padded); at most 64 KiB decoded.plaintextstring (byte) Requiredmax length 87384
Additional authenticated data bound to the ciphertext; the same pairs are needed to decrypt.contextVaultContext
Responses
Section titled “Responses”- 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=="}'const response = await fetch("https://api.ohauthcat.com/v1/vault/encrypt", { method: "POST", headers: { Authorization: `Bearer ${process.env.OHAUTHCAT_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ "organization": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "key": "plan", "plaintext": "ZXhhbXBsZQ==" }),});const data = await response.json();import osimport requests
response = requests.post( "https://api.ohauthcat.com/v1/vault/encrypt", headers={"Authorization": f"Bearer {os.environ['OHAUTHCAT_API_KEY']}"}, json={ "organization": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "key": "plan", "plaintext": "ZXhhbXBsZQ==", },)data = response.json(){ "object": "vault_ciphertext", "ciphertext": "example_ciphertext", "key_id": "vkey_01J9ZQ4M7K2X8V3N5B6C1D0E9F", "key_version": 1}