Skip to main content
Use the masterprompt below to guide AI agents through an end-to-end Emerge integration without hardcoding API specs. It keeps identifiers private and instructs the agent to read the live docs for exact endpoints, parameters, and response formats.

Masterprompt (copy/paste)

Flow summary (spec-free)

  1. Create a signed consent link server-side and redirect the user.
  2. Handle the callback by verifying state and storing the returned uid.
  3. Poll export status via https://link.emergedata.ai/export/status/{uid} before querying.
  4. Query data using the stored uid, with pagination and delta sync where needed.
  5. Check consent status via https://link.emergedata.ai/consent/status/{uid} and stop processing if revoked.
Why this matters:
  • The uid is the canonical user scope. Keeping it server-side prevents wrong-user data access.
  • Polling export status avoids empty results and improves UX when data is not ready.
  • Keeping secrets off the client prevents data leakage.

Integration scaffold (server-side)

Edge cases / gotchas

  • state must be verified on callback or you risk account linking attacks.
  • Querying before export is ready can return empty results; poll export status and retry with backoff.
  • If a user revokes consent, stop processing and delete data to stay privacy-first; use the consent status endpoint to detect changes.
  • Never prompt the user to type a uid — it must stay server-side.