TypeScript SDK API reference
Every client method, argument, and return type.
Construction
import { Cohesion } from "@cohesionauth/sdk";
const client = new Cohesion({
apiKey: process.env.COHESION_API_KEY!,
baseUrl: "https://api.cohesionauth.com", // default
timeoutMs: 30000, // default
maxRetries: 3, // default, exponential backoff
});
Methods
score(params, options?) => Promise<ScoreResponse>
Wraps POST /v1/score.
scoreBatch(params, options?) => Promise<BatchScoreResponse>
Wraps POST /v1/score/batch.
operatorProfile(operatorId) => Promise<OperatorProfile>
Wraps GET /v1/operator/:id/profile.
organizationDashboard() => Promise<OrganizationDashboard>
Wraps GET /v1/organization/dashboard.
maintenanceRecommend(params) => Promise<MaintenanceRecommendation>
Wraps POST /v1/maintenance/recommend.
complianceReport(params) => Promise<ComplianceReport>
Wraps GET /v1/compliance/report.
admin.rotateKey() => Promise<RotatedKey>
Wraps POST /v1/admin/key/rotate.
admin.revokeKey() => Promise<RevokedKey>
Wraps POST /v1/admin/key/revoke.
admin.auditLog(params?) => Promise<AuditEvent[]>
Wraps GET /v1/admin/audit-log.
Errors
Typed error classes:
CohesionAuthError(401)CohesionValidationError(422)CohesionRateLimitError(429), hasretryAfterSecondsCohesionServerError(5xx)
Next step
Cookbook for end-to-end recipes.