Asset lifecycle and moderation
An asset is a file, remote URL, or extracted child submitted for classification. Its upload, classification, moderation and content states each have a status, described below.
| Object | Answers | Statuses |
|---|---|---|
upload | Whether source content has arrived, including multipart progress. | uploading, completed |
classification | Classification progress and results for each capability. | queued, processing, completed, failed |
classification.moderation | Safety findings, policy assessment and the decision in force, which also decides delivery. | pending, allowed, limited, age-restricted, blocked, purged |
content | Whether CalmLens holds the content: the source, its preview and extracted text. | temporary, stored, removed |
upload.updatedAt, classification.updatedAt and content.updatedAt record changes to each state. classification.completedAt records when classification finished. A manual decision records its time in the review entry’s reviewedAt; it does not change the classification timestamps.
Upload and classification
| State | Meaning |
|---|---|
| uploading | A multipart upload is open and expects the next sequential part. upload.partsReceived counts the parts received so far. |
| queued | Classification hasn't started because the asset is waiting for its content, such as a multipart upload still receiving parts. |
| processing | The upload is complete and classification is waiting for a worker or running. |
| completed | Classification finished. classification.completedAt records completion; classification.moderation holds the safety findings and status. |
| failed | Processing could not complete. Background processing retries temporary failures automatically for up to about 15 minutes, and the asset stays processing meanwhile; content that can never be processed, such as a corrupt file, fails at once. classification.moderation.status stays pending. Retry processing, or block or purge the asset in the portal or with POST /. A reviewer can't allow, limit or age-restrict an asset whose processing failed. |
An asset is settled once classification.status is completed or failed: moderation has decided it, or processing failed.
Moderation
classification.moderation.status is the base decision in force. Every project serves jurisdictions with regional rules, so also apply the viewer-specific action before publication or delivery. You can wait for it in the upload request or receive it as an event; see Waiting for the decision.
classification.moderation.status | Meaning |
|---|---|
| pending | No decision yet: the asset is uploading, processing, or processing failed. |
| allowed | Delivered normally, subject to the other delivery checks below. |
| limited | Delivered like an allowed asset. Your app reduces its reach; see Limited assets. |
| age-restricted | Refused unless the request confirms age with viewerClaims.ageConfirmed: true, including API-key and signed-URL requests. Your app decides who sees it; see Age-restricted assets. |
| blocked | Not delivered. Content kept with keepContentAfterProcessing stays available to short-lived portal review links. |
| purged | Not delivered, and the stored content was deleted. |
The other classification.moderation fields explain the status:
| Field | Meaning |
|---|---|
automatedStatus | The status automated moderation decided: allowed, limited, age-restricted, blocked or purged. Absent until moderation decides. A reviewer's decision does not change it. flaggedCategories lists the categories acted on and source identifies what determined the action. See Mandatory and regional decisions. |
manualReviews | Review history, oldest first. Each entry has id, decision, note, decidedBy, reviewedAt and applied. decidedBy.type is user for a person (or an assistant acting for one) or api-key for an API key, and decidedBy.id is that user's or key's ID, null when it wasn't recorded. Reviewers' names and emails are shown only in the portal. applied is false for a review queue decision that confirmed the asset without changing its status. Empty until an asset is reviewed. |
A reviewer's decision takes precedence over the automated one: status follows the latest applied manual review, while automatedStatus, source, flaggedCategories, categories and raw retain the automated findings and assessment. Reviewing an asset does not change classification.completedAt.
Content
content.status | Meaning |
|---|---|
| temporary | CalmLens holds the content only until processing finishes, because keepContentAfterProcessing is false, or until a pending human review of its decision is done. |
| stored | CalmLens retains the content. |
| removed | The content was deleted. content.removalReason says why. |
content.removalReason | Removed because |
|---|---|
| policy | Your policy's purge action deleted it. |
| retention | keepContentAfterProcessing was false, so it was deleted once processing finished. |
| requested | You removed it through the API or the portal, or a reviewer purged the asset. |
| parent-removed | It was derived from a parent asset whose content was removed. |
| disposed | It was disposed of after a safety hold. |
content also describes the file:
| Field | Meaning |
|---|---|
format | The file's MIME type. |
extension | The file extension. |
sizeInBytes | The file's size. Kept after the content is removed. |
checksums | Checksums of the stored bytes. |
extractedText | Text read from the file; see OCR and image reports. |
safetyHold | Set when delivery is restricted for suspected illegal content. |
width, height | The uploaded image's or video's size in pixels. Kept after the content is removed. |
durationSeconds | The length of audio and video once analysed. |
pageCount | The number of pages or slides of a document or presentation, when known. |
perceptualHash | Image assets only. A 256-bit PDQ hash in 64 hexadecimal characters, the format shared lists of known images use. Hashes 31 or fewer bits apart are usually the same picture. Kept after the content is removed. |
perceptualHashQuality | Image assets only. Below 50, the hash comes from a flat or featureless image, so leave it out of comparisons. |
metadata | Metadata embedded in an uploaded image; see File metadata. |
rendered | The displayable file the CDN serves at /rendered, or null when there is none. |
preview | The still image the CDN serves at /preview, or null when there is none. |
content.rendered has these fields:
| Field | Meaning |
|---|---|
kind | What the file is: image, pdf, video or audio Preview. Choose the element that shows it from this. |
format | The file's MIME type. An image is served in the best format the browser accepts, unless a transform sets one. |
width, height | The full view's size in pixels, for images and video; null for PDFs and audio. |
peaks Preview | Audio only: up to 512 loudness peaks from 0 to 1, evenly spaced over the audio, for drawing a waveform. |
content.preview has these fields:
| Field | Meaning |
|---|---|
width, height | The still image's size before it is sized or transformed. |
thumbhash | A small placeholder to show while any view of the asset loads, also served as a PNG at /placeholder. |
averageColor | The still image's average colour, another placeholder for any view of the asset. |
rendered and preview are set exactly when the CDN can serve them, and are null once the content is removed and while a safety or copyright hold is on. What the CDN serves lists them for each asset type.
Check content.status before loading the asset, since a removed asset keeps its size and hash.
Delivery while moderation runs
The CDN checks the current status, not the original policy action, on both cache hits and misses. All applicable checks below must pass; an allowed status alone does not guarantee delivery. Content must exist, and private requests must be authorised.
| Check | Effect on CDN delivery |
|---|---|
upload.status uploading | Never. |
classification.status queued or processing | No by default: Block assets until moderation finishes is on, so only assets that have passed moderation are served, including their previews, lenses, transforms and signed URLs. A project that turns it off serves retained content as soon as the upload completes. |
classification.moderation.status allowed or limited | Passes the moderation gate. Other checks still apply. |
classification.moderation.status age-restricted | Only to requests that confirm age with viewerClaims.ageConfirmed: true, including API-key and signed-URL requests. See Age-restricted assets. |
classification.moderation.status blocked | Only through a short-lived portal review link when the content is retained. Ordinary delivery is blocked. |
classification.moderation.status purged | Never. |
classification.status failed | Never. Retry processing to make the asset servable again. |
Removed content and assets under a safety or copyright hold are never served either. A reviewer decision on removed content only sets the status (see Reports and reviews). Blocked requests return 403 asset/not-available.
Failure reasons
While classification.status is failed, classification.failureReason says why, and the asset.failed event carries the same value in its failure-reason fact. It is null at any other status.
| Reason | Meaning | What to do |
|---|---|---|
| file-too-large | The file is over the size limit for its type, an image is over the byte or pixel limit for processing, a spreadsheet or presentation is over its cell, sheet or slide limit, or a website shows an image over 10 MiB. | Upload a smaller file. |
| duration-limit | Audio or video is longer than 120 seconds before billing is set up, or longer than 30 minutes after Preview. See Coverage and limits. | Trim it, split it into separate uploads, or set up billing. |
| resolution-limit | Video is larger than 4096 × 2160 pixels. | Re-encode it at a lower resolution. |
| unsupported-format | The file's format isn't supported, or it is too damaged to identify. | Convert it to a supported format. |
| undecodable-content | The format is recognised, but the content can't be decoded: the file is corrupt or uses an unsupported codec. | Re-encode or re-export it. |
| multiple-tracks | Audio or video has more than one audio or video track. | Keep one track of each kind. |
| type-mismatch | The content doesn't match the asset type, such as a video file uploaded as audio. | Upload it with the right MIME type. |
| free-uploads-exhausted | Before billing is set up, the upload contains more text than free uploads allow. See Pricing. | Set up billing, then retry the asset. |
| media-limit | The organisation started its 600 minutes of long audio and video in the last 24 hours. | Retry the asset once earlier long media is more than a day old. |
| uploads-paused | The expected cost of long audio or video would pass a spend limit or project budget that pauses uploads. | Raise the limit, or retry the asset once usage allows it. |
| too-many-items | A document, spreadsheet or presentation holds more embedded images or audio and video files than can be moderated, or a website is too long or shows too many images. See Spreadsheets and presentations and Website moderation. | Split it into smaller documents or pages. |
| processing-error | Processing couldn't complete, for example because a service was unavailable. | Retry the asset. |
Reasons caused by the content itself fail the same way on every retry; replace the content with a new upload instead. A document or website whose child failed fails with that child's reason, or processing-error when the child's failure can be retried or a child is missing.
Recover from processing failure
- Retrieve the asset and inspect
classification.statusandclassification.failureReason. Keep it unpublished while processing has failed or hasn't finished. - Retry with POST
/only when classification is failed, moderation is still pending, no safety hold applies, and processable content remains. This can be stored file bytes, inline text, or an eligible website URL that CalmLens can load again. A website retry checks the page as it exists now.assets/ :assetId/ retry - The retry returns the asset to processing. Wait for a status event or poll with a timeout, handling another failure as well as a completed decision. Keep the existing asset ID and application record.
- If the content is unavailable, or you need to correct the submitted file, upload a fresh copy with a new asset ID and unique
externalId. Link it to a new pending version of your application record. A retry cannot restore deleted bytes or replace an already reviewed decision.
const response = await client.assets.retry({
"assetId": "asset_5Gm2Rk8XqT3wLp9VbN4c"
});
The retry endpoint documents its error codes. Repeating a CDN request does not retry classification. Retry only reprocesses failed assets: it can't recheck a decided asset, for example for the EU after you opt in (see Existing assets and rollout).
Retention and visibility
processingOptions.keepContentAfterProcessing defaults to false. When it is false, the content is temporary while the asset processes, and CalmLens deletes it once processing finishes, whatever the decision. content.status then becomes removed with removalReason retention. The asset record and report remain, but its content cannot be served from the CDN. If processing fails, the content is kept so the asset can be retried. If the decision is sampled for human review, the content is kept, but not delivered, until the review is decided or for at most 14 days.
Set keepContentAfterProcessing: true when you intend to serve content, generate previews, retain extracted text, or apply CDN transforms. The content is then stored until your policy purges it or you remove it.
visibility defaults to private and only controls access to retained content:
- public content is available without authentication.
- private content requires a signed URL, or an API key or portal session with Download assets for the asset's folder; see Asset URLs.
Visibility does not cause content to be retained. A public asset with keepContentAfterProcessing: false still has no source content to serve.
Reports and reviews
Use Reading classification results for scores and evaluation coverage, and Policies and actions for actions and exceptions.
Reviewers set the status in the portal, or your app records their decision with POST /: allowed, limited, age-restricted, blocked or purged. An asset still pending moderation can only be blocked or purged. Purging needs assets:delete as well as assets:update. Blocking doesn't delete content, so if it was kept, a later review can restore delivery. Purging permanently deletes the content after explicit confirmation, and a later review cannot restore it.
A reviewer can also decide an asset whose content was already removed, for example by default retention. The decision then only sets the status, which apps that host their own copy of the content follow; the CDN still has nothing to deliver. A purged asset, whether purged by your policy or a reviewer, can only be blocked afterwards: allowing, limiting or age-restricting it is refused with 409 asset/content-purged.
Each review records its decision and note and is appended to classification.moderation.manualReviews, so a later decision can override an earlier one without erasing its explanation. A decision on the asset page or through the API requires a note; in the human review queue, only changing the outcome does. The matching event carries the note, and its actor is the user or api-key that decided; the portal names the person or key. Qualifier-based explanations are shown in the category details.
Child assets
Documents and websites can produce child assets for extracted content: a document's text, its embedded images and audio and video files and, for a presentation, images of the slides that are rendered (see Spreadsheets and presentations). The parent's status follows its children, and its classification.moderation.source is then children. The first matching row decides it:
| When | Parent |
|---|---|
| Any child is blocked or purged | blocked |
| Any child's processing failed, or a child is missing | Classification fails, with the child's reason |
| Every child is decided and any is age-restricted | age-restricted |
| Every child is decided and any is limited | limited |
| Every child is decided and allowed | allowed |
A document is decided only from all of its children, so it is never allowed while any of them is undecided, failed or missing. Once the parent has its decision, it keeps it: only a reviewer's or appeal decision changes it again. Inspect the children for their individual reports.
A reviewer's decision on the parent takes precedence over its children. A reviewer's decision on a child changes the parent only like this:
| Parent | Child decided as | Parent afterwards |
|---|---|---|
| Decided by a reviewer | blocked or purged | blocked, which then stands as the parent's reviewer decision |
| Decided by a reviewer | Any other status | Unchanged |
| Decided by its children | Any status | Decided again from its children, as in the table above |
When this changes the parent's status, its asset.blocked (or other status) event names the reviewer as its actor, with child-asset and child-status facts for the child and its decision. The portal asks the reviewer to confirm before a decision on a child can change its parent.
client.assets.listChildren({ assetId })
A spreadsheet's text child reads sheet by sheet, each starting with a # Sheet "Name" line and then a line per row, such as Row 12: A=Widget | C=1200 (formula: =SUM(C1:C11)). A presentation's reads slide by slide, each starting with a # Slide 3 line, followed by the slide's text and Alt text:, Notes: and Comment: lines. A Word or OpenDocument text document's reads in order, a table row per line with its cells separated by |, followed by Header:, Footnote:, Endnote:, Footer:, Comment: and Alt text: lines; tracked deletions read as [deleted: …] where they were. Hidden sheets, rows, columns and slides are marked (hidden).
Images with OCR enabled store extracted text in their own content.extractedText field and combine its text moderation with the image report. See OCR and image reports for retention and combined results.
Deletion choices
- Remove content deletes stored bytes while retaining the asset record, metadata, and moderation history.
content.statusbecomes removed withremovalReasonrequested. It also removes the content derived from those bytes in child assets, such as the text and images extracted from documents and websites, while keeping the child records; theirremovalReasonis parent-removed. - Delete asset deletes the record itself, together with its child assets and their content. A child asset is part of its parent's decision, so it can't be deleted on its own: deleting one, alone or in a batch, is refused with 409 asset/child-not-deletable. Delete the parent instead, or remove the child's content, which leaves the parent's decision as it is. Deleting a project or account deletes all of its assets.
- Batch operations remove the content of, or delete, up to 500 assets in one request with
client.assets.batch()(POST/). They run in the background and skip assets under a safety hold.projects/ :projectId/ assets/ batch
The CDN stops serving removed or deleted content within seconds, including copies cached at the edge. Child assets under their own safety hold keep their content until the hold is resolved.