/meWho am I
The lender, the department and the key behind the bearer token. Needs no scope, so it is the first call to make with a new key.
Every operation with its parameters, scope and responses, and every record with its fields, from the published contract.
https://app.drawserv.com/api/v1The Drawserv Lender API gives a lender programmatic access to its own construction-loan book: list projects, read draws and their evidence, read reviewed inspections and budgets, create projects, upload documents, and follow activity through an events ledger and signed webhooks.
Every operation in this document is served on production and on the sandbox. Keys are issued by Drawserv staff on request. Operations are added here as they are served. This document describes shapes, not data.
Every request carries a key as a bearer token: Authorization: Bearer <key>. Production keys begin with dsk_live_ and sandbox keys with dsk_test_. A key acts for a lender, optionally narrowed to one department, and never for a person. Keys are issued by Drawserv staff, shown once, stored hashed, and can be revoked at any time. A key may also carry an IP allowlist and an expiry. Portal session tokens are not accepted.
A key's scopes set what it may do. Its lender and department set what it may see: a record outside them is answered as not_found. Every request is logged with its key, method, path, status, duration, address and request id, and staff can show a lender its log.
| Scope | Grants |
|---|---|
projects:read | Read projects, parties, budgets and released risk reports |
draws:read | Read draws, their lines, approvals and lien waivers |
inspections:read | Read reviewed inspections and their progress lines |
documents:read | Read document metadata and fetch short-lived download links |
events:read | Read the events ledger |
projects:write | Create projects and update a pre-closing project's intake fields |
documents:write | Upload documents to a project |
webhooks:manage | Create, list and remove webhook endpoints |
A new key starts with the read scopes. GET /me lists a key's scopes; one that no operation here needs is reserved for a future operation.
List responses are paged with page (from 1) and per_page (at most 200) and have the shape { data: [...], page: { number, size, total } }. Draws are listed by slice (scope: working, funded, declined or open-waivers) or by window (since, with until for history), never all at once. Projects accept updated_since. Every response carries an X-Request-Id header (quote it to support) and an X-Drawserv-Api-Version header (the version of this document the API was built from).
A POST may carry Idempotency-Key, a string of the caller's own choosing of up to 255 visible ASCII characters. A UUID is the usual choice. It makes a retry after a timeout or a 500 safe: for 24 hours the same key with the same body returns the stored response, marked Idempotent-Replayed: true. The same key with a different body, or a key used more than 24 hours ago, is refused with conflict. A refused POST stores nothing, so the key may carry the corrected request. Without the header every POST is a new request.
Field names follow the Drawserv data model and enum values are the application's own. Money is in dollars to the cent as JSON numbers, never cents. Staff-only columns appear in no schema: the API shows a lender exactly what its portal shows.
Every non-2xx response has the shape { "error": { "code", "message", "requestId" } }. The code is stable and the message may change.
| Code | HTTP | Meaning |
|---|---|---|
unauthorized | 401 | The key is missing, malformed, revoked, expired, for the other environment, or a session token was sent |
forbidden_scope | 403 | The key lacks the scope the operation needs |
not_found | 404 | No such record in the key's view, which excludes records outside its lender or department |
validation_failed | 400 | A parameter or body field is missing or malformed |
rate_limited | 429 | The key's request budget is spent; Retry-After says when to retry |
conflict | 409 | The write conflicts with the record's current state, such as a project that is no longer pre-closing |
internal | 500 | Something failed on our side; quote the requestId to support |
The version is in the path: /v1. Changes are additive. A field is never renamed or re-typed, an enum value never changes meaning, and a retired enum value stays declared while a row may still carry it. A breaking change ships as /v2 beside /v1, with twelve months' notice in the changelog.
The events ledger records each lender-visible moment as a type and ids only, so GET /events and a webhook delivery never disagree. The reader fetches the resource itself.
A webhook delivery is a POST whose body is a WebhookDelivery: the event, wrapped, with the attempt number. It carries three headers: Drawserv-Event (the type), Drawserv-Delivery (the delivery id) and Drawserv-Signature, of the form t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<body>"> under the endpoint's secret.
Answer with any 2xx within ten seconds. A redirect is not an acknowledgement. A failed delivery is retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours, then parked. A retry carries the same delivery id, so a receiver that stores ids is idempotent. An endpoint that fails ten deliveries in a row is paused (active: false).
| Event | When |
|---|---|
project.created | A project was created on the lender's book |
project.status_changed | A project's intake stage moved (Draft, In Review, Approved, Declined) |
project.activated | A project closed and went active |
draw.submitted | A draw left draft |
draw.approved | A draw was approved for funding |
draw.funded | A draw was marked funded |
draw.declined | A draw was declined |
inspection.reviewed | An inspection was reviewed and released |
document.added | A document the lender may read was added |
risk_report.released | A risk report was released to the lender |
To verify a delivery, recompute the HMAC over the raw bytes received, compare in constant time, and reject a t more than 300 seconds from your clock:
const { createHmac, timingSafeEqual } = require('node:crypto');
// rawBody: the request body as the BYTES you received (a Buffer or string),
// never JSON.parse(...) re-serialized. secret: the endpoint's whsec_ secret.
function verifyDrawservSignature(header, rawBody, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(String(header || '').split(',').map((p) => p.split('=')));
const t = Number(parts.t);
if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false;
const expected = createHmac('sha256', secret).update(`${t}.`).update(rawBody).digest('hex');
const given = String(parts.v1 || '');
return given.length === expected.length && timingSafeEqual(Buffer.from(given, 'utf8'), Buffer.from(expected, 'utf8'));
}Sandbox keys work against staging.app.drawserv.com, a scrubbed copy of the book with a demo portfolio per lender. Nothing done there reaches production.
The lender, the department and the key behind a bearer token.
/meThe lender, the department and the key behind the bearer token. Needs no scope, so it is the first call to make with a new key.
Projects on the lender's book, their parties, budgets and risk reports.
/projectsscope projects:readEvery project in the key's view, newest first.
Parameters
intakeactivecompletedResponses
/projectsscope projects:writeCreates a project in the Draft stage of intake, as the portal's New project form does. Returns the project as the API reads it. Send an Idempotency-Key so a retry after a timeout never creates a second project.
Parameters
Body
application/json · ProjectCreate
Responses
/projects/{projectId}scope projects:readParameters
Responses
/projects/{projectId}/intakescope projects:writeUpdates the intake fields of a project that has not closed. Answers conflict once the project is active.
Parameters
Body
application/json · IntakePatch
Responses
/projects/{projectId}/partiesscope projects:readThe borrower, the builder and any other party on the project, with their contact people. Parties cannot be changed through the API.
Parameters
Responses
/projects/{projectId}/budgetscope projects:readThe budget lines, the funding sources and the totals, computed on the server.
Parameters
Responses
/risk-reports/{projectId}scope projects:readThe report PDF, available while the project's approval stands. Answers not_found before approval or after a later decision.
Parameters
Responses
Draw requests and their evidence.
/projects/{projectId}/drawsscope draws:readThe project's draws, newest first, with the same slice and window parameters as GET /draws.
Parameters
workingfundeddeclinedopen-waiversResponses
/drawsscope draws:readDraws across the key's view, newest first. Request one slice (scope) or one window (since and until). The whole ledger is never returned at once.
Parameters
workingfundeddeclinedopen-waiversResponses
/draws/{drawId}scope draws:readParameters
Responses
Reviewed site visits.
/inspectionsscope inspections:readReviewed inspections across the key's view, newest first.
Parameters
Responses
/inspections/{inspectionId}scope inspections:readParameters
Responses
Files the lender may read, and uploads to a project.
/projects/{projectId}/documentsscope documents:readThe documents the lender may read on the project, newest first, each with a short-lived download link.
Parameters
Responses
/projects/{projectId}/documentsscope documents:writeDeclares the file and returns a signed URL to PUT its bytes to. The document is created once the bytes arrive. With an Idempotency-Key a retry answers the same slot.
Parameters
Body
application/json · DocumentInput
Responses
/documents/{documentId}scope documents:readThe document's metadata and a fresh short-lived download link.
Parameters
Responses
The ledger of lender-visible moments.
/eventsscope events:readThe ledger of lender-visible moments, oldest first. Keep the last id and pass it as after on the next poll.
Parameters
project.createdproject.status_changedproject.activateddraw.submitteddraw.approveddraw.fundeddraw.declinedinspection.revieweddocument.addedrisk_report.releasedResponses
The URLs that receive events. The delivery itself is described under Webhooks.
/webhooksscope webhooks:manageResponses
/webhooksscope webhooks:manageThe response carries the signing secret once. Store it, as it is not shown again. A retry under the same Idempotency-Key within the window replays the same response, secret included.
Parameters
Body
application/json · WebhookEndpointInput
Responses
/webhooks/{endpointId}scope webhooks:manageDeliveries stop immediately. The endpoint remains in the ledger as removed.
Parameters
Responses
What Drawserv sends to your own endpoint. You receive this request; you do not call it.
your endpointPOSTed to each active endpoint whose event list includes the type. Answer with a 2xx within ten seconds. Anything else is retried with backoff and then parked. Verify the Drawserv-Signature header over the raw body as shown under Events and webhooks. Drawserv-Event carries the type and Drawserv-Delivery the delivery id, which a retry repeats.
Parameters
t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>"> under the endpoint's secretBody
application/json · WebhookDelivery
Responses
Every record the API answers with or accepts, with its fields.
Where a page sits in its list.
Every non-2xx response. The code is stable, the message is for a person, and the requestId identifies the request to support.
unauthorizedforbidden_scopenot_foundvalidation_failedrate_limitedconflictinternalThe lender a key acts for.
A department of the lender. A key bound to a department sees only that department's projects. A key bound to the lender alone sees the whole book.
The calling key. The secret itself is never returned.
livetestprojects:readdraws:readinspections:readdocuments:readevents:readprojects:writedocuments:writewebhooks:manageThe caller: the lender, the department the key is narrowed to, if any, and the key.
The project a draw or inspection belongs to: enough to name and link it.
intakeactivecompletedA contact person on a party.
One construction-loan project on the lender's book. lifecycleStatus is the overall lifecycle (intake, active, completed). intakeStage is the stage within intake and applies only while lifecycleStatus is intake. budgetTotal, fundedToDate, remainingToFund and constructionProgress are computed on the server from the budget, the funded draws and the reviewed inspections. Read them rather than summing lines.
intakeactivecompletedDraftIn ReviewApprovedDeclinedunpaidprocessingpaidwaivedNew ConstructionRenovationModularCommercialManufacturedModular / ManufacturedA party on the project, such as the borrower or the builder, with its contact people.
borrowerbuildercompanyhouseholdA line of the project's budget. fundedToDate is computed on the server.
A source of the project's money: the loan or equity. fundedToDate is computed on the server.
loanequityThe project's budget: its lines, its funding sources and the totals computed from them.
A draw request on a project. status is the current stage (draft, pending, approved or funded, with declined as the exit); the stage timestamps record what was reached. number and requestedAmount are computed on the server. Revoked approvals and voided lien waivers are not returned. lienWaivers are the waivers requested on the draw; citedLienWaivers are signed waivers of other draws that staff attached to it as evidence, each naming its own draw in drawId.
draftpendingapprovedfundeddeclinedinspectionreviewstandardprepaidclosinglenderstaffOne draw's requested amount against one budget line. A budget line with no row here has nothing drawn on this draw.
A party's approval on a draw: awaiting, signed or waived. Revoked approvals and the signature itself are not returned.
applinkrevokedsignedwaivedawaitingA lien waiver requested from a payee on a draw: requested or executed. Voided waivers are not returned. drawId is the draw it was requested on — its own draw, which differs from the draw it is read under when it is cited there as evidence.
applinkvoidedexecutedrequestedAn inspection cited as a draw's evidence: its id and stage timestamps.
pendingcompletedreviewedA site visit on a project, released to the lender once staff have reviewed it. The API returns reviewed inspections only. origin distinguishes an ordered inspector visit from a member's own site check.
pendingcompletedreviewedorderedselfWhat one inspection observed on one budget line: the percent complete recorded at review.
A file the lender may read, such as a released risk report, a draw's documents, a reviewed inspection's photos or the lender's own uploads, with a short-lived download link.
pendingparsingcompletedfailedskippedstaffmemberlenderinspectorsystemotherWhere to send a document's bytes. PUT the file to uploadUrl with the headers given. The document is created once the bytes arrive and is handled like a portal upload.
PUTThe released risk report for a project, available while the project's approval stands.
One lender-visible moment on the book: the type and the ids only. GET /events and webhooks read the same ledger.
project.createdproject.status_changedproject.activateddraw.submitteddraw.approveddraw.fundeddraw.declinedinspection.revieweddocument.addedrisk_report.releasedA URL that receives events. The signing secret is returned once, at creation.
project.createdproject.status_changedproject.activateddraw.submitteddraw.approveddraw.fundeddraw.declinedinspection.revieweddocument.addedrisk_report.releasedThe fields of a new endpoint.
project.createdproject.status_changedproject.activateddraw.submitteddraw.approveddraw.fundeddraw.declinedinspection.revieweddocument.addedrisk_report.releasedThe body of a webhook POST: the event, wrapped. Verify the Drawserv-Signature header as described under Events and webhooks.
A new project on the lender's book: the fields of the portal's New project form. The contract amount and the square footage are set inside the platform, so a body carrying contractAmount or sqft is refused. The lender, the stage and the lifecycle are set on the server. Upload documents after creating the project.
New ConstructionRenovationModularCommercialManufacturedModular / ManufacturedA party to add at creation.
borrowerbuildercompanyhouseholdIntake fields to change on a project that has not closed. Send only the fields to change; a field sent as null is cleared. The contract amount and the square footage are set inside the platform, so a body carrying contractAmount or sqft is refused. Answers conflict once the project is active.
New ConstructionRenovationModularCommercialManufacturedModular / ManufacturedThe file to upload.
Your LOS, servicing and core on one scoped key, with every request logged and every webhook signed.