Overview
The Mocra JavaScript SDK wraps the Mocra REST API and handles authentication, serialization, and error handling for you. TypeScript typings are included. Package:@mocra/observe — requires Node.js 18+
Installation
Quick start
VideoObservabilityApi
The main client class. Instantiate it once with your API key and reuse it across requests.
Constructor parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Your Mocra API key. See the Quickstart to get one. |
scoreVideo()
Analyzes a video against Mocra’s built-in criteria and any custom criteria you provide.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
videoUrl | string | required | Publicly accessible URL of the video to analyze. |
extraCriteria | ExtraCriterion[] | [] | Additional custom criteria to evaluate. |
ignoreCriteria | string[] | [] | Built-in criteria to exclude from the analysis. See default criteria for accepted values. |
Returns: Promise<ScoreMap>
| Field | Type | Description |
|---|---|---|
severity | number | Overall quality score from 1 (worst) to 100 (best). |
criteria | CriterionScore[] | Per-criterion breakdown. Each item has name: string and score: number (1–100). |
ExtraCriterion
Defines a custom quality criterion to include in the analysis.
| Field | Type | Description |
|---|---|---|
criterionName | string | Short label for the criterion. |
criterionDescription | string | Full description of what the criterion checks. |
Default criteria
The following built-in criteria are evaluated by default. Pass one or more of these strings toignoreCriteria to exclude them from the analysis.
| Value |
|---|
"UNNATURAL PHYSICS" |
"MORPHING" |
"FLICKERING" |
"ARTIFACTING" |
"TEXT ISSUES" |
Error handling
scoreVideo rejects with an error if the API returns a non-200 response or if a network failure occurs.

