Loading…
We'll authenticate, upload a document, generate a shared link, attach a webhook, and verify its signature.
Open Settings → API keys and create a key with the links:write and documents:write scopes. Export it:
export DATAROOM_API_KEY="sk_live_2j9hf2..."All requests use Bearer auth. Keys are workspace-scoped and rotatable.
Presigned direct-to-storage upload, no base64: create the upload, PUT the bytes straight to storage, then finalize to register the document.
# 1 · Create the upload
curl https://dataroom.corgi.com/api/v1/documents/uploads \
-H "Authorization: Bearer $DATAROOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "filename": "Series-A-deck.pdf", "contentType": "application/pdf" }'
# returns { "data": { "uploadUrl": "https://...", "storageKey": "orgs/.../Series-A-deck.pdf",
# "headers": { "Content-Type": "application/pdf", "x-amz-server-side-encryption": "AES256" },
# "token": "...", "expiresInSec": 900 } }
# Copy uploadUrl, storageKey and token from that response into your shell:
export UPLOAD_URL="https://..." STORAGE_KEY="orgs/.../Series-A-deck.pdf" UPLOAD_TOKEN="..."
# 2 · PUT the bytes straight to storage — send EVERY header from the response's
# "headers" (each signed x-amz-* header is required; a missing one → 403).
curl -T Series-A-deck.pdf \
-H "Content-Type: application/pdf" \
-H "x-amz-server-side-encryption: AES256" \
"$UPLOAD_URL"
# 3 · Finalize — registers the document (double quotes so the vars expand)
curl https://dataroom.corgi.com/api/v1/documents/uploads/finalize \
-H "Authorization: Bearer $DATAROOM_API_KEY" \
-H "Content-Type: application/json" \
-d "{ \"storageKey\": \"$STORAGE_KEY\", \"token\": \"$UPLOAD_TOKEN\" }"
# returns { "data": { "documentId": "doc_2j9hf2", "name": "Series-A-deck.pdf" } }Add documentId to the finalize call to register a new version of an existing document. Small inline files can still POST base64 to /v1/documents.
curl https://dataroom.corgi.com/api/v1/links \
-H "Authorization: Bearer $DATAROOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"document_id": "doc_2j9hf2",
"email_required": true,
"watermark": "{recipient.email}",
"expires_at": "2026-12-31T23:59:59Z"
}'
# returns { "id": "lk_8j2hf", "url": "https://dataroom.corgi.com/lk_8j2hf", ... }The returned url is the live shareable link. Analytics start immediately.
curl https://dataroom.corgi.com/api/v1/webhooks \
-H "Authorization: Bearer $DATAROOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://yourapp.com/webhooks/dataroom",
"events": ["link.viewed", "envelope.signed", "proposal.accepted"]
}'import { createHmac, timingSafeEqual } from "node:crypto";
// app/api/dataroom-webhook/route.ts
// export this as POST from a Next route handler:
async function handleWebhook(req: Request) {
const sig = req.headers.get("x-dataroom-signature")!;
const body = await req.text();
const expected = createHmac("sha256", process.env.DATAROOM_SECRET!)
.update(body)
.digest("hex");
if (!timingSafeEqual(Buffer.from(sig), Buffer.from(expected))) {
return new Response("invalid signature", { status: 401 });
}
const event = JSON.parse(body);
// handle event.type → event.data
return new Response("ok");
}Billed monthly. Full API surface from day one.