API Documentation

Syncrypt API Reference

Everything you need to integrate Syncrypt into your infrastructure. RESTful endpoints, clear examples, and comprehensive guides.

Authentication

All endpoints require API key authentication using the X-API-Key header.

curl -X GET https://api.syncrypt.io/v1/keys \
  -H "X-API-Key: your-api-key"

Partner Management

Register New Partner

POST/api/partners/register

Register a new partner account and receive an API key.

Request Body

{
  "company_name": "Acme Corporation",
  "name": "John Doe",
  "email": "john.doe@acme.com",
  "description": "Leading provider of cloud services"
}

Response

{
  "message": "Registration successful",
  "api_key": "your-api-key"
}

Key Management

Generate New Key

POST/api/keys/generate-key

Generate a new PGP key pair.

Form Data

  • email — Email address for the key

Response

{
  "fingerprint": "ABC123...",
  "public_key": "-----BEGIN PGP PUBLIC KEY BLOCK-----..."
}

Get Public Key

POST/api/keys/get-public-key

Retrieve a public key by fingerprint.

Request Body

{
  "fingerprint": "ABC123..."
}

Response

{
  "public_key": "-----BEGIN PGP PUBLIC KEY BLOCK-----..."
}

Encrypt File

POST/api/keys/encrypt

Encrypt a file using a public key.

Form Data

  • fingerprint — Key fingerprint
  • files — List of files to encrypt

Response: Encrypted file stream

Decrypt File

POST/api/keys/decrypt

Decrypt a file using a private key.

Form Data

  • fingerprint — Key fingerprint
  • passphrase — Key passphrase
  • files — List of encrypted files

Response: Decrypted file stream

Key Rotation

Rotate Key

POST/api/keys/{fingerprint}/rotate

Rotate a key and generate a new key pair.

Request Body

{
  "reason": "Scheduled rotation"
}

Response

{
  "message": "Key rotated successfully",
  "new_fingerprint": "XYZ789..."
}

Update Rotation Schedule

POST/api/keys/{fingerprint}/rotation-schedule

Set or update the automatic rotation schedule for a key.

Request Body

{
  "days": 90
}

Response

{
  "message": "Schedule updated",
  "next_rotation": "2025-12-05T00:00:00Z"
}

Monitoring

Health Check

GET/api/health
{
  "status": "healthy"
}

System Status

GET/api/status
{
  "status": "operational",
  "components": {
    "database": "healthy",
    "key_service": "healthy",
    "email_service": "healthy"
  },
  "metrics": {
    "active_keys": 42,
    "pending_rotations": 3
  }
}

Key Health

GET/api/keys/health

Query Parameters

  • key_id — (optional) Specific key ID
{
  "total_keys": 42,
  "expiring_soon": 3,
  "recently_rotated": 5,
  "health_status": {
    "healthy": 38,
    "warning": 3,
    "critical": 1
  }
}

Backup Operations

Create Backup

POST/api/keys/{key_id}/backup
{
  "message": "Backup created successfully",
  "backup_id": "backup_123",
  "timestamp": "2025-09-07T12:00:00Z"
}

Restore from Backup

POST/api/keys/restore

Request Body

{
  "backup_file": "backup_123"
}

Response

{
  "message": "Key restored successfully",
  "details": {
    "fingerprint": "ABC123...",
    "restored_at": "2025-09-07T12:05:00Z"
  }
}

Rate Limits

EndpointRate Limit
Key Generation5/minute
Key Retrieval60/minute
Encryption30/minute
Decryption30/minute
Partner Registration3/minute
Monitoring120/minute

Error Codes

CodeDescription
400Bad Request — Invalid parameters
401Unauthorized — Invalid API key
403Forbidden — Insufficient permissions
404Not Found — Resource doesn't exist
429Too Many Requests — Rate limit exceeded
500Internal Server Error

Best Practices

API Key Security

  • Store API keys securely in environment variables
  • Never expose keys in client-side code
  • Rotate keys periodically

Rate Limit Handling

  • Implement exponential backoff
  • Cache responses where appropriate
  • Monitor rate limit headers

Key Management

  • Regular key rotation
  • Secure passphrase storage
  • Regular backups

Ready to integrate?

Get your API key and start building.