Skip to main content
documents.stream creates the document and gives you its events as they happen.
Each event carries display.es: a short text (“Revisando…”, “¡Listo!”) meant to be shown as is in your interface.

On your site

The API key cannot go to the browser, so your server acts as a bridge: it receives the events with the SDK and forwards them to your page. For example, with a Next.js route:
app/api/report/route.ts
If the user closes the page, signal cuts the stream. The document keeps being created anyway; you can get it with documents.get(id).

Follow a document that already exists

If you created it in the background, or the connection dropped, follow its events from where you left off:

Cancel