Crypto & Security

Encrypt, decrypt, hash, sign, and generate secure tokens

11 endpoints in this category. All require X-API-Key header.


Hash Document

POST /api/HashDocument 1 token

Compute SHA-256/SHA-1/MD5 hash of any document for integrity verification. Supports HMAC with a salt for keyed hashing. Optionally verify a document against a previously stored hash.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded document
algorithm string optional sha256, sha1, or md5 (default: sha256)
compareHash string optional Hash to verify against
salt string optional HMAC salt for keyed hashing
Request Example
JSON
{"file": "SGVsbG8gV29ybGQ=", "algorithm": "sha256"}
Response Example
JSON
{"success": true, "algorithm": "sha256", "hash": "a591a6d40bf420404a...", "hashBase64": "pZGm1Av0IEBKoW...", "fileSize": 11, "fileSizeKb": 0, "timestamp": "2026-03-06T12:00:00Z"}
Code Examples
curl -X POST "https://docbutterfly.com/api/HashDocument" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "SGVsbG8gV29ybGQ=", "algorithm": "sha256"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""file"": ""SGVsbG8gV29ybGQ="", ""algorithm"": ""sha256""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/HashDocument", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/HashDocument"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"file": "SGVsbG8gV29ybGQ=", "algorithm": "sha256"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/HashDocument
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "SGVsbG8gV29ybGQ=",
│      "algorithm": "sha256"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/HashDocument"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Anchor Hash

POST /api/AnchorHash 1 token

Write a document hash to Azure Confidential Ledger for tamper-evident certification. The hash is stored immutably and can be independently verified by any party. Use with HashDocument for a complete certification flow.

Parameters
NameTypeRequiredDescription
hash string required Hex-encoded document hash to anchor
algorithm string optional Hash algorithm used (metadata) (default: sha256)
metadata object optional Optional JSON metadata to store with the hash
Request Example
JSON
{"hash": "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e", "algorithm": "sha256"}
Response Example
JSON
{"success": true, "transactionId": "2.315", "collectionId": "docbutterfly-hashes", "state": "Committed", "timestamp": "2026-03-06T12:00:00Z"}
Code Examples
curl -X POST "https://docbutterfly.com/api/AnchorHash" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"hash": "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e", "algorithm": "sha256"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""hash"": ""a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e"", ""algorithm"": ""sha256""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/AnchorHash", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/AnchorHash"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"hash": "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e", "algorithm": "sha256"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/AnchorHash
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "hash": "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e",
│      "algorithm": "sha256"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/AnchorHash"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Verify Anchor

POST /api/VerifyAnchor 1 token

Verify a document hash exists in Azure Confidential Ledger by transaction ID. Optionally compare a provided hash against the stored ledger entry to confirm document integrity.

Parameters
NameTypeRequiredDescription
transactionId string required Transaction ID from AnchorHash response
hash string optional Hex hash to compare against ledger entry
Request Example
JSON
{"transactionId": "2.315", "hash": "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e"}
Response Example
JSON
{"success": true, "verified": true, "state": "Committed", "ledgerEntry": {"contents": "{\"hash\":\"a591a6d40bf420...\",\"clientId\":\"client1\"}", "collectionId": "docbutterfly-hashes", "transactionId": "2.315"}, "timestamp": "2026-03-06T12:00:00Z"}
Code Examples
curl -X POST "https://docbutterfly.com/api/VerifyAnchor" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"transactionId": "2.315", "hash": "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""transactionId"": ""2.315"", ""hash"": ""a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/VerifyAnchor", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/VerifyAnchor"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"transactionId": "2.315", "hash": "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/VerifyAnchor
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "transactionId": "2.315",
│      "hash": "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/VerifyAnchor"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

AES Encrypt

POST /api/AesEncrypt 1 token

AES encrypt data with a key.

Parameters
NameTypeRequiredDescription
data string required Data to encrypt
key string required Encryption key
algorithm string optional aes-256-cbc, aes-128-cbc, aes-256-gcm (default: aes-256-cbc)
Request Example
JSON
{"data": "Hello secret world", "key": "my-secret-key-32-chars-long!!!!!"}
Response Example
JSON
{"encrypted": "<base64>", "iv": "<base64>", "algorithm": "aes-256-cbc"}
Code Examples
curl -X POST "https://docbutterfly.com/api/AesEncrypt" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"data": "Hello secret world", "key": "my-secret-key-32-chars-long!!!!!"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""data"": ""Hello secret world"", ""key"": ""my-secret-key-32-chars-long!!!!!""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/AesEncrypt", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/AesEncrypt"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"data": "Hello secret world", "key": "my-secret-key-32-chars-long!!!!!"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/AesEncrypt
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "data": "Hello secret world",
│      "key": "my-secret-key-32-chars-long!!!!!"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/AesEncrypt"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

AES Decrypt

POST /api/AesDecrypt 1 token

AES decrypt data with a key.

Parameters
NameTypeRequiredDescription
encrypted string required Encrypted data
key string required Decryption key
iv string required Initialization vector
algorithm string optional Algorithm used
Request Example
JSON
{"encrypted": "<base64>", "key": "my-secret-key-32-chars-long!!!!!", "iv": "<base64>"}
Code Examples
curl -X POST "https://docbutterfly.com/api/AesDecrypt" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"encrypted": "<base64>", "key": "my-secret-key-32-chars-long!!!!!", "iv": "<base64>"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""encrypted"": ""<base64>"", ""key"": ""my-secret-key-32-chars-long!!!!!"", ""iv"": ""<base64>""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/AesDecrypt", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/AesDecrypt"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"encrypted": "<base64>", "key": "my-secret-key-32-chars-long!!!!!", "iv": "<base64>"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/AesDecrypt
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "encrypted": "\u003Cbase64\u003E",
│      "key": "my-secret-key-32-chars-long!!!!!",
│      "iv": "\u003Cbase64\u003E"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/AesDecrypt"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

RSA Encrypt

POST /api/RsaEncrypt 1 token

RSA encrypt with public key.

Parameters
NameTypeRequiredDescription
data string required Data to encrypt
publicKey string required PEM-format public key
Request Example
JSON
{"data": "Secret message", "publicKey": "-----BEGIN PUBLIC KEY-----..."}
Code Examples
curl -X POST "https://docbutterfly.com/api/RsaEncrypt" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"data": "Secret message", "publicKey": "-----BEGIN PUBLIC KEY-----..."}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""data"": ""Secret message"", ""publicKey"": ""-----BEGIN PUBLIC KEY-----...""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/RsaEncrypt", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/RsaEncrypt"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"data": "Secret message", "publicKey": "-----BEGIN PUBLIC KEY-----..."}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/RsaEncrypt
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "data": "Secret message",
│      "publicKey": "-----BEGIN PUBLIC KEY-----..."
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/RsaEncrypt"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

RSA Decrypt

POST /api/RsaDecrypt 1 token

RSA decrypt with private key.

Parameters
NameTypeRequiredDescription
encrypted string required Encrypted data
privateKey string required PEM-format private key
Request Example
JSON
{"encrypted": "<base64>", "privateKey": "-----BEGIN PRIVATE KEY-----..."}
Code Examples
curl -X POST "https://docbutterfly.com/api/RsaDecrypt" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"encrypted": "<base64>", "privateKey": "-----BEGIN PRIVATE KEY-----..."}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""encrypted"": ""<base64>"", ""privateKey"": ""-----BEGIN PRIVATE KEY-----...""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/RsaDecrypt", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/RsaDecrypt"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"encrypted": "<base64>", "privateKey": "-----BEGIN PRIVATE KEY-----..."}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/RsaDecrypt
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "encrypted": "\u003Cbase64\u003E",
│      "privateKey": "-----BEGIN PRIVATE KEY-----..."
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/RsaDecrypt"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Generate RSA Key Pair

POST /api/GenerateRsaKeyPair 1 token

Generate an RSA public/private key pair.

Parameters
NameTypeRequiredDescription
modulusLength number optional 2048 or 4096 (default: 2048)
Request Example
JSON
{"modulusLength": 2048}
Response Example
JSON
{"publicKey": "-----BEGIN PUBLIC KEY-----...", "privateKey": "-----BEGIN PRIVATE KEY-----..."}
Code Examples
curl -X POST "https://docbutterfly.com/api/GenerateRsaKeyPair" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"modulusLength": 2048}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""modulusLength"": 2048}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/GenerateRsaKeyPair", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/GenerateRsaKeyPair"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"modulusLength": 2048}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/GenerateRsaKeyPair
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "modulusLength": 2048
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/GenerateRsaKeyPair"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Generate Hash

POST /api/GenerateHash 1 token

Generate a hash digest.

Parameters
NameTypeRequiredDescription
data string required Data to hash
algorithm string optional sha256, sha512, md5, sha1 (default: sha256)
encoding string optional hex or base64 (default: hex)
Request Example
JSON
{"data": "Hello World", "algorithm": "sha256"}
Response Example
JSON
{"hash": "a591a6d40bf420404a...", "algorithm": "sha256"}
Code Examples
curl -X POST "https://docbutterfly.com/api/GenerateHash" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"data": "Hello World", "algorithm": "sha256"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""data"": ""Hello World"", ""algorithm"": ""sha256""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/GenerateHash", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/GenerateHash"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"data": "Hello World", "algorithm": "sha256"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/GenerateHash
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "data": "Hello World",
│      "algorithm": "sha256"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/GenerateHash"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Generate HMAC

POST /api/GenerateHmac 1 token

Generate an HMAC signature.

Parameters
NameTypeRequiredDescription
data string required Data to sign
key string required Secret key
algorithm string optional sha256, sha512 (default: sha256)
Request Example
JSON
{"data": "Hello World", "key": "my-secret", "algorithm": "sha256"}
Code Examples
curl -X POST "https://docbutterfly.com/api/GenerateHmac" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"data": "Hello World", "key": "my-secret", "algorithm": "sha256"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""data"": ""Hello World"", ""key"": ""my-secret"", ""algorithm"": ""sha256""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/GenerateHmac", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/GenerateHmac"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"data": "Hello World", "key": "my-secret", "algorithm": "sha256"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/GenerateHmac
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "data": "Hello World",
│      "key": "my-secret",
│      "algorithm": "sha256"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/GenerateHmac"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Generate JWT

POST /api/GenerateJwt 1 token

Generate a signed JWT token.

Parameters
NameTypeRequiredDescription
payload object required JWT payload
secret string required Signing secret
options.algorithm string optional HS256, RS256 (default: HS256)
options.expiresIn string optional Expiry: 1h, 7d, 30m
Request Example
JSON
{"payload": {"sub": "user123", "name": "John"}, "secret": "your-secret", "options": {"algorithm": "HS256", "expiresIn": "1h"}}
Response Example
JSON
{"token": "eyJhbGciOiJIUzI1NiIs..."}
Code Examples
curl -X POST "https://docbutterfly.com/api/GenerateJwt" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"payload": {"sub": "user123", "name": "John"}, "secret": "your-secret", "options": {"algorithm": "HS256", "expiresIn": "1h"}}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""payload"": {""sub"": ""user123"", ""name"": ""John""}, ""secret"": ""your-secret"", ""options"": {""algorithm"": ""HS256"", ""expiresIn"": ""1h""}}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/GenerateJwt", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/GenerateJwt"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"payload": {"sub": "user123", "name": "John"}, "secret": "your-secret", "options": {"algorithm": "HS256", "expiresIn": "1h"}}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/GenerateJwt
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "payload": {
│        "sub": "user123",
│        "name": "John"
│      },
│      "secret": "your-secret",
│      "options": {
│        "algorithm": "HS256",
│        "expiresIn": "1h"
│      }
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/GenerateJwt"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed