Agent-assisted integration
Agent-assisted integration
Give this page to your coding agent. It builds both legs: the SpreadSpace workspace on your own loan page, and the receiving side, where an analyst’s Finalize lands the approved figures in your database.
Hand it to your agent
In SpreadSpace, Finalize is the analyst’s last click on a spread. It locks
the spread and saves its figures as a snapshot that never changes. SpreadSpace
then sends your backend a spread.finalized webhook naming that snapshot, and
your backend reads the snapshot by id and stores the figures.
Your agent builds both legs of that. On the embed leg, your server mints a
single-use handle for one loan and the signed-in analyst, and your loan page
renders the SpreadSpace workspace from it, so the analyst works and finalizes
inside your product. On the backend leg, that Finalize reaches your receiver
as spread.finalized, and the snapshot’s figures are read by id into your own
database and onto your loan page. When the analyst reopens the spread,
spread.reopened marks your copy as under revision.
Save the skill
Copy the SKILL.md block below to
.claude/skills/spreadspace-integration/SKILL.md (Claude Code), or paste it
into AGENTS.md or your rules file (Cursor, Codex, and similar tools). It
carries both legs.
Add the standing rules
Append the CLAUDE.md block to your own CLAUDE.md / AGENTS.md, so the
rules hold on every session rather than only the one that writes the code.
Put the API keys in your environment
Two key shapes, both from Settings → Live API. For the receiver, a key
from the Backend preset, which holds webhooks:read, webhooks:write
and spreads:read, as SPREADSPACE_API_KEY. For the mint, a key from the
Embed preset, which holds embed:write and the writes a session may
carry, with the origin of your loan page under Allowed origins, as
SPREADSPACE_EMBED_API_KEY. One key can hold both: start from the Embed
preset, add webhooks:read, webhooks:write and spreads:read, and set
both variables to it. A test-mode key (ss_test_…) reaches the sandbox,
where the frame reaches only seeded loans and extractions are canned. That
is fine for the plumbing, but a finalize there freezes sample figures, not
yours.
Your agent can also read this page directly at
https://docs.spreadspace.app/get-started/agent-assisted-integration.md.
Every page here has a .md twin, and the index is at
/llms.txt.
SKILL.md
Save this as .claude/skills/spreadspace-integration/SKILL.md, or paste it into your agent’s rules file.
The standing rules
Add this block to your own CLAUDE.md / AGENTS.md, so the rules hold on every session, not just the one that writes the code.
What you’ll have
- The workspace on your loan page: your server mints a handle per load,
your page renders it with
<SpreadSpaceEmbed>, and refresh is handled. The API key and the token never reach the browser. - The loop: an analyst presses Finalize inside that frame,
spread.finalizedreaches your receiver, and the frozen figures are stored in your own table keyed bysnapshot_id. - Reopen handled:
spread.reopenedmarks that copy under revision until the next finalize arrives with a higher version. - “Finalized by” from your own users table, joined on
finalized_by_external_user_id, the id your server named when it minted the handle. No vendor releases a person’s name to a service account. - Replay and rotation handled: a redelivery is a no-op, and a rotated secret verifies through its 24-hour grace window.
- No vendor call at render time. Your loan page reads your database.
Not covered here: hosting the frame without the React component (the React embed SDK page describes the protocol module for a hand-rolled frame), and production hardening on your side (secret storage, alerting, your own retries).
Up next
The backend leg by hand, with the real envelopes from a live run.
The embed leg by hand: mint, render, identity, scopes, refresh, finalize.
Every event, the envelope, delivery, replay and rotation.
The snapshot lifecycle, the payload and the manifest, key by key.
Every attribute and ratio name, its label, unit and basis.
Render the workspace inside your own product so the Finalize click happens there.