Back to home

API Documentation

Complete reference for the Cipher API - cryptographic utilities for developers.

Quick Start

Get started with the Cipher API in minutes. All endpoints require authentication with an API key.

Authentication

Include your API key in the x-api-key header.

// Include your API key in the x-api-key header
headers: {
  'x-api-key': 'ek_your_api_key_here',
  'Content-Type': 'application/json'
}

Example Request

curl -X POST https://cipher.endpnt.dev/api/v1/hash \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "data": "Hello, World!",
    "algorithm": "sha256"
  }'

Example Response

{
  "success": true,
  "data": {
    "hash": "dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f",
    "algorithm": "sha256",
    "input_length": 13
  },
  "meta": {
    "request_id": "req_abc123",
    "processing_ms": 2,
    "remaining_credits": 4999
  }
}

Security Notice

We never log your secrets, keys, or sensitive data. All cryptographic operations are performed in memory and results are returned immediately. However, always use environment variables or secure key management for your API keys and secrets.

Hash Operations

Generate cryptographic hashes using various algorithms for data integrity and verification.

POST /api/v1/hash

Generate a cryptographic hash of the provided data.

API Key Required

This endpoint requires authentication. Enter your API key to test.

Parameters

Example Response

{
  "success": true,
  "data": {
    "hash": "dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f",
    "algorithm": "sha256",
    "input_length": 13
  },
  "meta": {
    "request_id": "req_abc123",
    "processing_ms": 2,
    "remaining_credits": 4999
  }
}

HMAC Operations

Generate and verify Hash-based Message Authentication Codes for message integrity and authentication.

POST /api/v1/hmac/compute

Generate an HMAC signature for the provided data and secret.

API Key Required

This endpoint requires authentication. Enter your API key to test.

Parameters

Example Response

{
  "success": true,
  "data": {
    "signature": "f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8",
    "algorithm": "sha256"
  },
  "meta": {
    "request_id": "req_def456",
    "processing_ms": 1
  }
}

POST /api/v1/hmac/verify

Verify an HMAC signature against the provided data and secret.

API Key Required

This endpoint requires authentication. Enter your API key to test.

Parameters

Example Response

{
  "success": true,
  "data": {
    "valid": true,
    "algorithm": "sha256"
  },
  "meta": {
    "request_id": "req_ghi789",
    "processing_ms": 1
  }
}

JWT Operations

Sign, verify, and decode JSON Web Tokens for authentication and authorization.

POST /api/v1/jwt/sign

Create and sign a JWT token with the provided payload and secret.

API Key Required

This endpoint requires authentication. Enter your API key to test.

Parameters

Example Response

{
  "success": true,
  "data": {
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "expires_in": "1h",
    "algorithm": "HS256"
  },
  "meta": {
    "request_id": "req_jkl012",
    "processing_ms": 3
  }
}

POST /api/v1/jwt/verify

Verify a JWT token's signature and decode its payload.

API Key Required

This endpoint requires authentication. Enter your API key to test.

Parameters

Example Response

{
  "success": true,
  "data": {
    "valid": true,
    "payload": {
      "user_id": "12345",
      "role": "admin",
      "iat": 1670966400,
      "exp": 1670970000
    },
    "algorithm": "HS256"
  },
  "meta": {
    "request_id": "req_mno345",
    "processing_ms": 2
  }
}

POST /api/v1/jwt/decode

Decode a JWT token without signature verification.

API Key Required

This endpoint requires authentication. Enter your API key to test.

Parameters

Example Response

{
  "success": true,
  "data": {
    "header": {
      "alg": "HS256",
      "typ": "JWT"
    },
    "payload": {
      "user_id": "12345",
      "role": "admin",
      "iat": 1670966400,
      "exp": 1670970000
    }
  },
  "meta": {
    "request_id": "req_pqr678",
    "processing_ms": 1
  }
}

Password Operations

Secure password hashing and verification using bcrypt with configurable cost factors.

POST /api/v1/password/hash

Generate a secure bcrypt hash of a password.

API Key Required

This endpoint requires authentication. Enter your API key to test.

Parameters

Example Response

{
  "success": true,
  "data": {
    "hash": "$2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/LeNNoIZtHHwS3UWKe",
    "cost": 12
  },
  "meta": {
    "request_id": "req_stu901",
    "processing_ms": 85
  }
}

POST /api/v1/password/verify

Verify a password against a bcrypt hash.

API Key Required

This endpoint requires authentication. Enter your API key to test.

Parameters

Example Response

{
  "success": true,
  "data": {
    "valid": true,
    "cost": 12
  },
  "meta": {
    "request_id": "req_vwx234",
    "processing_ms": 82
  }
}

Random Generation

Generate cryptographically secure random data, tokens, and UUIDs.

POST /api/v1/random

Generate cryptographically secure random data in various formats.

API Key Required

This endpoint requires authentication. Enter your API key to test.

Parameters

Example Response

{
  "success": true,
  "data": {
    "value": "a3f5d9e8b2c1f4e7a9d6c3b8f2e5a1d7c9b6f3e8a2d5c7b1f9e4a8d3c6b2f5e9",
    "type": "hex",
    "length": 32
  },
  "meta": {
    "request_id": "req_yza567",
    "processing_ms": 1
  }
}

POST /api/v1/uuid

Generate UUIDs in different versions and formats.

API Key Required

This endpoint requires authentication. Enter your API key to test.

Parameters

Example Response

{
  "success": true,
  "data": {
    "uuid": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "version": "v4"
  },
  "meta": {
    "request_id": "req_bcd890",
    "processing_ms": 1
  }
}

Encoding Operations

Encode and decode data in various formats including Base64, hex, and URL-safe variants.

POST /api/v1/encode

Encode text data in various formats.

API Key Required

This endpoint requires authentication. Enter your API key to test.

Parameters

Example Response

{
  "success": true,
  "data": {
    "encoded": "SGVsbG8sIENpcGhlciBBUEkh",
    "encoding": "base64",
    "input_length": 18
  },
  "meta": {
    "request_id": "req_efg123",
    "processing_ms": 1
  }
}

POST /api/v1/decode

Decode encoded data back to its original form.

API Key Required

This endpoint requires authentication. Enter your API key to test.

Parameters

Example Response

{
  "success": true,
  "data": {
    "decoded": "Hello, Cipher API!",
    "encoding": "base64",
    "output_length": 18
  },
  "meta": {
    "request_id": "req_hij456",
    "processing_ms": 1
  }
}

Error Codes

The API returns standard HTTP status codes and specific error codes in the response body.

Common Error Codes

INVALID_API_KEY
401
API key is missing or invalid
RATE_LIMIT_EXCEEDED
429
Too many requests
INVALID_PARAMS
400
Missing or invalid parameters
UNSUPPORTED_ALGORITHM
400
Algorithm not supported
INVALID_JWT
400
Malformed JWT token
JWT_EXPIRED
401
JWT token has expired