fastify-x-signwell
xsignwell.documents.get
Fetch a single SignWell document by ID.
xsignwell.documents.get
Fetch a single SignWell document by its ID. Returns the full document object including status, recipients, and timestamps.
Signature
fastify.xsignwell.documents.get(documentId: string): Promise<Object>
Params
| Name | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | The SignWell document ID. |
Returns
The document object including id, name, status, recipients[], created_at, completed_at, and more.
Throws
[xSignwell] documents.get: documentId (string) is required— ifdocumentIdis missing.- Re-throws SignWell API errors with
statusCodeandsignwellErrorproperties.
Examples
Fetch a document by ID
const doc = await fastify.xsignwell.documents.get("doc_abc123");
console.log(doc.status); // "sent", "completed", "declined", etc.
console.log(doc.recipients[0].id); // recipient ID for embedded signing
Realistic — poll document status
fastify.get("/contracts/:documentId/status", async (request, reply) => {
const doc = await fastify.xsignwell.documents.get(request.params.documentId);
const recipientStatuses = doc.recipients.map((r) => ({
name: r.name,
email: r.email,
signed: r.status === "completed",
}));
return reply.send({
status: doc.status,
completed: doc.status === "completed",
recipients: recipientStatuses,
});
});
See also
- documents.list — list all documents with pagination
- documents.create — create a new document
- documents.getCompletedPdf / documents.getAuditTrail — download completed documents
- documents.send / documents.remind / documents.delete — send, remind, or delete a document
AI Context
package: "@xenterprises/fastify-xsignwell"
method: fastify.xsignwell.documents.get(documentId)
use-when: Fetch a single SignWell document by ID to check its status, recipients, or completion details
returns: Document object with id, name, status, recipients[], created_at, completed_at
