Getting started
Authentication
API keys, organization context, and request headers
3 min read
Every KLOAKD API request carries an API key, and the module routes name your organization ID in their path.
API Key
Generate an API key from the dashboard: Settings → API Keys.
API keys start with sk-live- and work on every plan, Free included. A free account comes with 0.5 GB of data for 30 days; create one.
The batch job routes and the unified scrape routes take the API key too. Creating a batch and every unified scrape call need a live key, and unified scrape needs Extract and the strategy engine in the plan.
Never expose your API key in client-side code or commit it to version control. Always use environment variables.
Request headers
Every API request must include:
| Header | Value |
|--------|-------|
| Authorization | Bearer <your-api-key> |
| Content-Type | application/json (requests with a body) |
The organization goes in the path: /api/v1/organizations/{org_id}/evadr/fetch.
SDK configuration
Python
from kloakd import Kloakd
client = Kloakd(
api_key="sk-live-...",
organization_id="your-org-uuid",
)
TypeScript
import { Kloakd } from 'kloakd-sdk';
const client = new Kloakd({
apiKey: 'sk-live-...',
organizationId: 'your-org-uuid',
});
Go
client := kloakd.MustNew(kloakd.Config{
APIKey: "sk-live-...",
OrganizationID: "your-org-uuid",
})
Java
Kloakd client = Kloakd.builder()
.apiKey("sk-live-...")
.organizationId("your-org-uuid")
.build();
Environment variables
Keep the key out of your code: read it from the environment and pass it in.
export KLOAKD_API_KEY=sk-live-...
export KLOAKD_ORG_ID=your-org-uuid
import os
client = Kloakd(api_key=os.environ["KLOAKD_API_KEY"], organization_id=os.environ["KLOAKD_ORG_ID"])
Request lifecycle
Every API request passes through a 5-stage gateway pipeline before reaching the handler:
- Authentication — validates your API key or JWT token
- Tenant resolution — resolves the organization from the credential
- IDOR protection — verifies the
org_idin the URL path matches the credential's organization (prevents cross-tenant access) - Entitlement check — confirms your plan includes the requested module
- Quotas & metering — checks the GB allocation, any request-rate limit that applies, and takes one of the organisation's work slots (fair use), and records usage
The organization ID in the URL must match the organization associated with your API key. Mismatched requests return 403 — this is an intentional security control that prevents one tenant from accessing another's data.
Error responses
| Status | Error | Meaning |
|--------|-------|---------|
| 401 | AuthenticationError | Missing or invalid API key |
| 402 | PaymentRequiredError | The plan's last payment failed |
| 403 | ForbiddenError / NotEntitledError | Organization ID mismatch (IDOR protection: ForbiddenError), or the plan doesn't include this (NotEntitledError) |
| 409 | ConcurrencyLimitError | concurrent_limit: all of your plan's work slots stayed in use, on a route that cannot queue; a fetch or an extraction is queued instead (Rate limits) |
| 429 | RateLimitError / QuotaExceededError | A request-rate limit where one applies, a test key's quota used up, the GB allocation used up, or queue_full (too many of your requests already waiting for a work slot) |
| 503 | BillingUnavailableError | Usage could not be checked; retry after Retry-After |
