API Key Reference
Encrypt
Encrypt a plain text string using the Cipherion API
Encrypt Data
Encrypts a plain text string or any string value into an encrypted package.
Endpoint
POST /encrypt/:projectIdThe passphrase must be stored in an environment variable and never hardcoded. Use the same passphrase for both encrypt and decrypt operations.
Request
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | Your project identifier |
Headers
| Header | Required | Description |
|---|---|---|
x-api-key | Yes | Your Cipherion API key |
Content-Type | Yes | Must be application/json |
Body
| Parameter | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Plain text or string value to encrypt |
passphrase | string | Yes | Passphrase for encryption |
Example Request
Method: POST
URL: https://api.cipherion.in/api/v1/crypto/encrypt/YOUR_PROJECT_ID
Headers:
x-api-key: YOUR_API_KEY
Content-Type: application/json
Body (raw JSON):
{
"data": "sensitive information to encrypt",
"passphrase": "your-secure-passphrase"
}{
"data": "sensitive information to encrypt",
"passphrase": "your-secure-passphrase"
}curl -X POST https://api.cipherion.in/api/v1/crypto/encrypt/YOUR_PROJECT_ID \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": "sensitive information to encrypt",
"passphrase": "your-secure-passphrase"
}'Responses
200 OK — Success
{
"success": true,
"statusCode": 200,
"message": "Data encrypted successfully",
"data": {
"encrypted_output": "a2c8d832ab....Encrypted Package"
},
"timestamp": "2025-12-24T06:05:35.591Z"
}| Field | Type | Description |
|---|---|---|
data.encrypted_output | string | The encrypted package. Pass this value to /decrypt to retrieve the original string. |
400 Bad Request — Missing Fields
Returned when projectId, x-api-key, data, or passphrase is absent.
{
"success": false,
"statusCode": 400,
"message": "Missing required fields: projectId, x-api-key header, data, or passphrase",
"data": null,
"timestamp": "2026-05-29T00:00:00.000Z"
}400 Bad Request — Invalid Passphrase or Corrupted Data
Returned when the passphrase does not match the one configured in the Cipherion dashboard, or the data is malformed.
{
"success": false,
"statusCode": 400,
"message": "Failed to unwrap AES key: possible invalid passphrase or corrupted data",
"data": null,
"error": {
"statusCode": 400,
"isOperational": "Failed to unwrap AES key: possible invalid passphrase or corrupted data"
},
"timestamp": "2025-12-24T06:19:16.669Z"
}401 Unauthorized
{
"success": false,
"statusCode": 401,
"message": "Invalid project or API key",
"data": null,
"error": {
"statusCode": 401,
"isOperational": true
},
"timestamp": "2025-12-24T06:18:26.585Z"
}403 When API Key Does not Belong to the Project
Returned when the x-api-key header or projectId parameter does not belong to each other.
{
"success": false,
"statusCode": 403,
"message": "API key does not belong to the specific project",
"data": null,
"error": null,
"timestamp": "2026-05-29T10:46:50.496Z"
}413 Payload Too Large
{
"success": false,
"statusCode": 413,
"message": "Payload too large: maximum Y data size allowed per request (received X).",
"data": null,
"timestamp": "2026-05-29T00:00:00.000Z"
}429 Too Many Requests
Returned when your billing period quota is exhausted and overage is not enabled.
{
"success": false,
"statusCode": 429,
"message": "encryption quota exceeded: your plan includes X calls per billing period...",
"data": null,
"timestamp": "2026-05-29T00:00:00.000Z"
}500 Internal Server Error
{
"success": false,
"statusCode": 500,
"message": "Encryption failed",
"data": null,
"error": {},
"timestamp": "2026-05-29T00:00:00.000Z"
}Notes
- The
encrypted_outputstring is an opaque encrypted package. Store it as-is. - To retrieve the original value, pass
encrypted_outputas thedatafield to the/decryptendpoint using the same passphrase. - See the Encrypted Package Format section for details on the internal structure.