API

Secryn API Reference

API Reference

This section documents the Secryn API endpoints and functionality.

Authentication

All API requests require authentication using a valid API key:

curl -H "Authorization: Bearer YOUR_API_KEY" https://api.secryn.com/v1/endpoint

Getting Your API Key

  1. Log in to your Secryn Dashboard
  2. Navigate to Settings → API Keys
  3. Click "Generate New Key"
  4. Copy and store securely

Base URL

https://api.secryn.com/v1

Endpoints

Health Check

Check the health of the API:

GET /health

Response:

{
  "status": "ok",
  "version": "1.0.0"
}

Resources

The API provides endpoints for managing various resources. Each resource typically supports:

  • GET /resources - List all resources
  • GET /resources/:id - Get a specific resource
  • POST /resources - Create a new resource
  • PUT /resources/:id - Update a resource
  • DELETE /resources/:id - Delete a resource

Example: List Resources

curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.secryn.com/v1/resources

Response:

{
  "data": [
    {
      "id": "res_123",
      "name": "Example Resource",
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "pagination": {
    "total": 1,
    "page": 1,
    "limit": 50
  }
}

Rate Limiting

API requests are rate-limited to prevent abuse:

  • Free tier: 100 requests/minute
  • Pro tier: 1,000 requests/minute
  • Enterprise: Custom limits

Rate limit information is included in response headers:

  • X-RateLimit-Limit - Total requests allowed
  • X-RateLimit-Remaining - Remaining requests
  • X-RateLimit-Reset - Unix timestamp when limit resets

Error Handling

The API returns standard HTTP status codes:

  • 200 - Success
  • 400 - Bad Request
  • 401 - Unauthorized
  • 403 - Forbidden
  • 404 - Not Found
  • 429 - Too Many Requests
  • 500 - Server Error

Error response format:

{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "Invalid request parameters",
    "details": {
      "field": "api_key",
      "reason": "Missing required field"
    }
  }
}

Webhooks

Configure webhooks to receive events:

curl -X POST https://api.secryn.com/v1/webhooks \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/webhook",
    "events": ["resource.created", "resource.updated"]
  }'

Pagination

List endpoints support pagination:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.secryn.com/v1/resources?page=2&limit=25"

Next Steps