Skip to main content
Documentation

Documents

documents.for_record

List the documents filed against one customer, job or vehicle
Read-onlyRead budget

REST

Shipping
POST /api/v1/documents/for_record

MCP tool

Live
documents.for_record

Exposed on: REST API · Shop MCP server · Claude connector · Dash (in-app copilot) · Zapier. Part of the Documents domain.

Operating contract

The paperwork and photos attached to ONE record — the 'Files' card on a customer, a job, a vehicle, a quote, an invoice, a warranty or a lead.

This is the read to use when the question is about a record rather than about the library. documents.list searches everything; this answers 'what have we got on this car'.

GIVE EXACTLY ONE RECORD ID: customer_id, vehicle_id, job_id, quote_id, invoice_id, warranty_id or lead_id. Two at once is refused rather than guessed at, and each one comes from that domain's own list capability — so there is never a question about which kind of id a field wants.

role says what the file is FOR on that record — a before photo, an after photo, a signed agreement — where the shop recorded one.

Photos are usually the bulk of a job's files. Ask for exclude_photos: true when the question is about paperwork and you do not want forty pictures of a bumper in the way.

TRUNCATION: at most limit documents come back, newest first, and omitted says how many more are filed against the record. When it is not 0, raise limit — do not conclude a job has no signed agreement from a truncated list of its photos.

Who may call it

Permission
NoneThe library is open to every active member of the shop — `/documents` is guarded by `requireShopContext()` and by no section at all, because a technician needs the photos of the car they are working on. Gating this would make a machine see less of the shop's own filing than the bench does.
Plan
Every planNo plan gate. Available on every Service VIN plan.
Retries
naturalNaturally idempotent — running it twice leaves the same world as running it once. A retrying integration needs no key.
Rate class
readCounted against the read budget — the widest of the four.

Partial answers

omitted is how many matching records are not in the response, and 0 is a real answer meaning you have all of them. There is no cursor here — narrow the filter instead.

Do not summarise from a truncated response

When `omitted` is not 0 there are more files on that record. Call again with a bigger `limit` before concluding a document is not there.

Input

FieldTypeDescription
customer_idstringuuid

A customer's id, as returned by customers.list or customers.get.

vehicle_idstringuuid

A vehicle's id, as returned by vehicles.list or vehicles.find_by_vin.

job_idstringuuid

A job's id, as returned by jobs.list or calendar.day.

quote_idstringuuid

A quote's id, as returned by quotes.list.

invoice_idstringuuid

An invoice's id, as returned by invoices.list.

warranty_idstringuuid

A warranty's id, as returned by warranties.list.

lead_idstringuuid

A lead's id, as returned by leads.list.

exclude_photosboolean

True leaves photos and videos out, so paperwork is not buried.

limitinteger1–100

How many documents to return, 1-100. Defaults to 30.

Default: 30

Output

FieldTypeDescription
attached_tostring

itemsobject[]

items[].idstring

items[].titlestring | null

items[].kindstring

items[].rolestring | null

items[].size_bytesnumber | null

items[].created_atstring

omittednumber

Examples

Built from this capability's own schema — required fields and the ones carrying a default, and nothing invented. Paste one and it validates.

curl
export SERVICEVIN_API_KEY=svk_live_…

curl -X POST https://www.servicevin.com/api/v1/documents/for_record \
  -H "Authorization: Bearer $SERVICEVIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"limit":30}'

TypeScript (fetch)
const res = await fetch("https://www.servicevin.com/api/v1/documents/for_record", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SERVICEVIN_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "limit": 30
  }),
});

// Success and failure are both envelopes. Switch on error.code, never
// on error.message — the codes are stable, the messages are for people.
const payload = await res.json();
if (!res.ok) throw new Error(payload.error.code);
const data = payload.data;

Python (requests)
import os, requests

res = requests.post(
    "https://www.servicevin.com/api/v1/documents/for_record",
    headers={"Authorization": f"Bearer {os.environ['SERVICEVIN_API_KEY']}"},
    json={
    "limit": 30
},
    timeout=30,
)
payload = res.json()
if not res.ok:
    raise RuntimeError(payload["error"]["code"])
data = payload["data"]

MCP tools/call — https://www.servicevin.com/api/mcp
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "documents.for_record",
    "arguments": {
      "limit": 30
    }
  }
}

Refusals

The four gates run in this order on every surface, and the order is not arbitrary — see Authentication.

StatusCodeWhen
404not_foundThe id is unknown, or the feature is not enabled for this account. Deliberately the same answer for both.
422validation_errorAn argument was wrong. The message names the field.
429rate_limitedToo many read calls. Back off and retry.
500internal_errorSomething failed on our side. Nothing was changed.