Displays On Demand measurements
Measurements are the core of the Displays On Demand lifecycle. After you create an asset, you purchase a draft measurement, poll for completion, and then, when the final purchase is available, purchase a final measurement to publish the asset. This page covers the purchase and poll contract, the SLA posture, and final measurement completion.
Status: the final purchase is not yet available. Today POST /v2/viewcast/measurements/purchase/final returns 501 NOT_YET_AVAILABLE in every asset state, charges nothing, and does not change the asset. A created asset therefore stays at draft_measured after its draft measurement. The final-purchase prices, refunds and publication steps on this page apply when the final purchase is available. To get a final measurement today, use the direct purchase: it buys a final measurement for a display_id from the display catalog, not for an asset that you created.
Asset CRUD lives on the v2 base https://api2.mworks.com under the /v2/displays/* path. The measurement purchase and poll endpoints live under /v2/viewcast/measurements/* (purchases at /v2/viewcast/measurements/purchase/{type}). For the full endpoint reference, see Displays API reference and Viewcast API reference.
Purchase a measurement
POST /v2/viewcast/measurements/purchase/{type}
Queue a measurement by selecting the purchase type in the path: draft or final. There is no kind body field: the kind concept moved into the path, and a request body that still carries kind returns 400. The request body carries the asset_id of the asset to measure plus a caller-minted measurement_request_id (a UUID) as the idempotency key. The endpoint returns 202 Accepted. The Idempotency-Key header is no longer accepted: sending it returns 400.
curl -X POST https://api2.mworks.com/v2/viewcast/measurements/purchase/draft \
-H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
-d '{
"asset_id": "vcaJDVDYWSSMHAXVEFYW1DVD2PPFD",
"measurement_request_id": "550e8400-e29b-41d4-a716-446655440000"
}'
Response (202):
{
"data": {
"asset_id": "vcaJDVDYWSSMHAXVEFYW1DVD2PPFD",
"kind": "draft",
"status": "queued"
}
}
When the final purchase is available, the same shape will apply to purchase/final, with "kind": "final" in the response and the 300-credit purchase charge (see below). Today purchase/final returns 501 NOT_YET_AVAILABLE and charges nothing.
Replay safety: measurement_request_id is the idempotency key. Replaying the same measurement_request_id with the same body returns the original queued measurement without queuing a second run or charging a second purchase. Replaying the same id with a different body returns 409 idempotency_mismatch. Mint a fresh UUID for each genuinely new measurement request. The replay promise is evaluated after the credit charge: a same-id replay against an empty wallet returns 402 rather than the cached result, and no credit moves on the 402.
Minting a measurement_request_id (any RFC 4122 UUID; generation is always client-side):
// JS / TS (browser, Node 19+, Cloudflare Workers)
const measurementRequestId = crypto.randomUUID();
# Python
import uuid
measurement_request_id = str(uuid.uuid4())
// Go (github.com/google/uuid)
id := uuid.NewString()
# Ruby (securerandom stdlib)
require 'securerandom'
measurement_request_id = SecureRandom.uuid
// Java
String measurementRequestId = java.util.UUID.randomUUID().toString();
State guard: today purchase/final returns 501 NOT_YET_AVAILABLE in every asset state, so the state guard does not apply yet. When the final purchase is available, calling purchase/final while the asset is still in draft state will return 409 (the state machine forbids a final purchase from the current state). You must queue and complete a purchase/draft measurement first, which moves the asset to draft_measured. Only then can you queue purchase/final.
See Purchase flow and credits for the credit costs: 150 credits for a draft purchase, and 300 credits for a final purchase when the final purchase is available. Each price is the total and includes the 1-credit call charge.
Bulk purchase (batch)
POST /v2/viewcast/measurements/purchase/{draft,final}/batch
To buy measurements for many assets at once, the bulk purchase surface accepts 1 to 100 owned asset_ids per call, synchronously, with one outcome per item in submission order (queued, a skipped:<reason>, or a failed:<reason>). Every item runs exactly the single-purchase flow above, and skipped or failed items bill nothing. Each queued item costs 149 credits (draft), or 299 credits (final) when the final purchase is available. The call pays the 1-credit call charge once. If a queued item's measurement later fails or ends in a refunded outcome, the item is refunded. The refund for a batch item is what the item paid: 149 credits for a draft item, 299 credits for a final item when the final purchase is available. The batch call's 1-credit call charge is not refunded. Today a final batch call returns 501 NOT_YET_AVAILABLE for the whole call and charges nothing. See Viewcast batch measurement purchase.
Poll for completion
GET /v2/viewcast/measurements/{asset_id}
Poll this endpoint to check the status of the most recent measurement run. The response includes a status field and, when applicable, a refund_credits field. The measurement poll is free.
curl https://api2.mworks.com/v2/viewcast/measurements/$ASSET_ID \
-H "Authorization: Bearer ***"
The status field transitions through these values:
| Status | Meaning |
|---|---|
queued |
Measurement is waiting to be picked up by the pipeline |
running |
Measurement is actively being computed |
completed |
Measurement finished; check the result body for the outcome (measured, no_coverage, or insufficient_data) |
failed |
Measurement could not produce any result; the purchase is auto-refunded |
When the status is completed with an informational outcome (no_coverage or insufficient_data) or failed, the refund_credits field reflects the auto-refunded amount. The refund for a single draft or final purchase is the full price and includes the 1-credit call charge. For a batch item, refund_credits shows what the item paid: 149 credits for a draft item, 299 credits for a final item when the final purchase is available. See Purchase flow and credits for the refund rules.
Turnaround
Draft measurements complete through the normal production pipeline:
- A draft purchase queues (202 returned, 150 credits charged) and completes to a measured result through the normal production path. A completed draft measurement auto-progresses the asset from
drafttodraft_measured. - The
no_result_timeoutwindow still applies: if a queued measurement does not complete within the timeout, the purchase charge is auto-refunded. The refund for a single draft or final purchase is the full price and includes the 1-credit call charge. A draft batch item is refunded the 149 credits it paid.
Final measurement completion
Status: the final purchase is not yet available. This section describes how a final measurement will be published when the final purchase is available.
When the final purchase is available, a final measurement will complete in the daily completion run. The run processes each asset in draft_measured that has a queued final measurement. It moves the asset to final_measured and mints its display_id.
A final purchase will queue the measurement (202). The draft_measured to final_measured transition and the minted display_id will land on a daily completion run after the purchase. The poll then reports completed.
Auto-progression and the auto_progress_final caller hold
A completed draft measurement auto-progresses the asset from draft to draft_measured. The caller does not need to take any action to trigger this transition; it happens automatically when the draft result lands.
However, the progression from draft_measured to final_measured requires the caller to explicitly purchase a final measurement. This is the auto_progress_final caller hold: the API does not automatically queue or purchase a final measurement. When the final purchase is available, the caller decides when (and whether) to spend the 300 credits to publish the asset as a final, viewable inventory record.
What to read next
- Asset lifecycle
- Purchase flow and credits
- Direct measurement purchase - buy a measurement directly from a display_id, without creating a draft asset first.
- Methodology delta
- Displays Search
- Displays API reference
- Viewcast API reference