Skip to Content
APIOrganizations

Organizations API

Manage organizations, members, and org-scoped resources.

Organization endpoints require user authentication via Clerk. API keys cannot access organization management endpoints.

List Organizations

Returns organizations the authenticated user belongs to.

GET /v1/orgs Authorization: Bearer {clerk_session_token}

Response

{ "organizations": [ { "id": "org_abc123def456", "name": "Acme Corporation", "slug": "acme-corp", "role": "owner", "member_count": 12, "created_at": "2025-01-15T08:00:00Z" }, { "id": "org_xyz789ghi012", "name": "Security Team", "slug": "security-team", "role": "member", "member_count": 5, "created_at": "2025-06-20T14:30:00Z" } ] }

Role Values

RoleDescription
ownerFull access including org deletion
adminManage members, settings, API keys
memberView scans, submit feedback

Get Organization

Returns details for a specific organization.

GET /v1/orgs/{org_id} Authorization: Bearer {clerk_session_token}

Path Parameters

ParameterTypeDescription
org_idstringOrganization ID

Response

{ "id": "org_abc123def456", "name": "Acme Corporation", "slug": "acme-corp", "member_count": 12, "settings": { "default_policy": "strict", "require_justification": true, "baseline_auto_update": false }, "created_at": "2025-01-15T08:00:00Z", "updated_at": "2025-12-01T10:00:00Z" }

Errors

StatusCodeDescription
403org_access_deniedUser is not a member of this organization
404org_not_foundOrganization does not exist

List Organization Members

Returns all members of an organization.

GET /v1/orgs/{org_id}/members Authorization: Bearer {clerk_session_token}

Requires Admin or Owner role in the organization.

Response

{ "members": [ { "user_id": "user_abc123", "email": "alice@acme.com", "name": "Alice Smith", "avatar_url": "https://img.clerk.com/...", "role": "owner", "joined_at": "2025-01-15T08:00:00Z" }, { "user_id": "user_def456", "email": "bob@acme.com", "name": "Bob Johnson", "avatar_url": "https://img.clerk.com/...", "role": "admin", "joined_at": "2025-03-20T09:30:00Z" }, { "user_id": "user_ghi789", "email": "charlie@acme.com", "name": "Charlie Brown", "avatar_url": null, "role": "member", "joined_at": "2025-06-15T14:00:00Z" } ], "total": 3 }

Get Organization Stats

Returns aggregated scan statistics for an organization.

GET /v1/orgs/{org_id}/stats Authorization: Bearer {clerk_session_token}

Query Parameters

ParameterTypeDefaultDescription
sinceISO 860130 days agoStart of date range
untilISO 8601nowEnd of date range

Response

{ "total_scans": 1247, "unique_agents": 23, "findings": { "total": 892, "by_severity": { "critical": 12, "high": 67, "medium": 312, "low": 501 }, "by_category": { "security": 245, "governance": 312, "reliability": 335 } }, "risk_score": { "average": 42, "trend": -5.2, "trend_direction": "improving" }, "scan_frequency": { "daily_average": 8.3, "weekly_total": 58 }, "last_scan_at": "2025-12-28T09:45:00Z" }

Get Organization Scans

Returns scan history for an organization.

GET /v1/orgs/{org_id}/scans Authorization: Bearer {clerk_session_token}

Query Parameters

ParameterTypeDefaultDescription
limitinteger50Max results (1-100)
offsetinteger0Pagination offset
statusstringallFilter: completed, failed, pending
agent_idstring-Filter by agent
sinceISO 8601-Scans after this date

Response

{ "scans": [ { "id": "scan_abc123", "agent_name": "customer-service-agent", "status": "completed", "finding_count": 5, "risk_score": 35, "created_at": "2025-12-28T09:45:00Z", "completed_at": "2025-12-28T09:45:12Z" } ], "total": 1247, "has_more": true }

Get Organization API Keys

Returns API keys created for an organization.

GET /v1/orgs/{org_id}/api-keys Authorization: Bearer {clerk_session_token}

Requires Admin or Owner role in the organization.

Response

{ "api_keys": [ { "id": "key_abc123", "name": "CI/CD Pipeline - Production", "key_prefix": "ink_org_abc", "scopes": ["scan:create", "scan:read"], "last_used_at": "2025-12-28T08:00:00Z", "created_at": "2025-06-01T10:00:00Z", "created_by": { "id": "user_xyz789", "email": "alice@acme.com" } } ], "total": 3 }

Create Organization API Key

Creates a new API key scoped to an organization.

POST /v1/orgs/{org_id}/api-keys Authorization: Bearer {clerk_session_token} Content-Type: application/json

Requires Admin or Owner role in the organization.

Request Body

{ "name": "CI/CD Pipeline - Staging", "scopes": ["scan:create", "scan:read"] }

Available Scopes

ScopeDescription
scan:createCreate new scans
scan:readRead scan results
feedback:writeSubmit calibration feedback

Response

{ "id": "key_def456", "name": "CI/CD Pipeline - Staging", "key": "ink_org_Abc123Def456Ghi789...", "key_prefix": "ink_org_Abc", "scopes": ["scan:create", "scan:read"], "created_at": "2025-12-28T10:00:00Z" }

The full API key is only returned once at creation time. Store it securely.


Get Organization Audit Logs

Returns audit log entries for an organization.

GET /v1/orgs/{org_id}/audit-logs Authorization: Bearer {clerk_session_token}

Requires Admin or Owner role in the organization.

Query Parameters

ParameterTypeDescription
event_typesstringComma-separated event types
actor_idstringFilter by actor
sinceISO 8601Events after this time
untilISO 8601Events before this time
limitintegerMax results (default: 100)

Response

{ "audit_logs": [ { "id": "log_abc123", "event_type": "api_key.created", "actor": { "id": "user_xyz789", "email": "alice@acme.com", "type": "user" }, "resource_type": "api_key", "resource_id": "key_def456", "action": "create", "metadata": { "key_name": "CI/CD Pipeline", "scopes": ["scan:create"] }, "ip_address": "203.0.113.42", "created_at": "2025-12-28T10:00:00Z" } ], "total": 1547, "has_more": true }

Event Types

CategoryEvents
API Keysapi_key.created, api_key.revoked, api_key.used
Scansscan.started, scan.completed, scan.failed
Membersorg.member.added, org.member.removed, org.member.role_changed
Suppressionssuppression.created, suppression.revoked
Feedbackfeedback.added

Last updated on