apyhub
Back
▣ SAFETY KIT

Encrypt and Decrypt File API

What it does

File Encryption encrypts a binary file with an AES key and returns the encrypted file as binary output. Send a file and a URL-safe Base64 key, get the encrypted file back.

Use it when you need to protect documents before storage, transport, or sharing. The request body requires file and key, where the key must come from GenerateKey and be 16, 24, or 32 bytes when decoded. The file input supports uploads up to 10 MB.

The response is a binary file, so you can pass it straight into your storage layer, download flow, or downstream processing step. This fits workflows like encrypting customer uploads, securing exported reports, or wrapping files before moving them between systems.

If your product handles sensitive content, File Encryption gives you a simple file-level encryption step without adding custom crypto handling to your application.

▣ ENDPOINT 01 / 02
POST
EncryptFile
https://api.eu.apyhub.com/frolic/encrypt-and-decrypt-file-api/encrypt-file

QUICKSTART

GUIDE

Quickstart

Encrypt a file by uploading it along with the AES key.

curl -X POST "https://api.eu.apyhub.com/frolic/encrypt-and-decrypt-file-api/encrypt-file" \
  -H "apy-token: $APY_TOKEN" \
  -F "key=FsBheKBiDXTjDdHT-mPmN28QVqvZZ3Vm3hN4XbhrQHU=" \
  -F "file=@/path/to/file"

What you'll get back

Returns a binary file download containing the encrypted file data.

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.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body
AES key from GenerateKey, URL-safe Base64 (16, 24 or 32 bytes)
File to encrypt (max 10 MB)

About this endpoint

What it does

Encrypts an uploaded file using the provided AES key and returns the encrypted file as binary output.

Request Body

ParameterTypeMandatoryDescription
fileStringYesFile to encrypt (max 10 MB)
keyStringYesAES key from GenerateKey, URL-safe Base64 (16, 24 or 32 bytes)

Response

Returns a binary file stream containing the encrypted file. The success response is a raw String-formatted binary payload, not a JSON object.

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 02 / 02
POST
DecryptFile
https://api.eu.apyhub.com/frolic/encrypt-and-decrypt-file-api/decrypt-file

QUICKSTART

GUIDE

Quickstart

Decrypt an .enc file by uploading the file and the encryption key.

curl -X POST "https://api.eu.apyhub.com/frolic/encrypt-and-decrypt-file-api/decrypt-file" \
  -H "apy-token: $APY_TOKEN" \
  -F "key=FsBheKBiDXTjDdHT-mPmN28QVqvZZ3Vm3hN4XbhrQHU=" \
  -F "file=@/path/to/file.enc"

What you'll get back

Returns a JSON object with no declared top-level fields.

{}
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.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body
The key the file was encrypted with
The .enc file from EncryptFile

About this endpoint

What it does

Decrypts an encrypted file by accepting the encrypted file content and the encryption key used to protect it. The output schema is empty, so the response shape is not yet captured in the schema.

Request Body

ParameterTypeMandatoryDescription
fileStringYesThe .enc file from EncryptFile. Format: binary.
keyStringYesThe key the file was encrypted with.

Response

The endpoint returns a minimal acknowledgement on success — the detailed shape is not yet captured in the schema.

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ 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.