Extracting Content, Reading Metadata, and Transforming Files with Riviera
Riviera is Dropbox’s content-processing platform. Its public routes read a file and give you back something derived from it. There are three of them:
/riviera/extract_asyncextracts content: Markdown, plain text, OCR text, a transcript, or video keyframes./riviera/get_metadata_asyncretrieves structured metadata: image EXIF, audio and video properties, PDF page data, or Office document properties./riviera/get_transform_asyncconverts the file to a new one, such as a PDF, an HTML page, an image, a thumbnail, or a single video frame.
get_markdown_async, get_text_async, get_ocr_async, get_transcript_async, and get_keyframes_async are deprecated and will be turned off by December 31, 2026. Use extract_async instead. See Moving off the deprecated routes.
Picking the right route
Each route answers a different question about a file, and you can use them independently.
All three are read-only. They never change the source file, and they don’t write anything to the user’s Dropbox, including the output of a transform.
Each request handles one file. To process several files, send one request per file.
Moving off the deprecated routes
extract_async replaces five single-purpose routes. Each extract_type variant takes the same options as the route it replaces.
get_metadata_async isn’t deprecated, and neither are the transform routes.
Moving a call over takes three changes:
-
Move the options into
extract_type. The old routes took their options at the top level of the request. Inextract_asyncthey go inside theextract_typeobject, next to its.tag:Before, calling
get_markdown_async:After, calling
extract_async:Always send
extract_typeas an object, even for a type with no options:{".tag": "text"}, not"text". -
Poll
extract_async/check. The polling flow is the same as before. -
Read the result one level deeper. A
completeresult now holds a union tagged with the extraction type, and that union carries the same fields the old route returned:Before, from
get_markdown_async/check:After, from
extract_async/check:
A failed job now returns one error union, ExtractApiV2Error, for every extraction type. Some failures also come back as a more specific variant than before. For example, a file over a size limit returns limit_exceeded_error where an old route returned user_error. If your code branches on errors, check it against Handling failures.
How the routes work: launch and poll
All three routes are asynchronous:
- Call the route. It starts a job and returns an
async_job_id. - Poll the corresponding
/checkroute with that ID, such asextract_async/check. It returns one of:in_progress: the job is still running. Poll again later.complete: the job finished. The result is in the response.failed: the job failed. The response carries a typed error you can branch on.
Transforms add one step: a complete transform result describes the output file but doesn’t contain it. Pass its output_handle to download_transform_output to get the bytes.
Some guidance on polling:
- These routes are rate limited. About 15 seconds between polls is a safe starting point. Back off further for long media, and respect
retry_afteron a429response. - A failed job still returns HTTP 200 from
/check. Read.tagto tellcompleteandfailedapart. - The
async_job_idis all you need to poll, so you can launch a job in one process and poll it from another.
Pointing at a file
Every route takes the source file in file_id_or_url. Set exactly one of:
path: an absolute Dropbox path, such as/docs/spec.pdf.file_id: a Dropbox file ID, such asid:a4ayc_80_OEAAAAAAAAAYa. Prefer this for files you’ll process again, since it still works after the file is renamed or moved.url: either a Dropbox shared link or an external HTTP or HTTPS URL.- Dropbox resolves a shared link as the calling user, and respects the link’s settings. A password-protected link, or one with downloads disabled, is rejected.
- Dropbox’s servers fetch an external URL, so it must be reachable from the public internet and point at a supported file type.
Which inputs work depends on how you authenticate:
extract_async with extract_type set to ocr doesn’t accept external URLs; they fail with unsupported_format_error.
All of these routes need the files.content.read scope. See the File Access Guide for information on how paths, file IDs, and shared links work.
Extracting content
/riviera/extract_async covers every kind of content extraction. Set extract_type to the kind you want. Refer to the documentation for information on supported file types and size limits.
Options
Options go inside the extract_type object. Any you leave out take their defaults.
text and ocr have no options.
Results
A complete result holds the variant that matches your extract_type:
The other variants have these fields:
text:text, the document’s plain text.ocr:text, the recognized text, andhocr, the same text with the position of each word.keyframes:frames, each with atimestamp, ascene_score, and animage_base64when you setinclude_images.
See the reference for every field.
Extracting file metadata
/riviera/get_metadata_async takes only file_id_or_url. The file’s type decides which kind of metadata you get:
A file in any other format, or over the size limit for its kind, fails with user_error.
Read metadata_type to find out which variant metadata holds:
All metadata is best-effort. When the file doesn’t record a field, the field is left out or set to its default. For example, a photo taken with location turned off has no GPS data. See the reference for the full list of fields, supported formats, and size limits.
Converting files
/riviera/get_transform_async produces a new file from the source file. Set transform_type to the output you want:
Use image for formats a browser can’t show directly, such as HEIC, RAW, PSD, or SVG. It doesn’t accept formats a browser already shows, such as JPEG or PNG; use thumbnail to resize those. Prefer image to image_pdf unless you specifically want the PDF rendering.
The reference lists every format each transform accepts.
Options
A transform’s options go in a separate top-level field named after the options set, not inside transform_type. Send only the options set that belongs to your transform_type. Any other options set fails with invalid_options_error.
To pick out a single frame, use video_frame. To find every scene change in a video, use extract_async with keyframes.
Downloading the output
When you poll get_transform_async/check, a complete result describes the output file:
The format is what Riviera actually produced, which for some sources isn’t what you asked for. Check format or mime_type before you hand the file to something else.
Pass output_handle to /riviera/download_transform_output to get the bytes. Like files/download, this route is on content.dropboxapi.com. It takes its argument in the Dropbox-API-Arg header, returns the file as the response body, and describes the file in the Dropbox-API-Result header:
Keep these in mind when downloading:
- Only the user who requested the transform can redeem its handle. A handle from another user, or one that was never valid, fails with
user_error. - A handle stops working at
expires_ts, which is in Unix seconds. After that, the download fails withexpired_handle_error, and you need to request the transform again. - The download usually returns straight away. If Riviera has dropped the cached output, it makes the file again before responding, which can take as long as the original transform.
Handling failures
A failed job returns failed with a typed error. All three routes use the same set of error variants, apart from a few that only one route returns. Group them like this:
get_metadata_async is the exception: it reports an unsupported format or a file over its size limit as user_error, with a message saying which. Treat those as “skip the file”, not as a bad request.
A request that can’t be parsed at all, such as one with no extract_type, fails straight away with HTTP 400 instead of starting a job.
See each route’s reference for the exact variants it returns.
A typical end-to-end flow
- Find the file. Get a path or file ID, or a shared link. Prefer a file ID for anything you’ll process again.
- Start the job. Call
extract_async,get_metadata_async, orget_transform_async, and save theasync_job_id. - Poll with back-off. Call the corresponding
/checkroute until it returnscompleteorfailed. - Use the result. Store the extracted content or metadata. For a transform, download the output with
download_transform_outputbeforeexpires_ts. - Handle failures by type. Retry
server_errorwith back-off, fix the request for input errors, and skip files that can’t be processed.
To process many files, run this flow for each file in parallel. Retry the launch call as well as polls, and expect some files to fail while others succeed.