---
title: Encrypt and Decrypt File API
slug: encrypt-and-decrypt-file-api
url: https://apyhub.com/frolic/service/encrypt-and-decrypt-file-api
provider: Hakimi Labs
categories: [Safety Kit]
tags: [file-encryption, aes, cryptography, data-protection, secure-storage]
auth: api_key
version: 1.0
service_type: sync
endpoints: 2
atoms: 10
mcp: true
---

# Encrypt and Decrypt File API

Encrypt a binary file with a URL-safe Base64 AES key. Use it to protect documents and uploads before storage or transfer.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/frolic/encrypt-and-decrypt-file-api/encrypt-file` | What it does Encrypts an uploaded file using the provided AES key and returns the encrypted file as… | 10 |
| POST | `https://api.eu.apyhub.com/frolic/encrypt-and-decrypt-file-api/decrypt-file` | What it does Decrypts an encrypted file by accepting the encrypted file content and the encryption… | 10 |

## Endpoint reference

### EncryptFile

`POST https://api.eu.apyhub.com/frolic/encrypt-and-decrypt-file-api/encrypt-file` · 10 atoms · accepts `multipart/form-data` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | body | string | yes | AES key from GenerateKey, URL-safe Base64 (16, 24 or 32 bytes) Example: `FsBheKBiDXTjDdHT-mPmN28QVqvZZ3Vm3hN4XbhrQHU=`. |
| `file` | body | string (binary) | yes | File to encrypt (max 10 MB) |

#### Quickstart

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

```bash
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.

### DecryptFile

`POST https://api.eu.apyhub.com/frolic/encrypt-and-decrypt-file-api/decrypt-file` · 10 atoms · accepts `multipart/form-data` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | body | string | yes | The key the file was encrypted with Example: `FsBheKBiDXTjDdHT-mPmN28QVqvZZ3Vm3hN4XbhrQHU=`. |
| `file` | body | string (binary) | yes | The .enc file from EncryptFile |

#### Quickstart

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

```bash
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.

```json
{}
```

## About

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

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/frolic/service/encrypt-and-decrypt-file-api
