apyhub
SECURITY & PRIVACY

Encrypt Text API

What it does

Text Encryption lets you encrypt a text string with Fernet and returns the resulting ciphertext. You send a text value, and you can also provide a Base64-url Fernet key if you want to control the encryption key yourself.

If you omit key, the service auto-generates one and includes it in the response alongside the ciphertext. That makes it useful when you need to encrypt small payloads for storage, transport, or internal workflows without managing key generation separately.

Use Text Encryption when you need to protect secrets, API payloads, tokens, or other sensitive text before writing it to a database, sending it between services, or passing it through a queue. The response is compact and direct: you get the key used and the encrypted output back.

It is a focused utility for application-level encryption, not a general file or document encryption workflow. If your input is plain text and your output needs to be ciphertext, this endpoint gives you exactly that.

POST
Fernet AES-256-CBC encrypt text; auto-generates a key if not provided
http://localhost:8080/dosvak/encrypt
QUICKSTARTGUIDE

Quickstart

Encrypt a piece of text with a Fernet key.

curl -X POST "http://localhost:8080/dosvak/encrypt" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello, world!"}'

What you'll get back

Returns a JSON object with optional key and ciphertext string fields. key is the base64-url Fernet key used for encryption, and ciphertext is the encrypted result.

{
  "key": "f7X2k1mQ0v9aZr8c6Yd4eW1uT2s3p4n5",
  "ciphertext": "gAAAAABlY..."
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Base64-url Fernet key. Omit to auto-generate.

About this endpoint

What it does

Encrypts a text string using Fernet and returns the resulting ciphertext. If you do not provide a key, the service auto-generates one and includes it in the response.

Request Body

ParameterTypeMandatoryDescription
keyStringNoBase64-url Fernet key. Omit to auto-generate.
textStringYesText to encrypt.

Response

Returns a JSON object with two string fields: key and ciphertext. The key field contains the Fernet key used for encryption, and ciphertext contains the encrypted output.

ParameterTypeMandatoryDescription
keyStringNoFernet key used for encryption. Present when the service generates or returns a key.
ciphertextStringNoEncrypted text output.

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.